id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
141,100 | go-openapi/analysis | flatten.go | getParentFromKey | func getParentFromKey(spec *swspec.Swagger, key string) (string, string, interface{}, error) {
// unescape chars in key, e.g. "{}" from path params
pth, _ := internal.PathUnescape(key[1:])
parent, entry := slashpath.Dir(pth), slashpath.Base(pth)
debugLog("getting schema holder at: %s, with entry: %s", parent, entr... | go | func getParentFromKey(spec *swspec.Swagger, key string) (string, string, interface{}, error) {
// unescape chars in key, e.g. "{}" from path params
pth, _ := internal.PathUnescape(key[1:])
parent, entry := slashpath.Dir(pth), slashpath.Base(pth)
debugLog("getting schema holder at: %s, with entry: %s", parent, entr... | [
"func",
"getParentFromKey",
"(",
"spec",
"*",
"swspec",
".",
"Swagger",
",",
"key",
"string",
")",
"(",
"string",
",",
"string",
",",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// unescape chars in key, e.g. \"{}\" from path params",
"pth",
",",
"_",
":="... | // getParentFromKey retrieves the container of the JSON pointer "key" | [
"getParentFromKey",
"retrieves",
"the",
"container",
"of",
"the",
"JSON",
"pointer",
"key"
] | e2f3fdbb7ed0e56e070ccbfb6fc75b288a33c014 | https://github.com/go-openapi/analysis/blob/e2f3fdbb7ed0e56e070ccbfb6fc75b288a33c014/flatten.go#L955-L971 |
141,101 | go-openapi/analysis | flatten.go | updateRef | func updateRef(spec *swspec.Swagger, key string, ref swspec.Ref) error {
debugLog("updating ref for %s with %s", key, ref.String())
pth, value, err := getPointerFromKey(spec, key)
if err != nil {
return err
}
switch refable := value.(type) {
case *swspec.Schema:
refable.Ref = ref
case *swspec.SchemaOrArray:... | go | func updateRef(spec *swspec.Swagger, key string, ref swspec.Ref) error {
debugLog("updating ref for %s with %s", key, ref.String())
pth, value, err := getPointerFromKey(spec, key)
if err != nil {
return err
}
switch refable := value.(type) {
case *swspec.Schema:
refable.Ref = ref
case *swspec.SchemaOrArray:... | [
"func",
"updateRef",
"(",
"spec",
"*",
"swspec",
".",
"Swagger",
",",
"key",
"string",
",",
"ref",
"swspec",
".",
"Ref",
")",
"error",
"{",
"debugLog",
"(",
"\"",
"\"",
",",
"key",
",",
"ref",
".",
"String",
"(",
")",
")",
"\n",
"pth",
",",
"valu... | // updateRef replaces a ref by another one | [
"updateRef",
"replaces",
"a",
"ref",
"by",
"another",
"one"
] | e2f3fdbb7ed0e56e070ccbfb6fc75b288a33c014 | https://github.com/go-openapi/analysis/blob/e2f3fdbb7ed0e56e070ccbfb6fc75b288a33c014/flatten.go#L974-L1031 |
141,102 | go-openapi/analysis | flatten.go | stripPointersAndOAIGen | func stripPointersAndOAIGen(opts *FlattenOpts) error {
// name all JSON pointers to anonymous documents
if err := namePointers(opts); err != nil {
return err
}
// remove unnecessary OAIGen ref (created when flattening external refs creates name conflicts)
hasIntroducedPointerOrInline, ers := stripOAIGen(opts)
... | go | func stripPointersAndOAIGen(opts *FlattenOpts) error {
// name all JSON pointers to anonymous documents
if err := namePointers(opts); err != nil {
return err
}
// remove unnecessary OAIGen ref (created when flattening external refs creates name conflicts)
hasIntroducedPointerOrInline, ers := stripOAIGen(opts)
... | [
"func",
"stripPointersAndOAIGen",
"(",
"opts",
"*",
"FlattenOpts",
")",
"error",
"{",
"// name all JSON pointers to anonymous documents",
"if",
"err",
":=",
"namePointers",
"(",
"opts",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// r... | // stripPointersAndOAIGen removes anonymous JSON pointers from spec and chain with name conflicts handler.
// This loops until the spec has no such pointer and all name conflicts have been reduced as much as possible. | [
"stripPointersAndOAIGen",
"removes",
"anonymous",
"JSON",
"pointers",
"from",
"spec",
"and",
"chain",
"with",
"name",
"conflicts",
"handler",
".",
"This",
"loops",
"until",
"the",
"spec",
"has",
"no",
"such",
"pointer",
"and",
"all",
"name",
"conflicts",
"have",... | e2f3fdbb7ed0e56e070ccbfb6fc75b288a33c014 | https://github.com/go-openapi/analysis/blob/e2f3fdbb7ed0e56e070ccbfb6fc75b288a33c014/flatten.go#L1153-L1183 |
141,103 | go-openapi/analysis | flatten.go | croak | func croak(opts *FlattenOpts) {
reported := make(map[string]bool, len(opts.flattenContext.newRefs))
for _, v := range opts.Spec.references.allRefs {
// warns about duplicate handling
for _, r := range opts.flattenContext.newRefs {
if r.isOAIGen && r.path == v.String() {
reported[r.newName] = true
}
}
... | go | func croak(opts *FlattenOpts) {
reported := make(map[string]bool, len(opts.flattenContext.newRefs))
for _, v := range opts.Spec.references.allRefs {
// warns about duplicate handling
for _, r := range opts.flattenContext.newRefs {
if r.isOAIGen && r.path == v.String() {
reported[r.newName] = true
}
}
... | [
"func",
"croak",
"(",
"opts",
"*",
"FlattenOpts",
")",
"{",
"reported",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
",",
"len",
"(",
"opts",
".",
"flattenContext",
".",
"newRefs",
")",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"opts... | // croak logs notifications and warnings about valid, but possibly unwanted constructs resulting
// from flattening a spec | [
"croak",
"logs",
"notifications",
"and",
"warnings",
"about",
"valid",
"but",
"possibly",
"unwanted",
"constructs",
"resulting",
"from",
"flattening",
"a",
"spec"
] | e2f3fdbb7ed0e56e070ccbfb6fc75b288a33c014 | https://github.com/go-openapi/analysis/blob/e2f3fdbb7ed0e56e070ccbfb6fc75b288a33c014/flatten.go#L1256-L1278 |
141,104 | mohae/struct2csv | struct2csv.go | SetBase | func (e *Encoder) SetBase(i int) {
if i < 2 {
i = 2
}
e.base = i
} | go | func (e *Encoder) SetBase(i int) {
if i < 2 {
i = 2
}
e.base = i
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"SetBase",
"(",
"i",
"int",
")",
"{",
"if",
"i",
"<",
"2",
"{",
"i",
"=",
"2",
"\n",
"}",
"\n",
"e",
".",
"base",
"=",
"i",
"\n",
"}"
] | // SetBase sets the base for strings.FormatUint. By default, this is 10. Set
// the base if another base should be used for formatting uint values.
//
// Base 2 is the minimum value; anything less will be set to two. | [
"SetBase",
"sets",
"the",
"base",
"for",
"strings",
".",
"FormatUint",
".",
"By",
"default",
"this",
"is",
"10",
".",
"Set",
"the",
"base",
"if",
"another",
"base",
"should",
"be",
"used",
"for",
"formatting",
"uint",
"values",
".",
"Base",
"2",
"is",
... | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L124-L129 |
141,105 | mohae/struct2csv | struct2csv.go | ColNames | func (e *Encoder) ColNames() []string {
ret := make([]string, len(e.colNames))
_ = copy(ret, e.colNames)
return ret
} | go | func (e *Encoder) ColNames() []string {
ret := make([]string, len(e.colNames))
_ = copy(ret, e.colNames)
return ret
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"ColNames",
"(",
")",
"[",
"]",
"string",
"{",
"ret",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"e",
".",
"colNames",
")",
")",
"\n",
"_",
"=",
"copy",
"(",
"ret",
",",
"e",
".",
"colNames"... | // ColNames returns the encoder's saved column names as a copy. The
// colNames field must be populated before using this. | [
"ColNames",
"returns",
"the",
"encoder",
"s",
"saved",
"column",
"names",
"as",
"a",
"copy",
".",
"The",
"colNames",
"field",
"must",
"be",
"populated",
"before",
"using",
"this",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L133-L137 |
141,106 | mohae/struct2csv | struct2csv.go | getColNames | func (e *Encoder) getColNames(v interface{}) []string {
typ := reflect.TypeOf(v)
val := reflect.ValueOf(v)
var cols []string
for i := 0; i < typ.NumField(); i++ {
// skip unexported
tF := typ.Field(i)
if len(tF.PkgPath) > 0 {
continue
}
name := e.getFieldName(tF)
if name == "" {
continue
}
vF ... | go | func (e *Encoder) getColNames(v interface{}) []string {
typ := reflect.TypeOf(v)
val := reflect.ValueOf(v)
var cols []string
for i := 0; i < typ.NumField(); i++ {
// skip unexported
tF := typ.Field(i)
if len(tF.PkgPath) > 0 {
continue
}
name := e.getFieldName(tF)
if name == "" {
continue
}
vF ... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"getColNames",
"(",
"v",
"interface",
"{",
"}",
")",
"[",
"]",
"string",
"{",
"typ",
":=",
"reflect",
".",
"TypeOf",
"(",
"v",
")",
"\n",
"val",
":=",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"\n",
"var",
... | // The private func where the work is done. This also copies the headers
// to the Encoder.colNames field. | [
"The",
"private",
"func",
"where",
"the",
"work",
"is",
"done",
".",
"This",
"also",
"copies",
"the",
"headers",
"to",
"the",
"Encoder",
".",
"colNames",
"field",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L161-L190 |
141,107 | mohae/struct2csv | struct2csv.go | marshal | func (e *Encoder) marshal(val reflect.Value, child bool) (cols []string, ok bool) {
var s string
switch val.Kind() {
case reflect.Ptr:
// for maps and slices, check that they are of supported types
ok = supportedBaseKind(val)
if !ok {
return nil, false
}
vv := reflect.Indirect(val)
switch vv.Kind() {
... | go | func (e *Encoder) marshal(val reflect.Value, child bool) (cols []string, ok bool) {
var s string
switch val.Kind() {
case reflect.Ptr:
// for maps and slices, check that they are of supported types
ok = supportedBaseKind(val)
if !ok {
return nil, false
}
vv := reflect.Indirect(val)
switch vv.Kind() {
... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"marshal",
"(",
"val",
"reflect",
".",
"Value",
",",
"child",
"bool",
")",
"(",
"cols",
"[",
"]",
"string",
",",
"ok",
"bool",
")",
"{",
"var",
"s",
"string",
"\n",
"switch",
"val",
".",
"Kind",
"(",
")",
... | // marshal returns the marshaled value. If the received value is not of a
// supported Kind, a nil is returned along with false. For supported kinds, a
// slice of values is returned along with true. | [
"marshal",
"returns",
"the",
"marshaled",
"value",
".",
"If",
"the",
"received",
"value",
"is",
"not",
"of",
"a",
"supported",
"Kind",
"a",
"nil",
"is",
"returned",
"along",
"with",
"false",
".",
"For",
"supported",
"kinds",
"a",
"slice",
"of",
"values",
... | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L254-L290 |
141,108 | mohae/struct2csv | struct2csv.go | marshalStruct | func (e *Encoder) marshalStruct(str interface{}, child bool) ([]string, bool) {
var cols []string
val := reflect.ValueOf(str)
typ := reflect.TypeOf(str)
for i := 0; i < typ.NumField(); i++ {
tF := typ.Field(i)
if len(tF.PkgPath) > 0 {
continue
}
name := e.getFieldName(tF)
if name == "" {
continue
... | go | func (e *Encoder) marshalStruct(str interface{}, child bool) ([]string, bool) {
var cols []string
val := reflect.ValueOf(str)
typ := reflect.TypeOf(str)
for i := 0; i < typ.NumField(); i++ {
tF := typ.Field(i)
if len(tF.PkgPath) > 0 {
continue
}
name := e.getFieldName(tF)
if name == "" {
continue
... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"marshalStruct",
"(",
"str",
"interface",
"{",
"}",
",",
"child",
"bool",
")",
"(",
"[",
"]",
"string",
",",
"bool",
")",
"{",
"var",
"cols",
"[",
"]",
"string",
"\n",
"val",
":=",
"reflect",
".",
"ValueOf",
... | // marshal struct field data into a slice. | [
"marshal",
"struct",
"field",
"data",
"into",
"a",
"slice",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L293-L315 |
141,109 | mohae/struct2csv | struct2csv.go | marshalMap | func (e *Encoder) marshalMap(m reflect.Value, child bool) (string, bool) {
var ok bool
if ok = supportedBaseKind(m); !ok {
return "", false
}
// get the kind of the map value
var row string
var sv stringValues = m.MapKeys()
// sort the map keys first
// TODO have this work on things other than string?
sort.S... | go | func (e *Encoder) marshalMap(m reflect.Value, child bool) (string, bool) {
var ok bool
if ok = supportedBaseKind(m); !ok {
return "", false
}
// get the kind of the map value
var row string
var sv stringValues = m.MapKeys()
// sort the map keys first
// TODO have this work on things other than string?
sort.S... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"marshalMap",
"(",
"m",
"reflect",
".",
"Value",
",",
"child",
"bool",
")",
"(",
"string",
",",
"bool",
")",
"{",
"var",
"ok",
"bool",
"\n",
"if",
"ok",
"=",
"supportedBaseKind",
"(",
"m",
")",
";",
"!",
"ok... | // marshal map handles marshalling of maps. Both the key and value types must
// be supported Kinds. | [
"marshal",
"map",
"handles",
"marshalling",
"of",
"maps",
".",
"Both",
"the",
"key",
"and",
"value",
"types",
"must",
"be",
"supported",
"Kinds",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L319-L370 |
141,110 | mohae/struct2csv | struct2csv.go | marshalSlice | func (e *Encoder) marshalSlice(val reflect.Value, child bool) (string, bool) {
var ok bool
if ok = supportedBaseKind(val); !ok {
return "", false
}
var sl, str string
// check the type of slice and handle
for j := 0; j < val.Len(); j++ {
str = ""
str, ok = e.stringify(val.Index(j), child)
if !ok {
retu... | go | func (e *Encoder) marshalSlice(val reflect.Value, child bool) (string, bool) {
var ok bool
if ok = supportedBaseKind(val); !ok {
return "", false
}
var sl, str string
// check the type of slice and handle
for j := 0; j < val.Len(); j++ {
str = ""
str, ok = e.stringify(val.Index(j), child)
if !ok {
retu... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"marshalSlice",
"(",
"val",
"reflect",
".",
"Value",
",",
"child",
"bool",
")",
"(",
"string",
",",
"bool",
")",
"{",
"var",
"ok",
"bool",
"\n",
"if",
"ok",
"=",
"supportedBaseKind",
"(",
"val",
")",
";",
"!",... | // marshalSlice handles marshaling of slices. This should not receive a
// pointer. Is is assumed that any pointers to the slice have already been
// dereferenced. | [
"marshalSlice",
"handles",
"marshaling",
"of",
"slices",
".",
"This",
"should",
"not",
"receive",
"a",
"pointer",
".",
"Is",
"is",
"assumed",
"that",
"any",
"pointers",
"to",
"the",
"slice",
"have",
"already",
"been",
"dereferenced",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L375-L398 |
141,111 | mohae/struct2csv | struct2csv.go | stringify | func (e *Encoder) stringify(v reflect.Value, child bool) (string, bool) {
if !isSupportedKind(v.Kind()) {
return "", false
}
switch v.Kind() {
case reflect.Bool:
return strconv.FormatBool(v.Bool()), true
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return strconv.Itoa(int(v.In... | go | func (e *Encoder) stringify(v reflect.Value, child bool) (string, bool) {
if !isSupportedKind(v.Kind()) {
return "", false
}
switch v.Kind() {
case reflect.Bool:
return strconv.FormatBool(v.Bool()), true
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return strconv.Itoa(int(v.In... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"stringify",
"(",
"v",
"reflect",
".",
"Value",
",",
"child",
"bool",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"!",
"isSupportedKind",
"(",
"v",
".",
"Kind",
"(",
")",
")",
"{",
"return",
"\"",
"\"",... | // stringify takes a interface and returns the value it contains as a string
// and true. Composite types will first be marshaled. If the received Kind is
// not supported, and empty string and false will be returned. | [
"stringify",
"takes",
"a",
"interface",
"and",
"returns",
"the",
"value",
"it",
"contains",
"as",
"a",
"string",
"and",
"true",
".",
"Composite",
"types",
"will",
"first",
"be",
"marshaled",
".",
"If",
"the",
"received",
"Kind",
"is",
"not",
"supported",
"... | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L403-L438 |
141,112 | mohae/struct2csv | struct2csv.go | ptrKind | func ptrKind(typ reflect.Type) reflect.Kind {
if typ.Kind() == reflect.Ptr {
return ptrKind(typ.Elem())
}
return typ.Kind()
} | go | func ptrKind(typ reflect.Type) reflect.Kind {
if typ.Kind() == reflect.Ptr {
return ptrKind(typ.Elem())
}
return typ.Kind()
} | [
"func",
"ptrKind",
"(",
"typ",
"reflect",
".",
"Type",
")",
"reflect",
".",
"Kind",
"{",
"if",
"typ",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"return",
"ptrKind",
"(",
"typ",
".",
"Elem",
"(",
")",
")",
"\n",
"}",
"\n",
"return",... | // ptrKind returns the Kind that it points to; if it's another pointer, this
// will recurse until it encounters a non-pointer kind. | [
"ptrKind",
"returns",
"the",
"Kind",
"that",
"it",
"points",
"to",
";",
"if",
"it",
"s",
"another",
"pointer",
"this",
"will",
"recurse",
"until",
"it",
"encounters",
"a",
"non",
"-",
"pointer",
"kind",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L442-L447 |
141,113 | mohae/struct2csv | struct2csv.go | isSupportedKind | func isSupportedKind(k reflect.Kind) bool {
switch k {
case reflect.Chan:
return false
case reflect.Func:
return false
case reflect.Interface:
return false
case reflect.Uintptr:
return false
case reflect.UnsafePointer:
return false
case reflect.Invalid:
return false
}
return true
} | go | func isSupportedKind(k reflect.Kind) bool {
switch k {
case reflect.Chan:
return false
case reflect.Func:
return false
case reflect.Interface:
return false
case reflect.Uintptr:
return false
case reflect.UnsafePointer:
return false
case reflect.Invalid:
return false
}
return true
} | [
"func",
"isSupportedKind",
"(",
"k",
"reflect",
".",
"Kind",
")",
"bool",
"{",
"switch",
"k",
"{",
"case",
"reflect",
".",
"Chan",
":",
"return",
"false",
"\n",
"case",
"reflect",
".",
"Func",
":",
"return",
"false",
"\n",
"case",
"reflect",
".",
"Inte... | // returns whether or not the Kind is supported for usage in CSV. | [
"returns",
"whether",
"or",
"not",
"the",
"Kind",
"is",
"supported",
"for",
"usage",
"in",
"CSV",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L512-L528 |
141,114 | mohae/struct2csv | struct2csv.go | getFieldName | func (e *Encoder) getFieldName(field reflect.StructField) string {
if e.useTags {
name := field.Tag.Get(e.tag)
// skip columns tagged with -
if name == "-" {
return ""
}
if name != "" {
return name
}
}
return field.Name
} | go | func (e *Encoder) getFieldName(field reflect.StructField) string {
if e.useTags {
name := field.Tag.Get(e.tag)
// skip columns tagged with -
if name == "-" {
return ""
}
if name != "" {
return name
}
}
return field.Name
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"getFieldName",
"(",
"field",
"reflect",
".",
"StructField",
")",
"string",
"{",
"if",
"e",
".",
"useTags",
"{",
"name",
":=",
"field",
".",
"Tag",
".",
"Get",
"(",
"e",
".",
"tag",
")",
"\n",
"// skip columns t... | // getFieldName gets the field name. If field tags are being used and the field
// is tagged with -, or skip this field, an empty string will be returned;
// which is a signal to skip this field. | [
"getFieldName",
"gets",
"the",
"field",
"name",
".",
"If",
"field",
"tags",
"are",
"being",
"used",
"and",
"the",
"field",
"is",
"tagged",
"with",
"-",
"or",
"skip",
"this",
"field",
"an",
"empty",
"string",
"will",
"be",
"returned",
";",
"which",
"is",
... | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/struct2csv.go#L533-L546 |
141,115 | mohae/struct2csv | writer.go | NewWriter | func NewWriter(w io.Writer) *Writer {
enc := New()
return &Writer{e: *enc, w: csv.NewWriter(w)}
} | go | func NewWriter(w io.Writer) *Writer {
enc := New()
return &Writer{e: *enc, w: csv.NewWriter(w)}
} | [
"func",
"NewWriter",
"(",
"w",
"io",
".",
"Writer",
")",
"*",
"Writer",
"{",
"enc",
":=",
"New",
"(",
")",
"\n",
"return",
"&",
"Writer",
"{",
"e",
":",
"*",
"enc",
",",
"w",
":",
"csv",
".",
"NewWriter",
"(",
"w",
")",
"}",
"\n",
"}"
] | // NewWriter returns a new Writer that write to w. | [
"NewWriter",
"returns",
"a",
"new",
"Writer",
"that",
"write",
"to",
"w",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/writer.go#L28-L31 |
141,116 | mohae/struct2csv | writer.go | WriteColNames | func (w *Writer) WriteColNames(st interface{}) error {
cols, err := w.e.GetColNames(st)
if err != nil {
return err
}
w.r++
return w.w.Write(cols)
} | go | func (w *Writer) WriteColNames(st interface{}) error {
cols, err := w.e.GetColNames(st)
if err != nil {
return err
}
w.r++
return w.w.Write(cols)
} | [
"func",
"(",
"w",
"*",
"Writer",
")",
"WriteColNames",
"(",
"st",
"interface",
"{",
"}",
")",
"error",
"{",
"cols",
",",
"err",
":=",
"w",
".",
"e",
".",
"GetColNames",
"(",
"st",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
... | // WriteColNames writes out the column names of the CSV field. | [
"WriteColNames",
"writes",
"out",
"the",
"column",
"names",
"of",
"the",
"CSV",
"field",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/writer.go#L34-L41 |
141,117 | mohae/struct2csv | writer.go | WriteStruct | func (w *Writer) WriteStruct(st interface{}) error {
row, err := w.e.GetRow(st)
if err != nil {
return err
}
w.r++
return w.w.Write(row)
} | go | func (w *Writer) WriteStruct(st interface{}) error {
row, err := w.e.GetRow(st)
if err != nil {
return err
}
w.r++
return w.w.Write(row)
} | [
"func",
"(",
"w",
"*",
"Writer",
")",
"WriteStruct",
"(",
"st",
"interface",
"{",
"}",
")",
"error",
"{",
"row",
",",
"err",
":=",
"w",
".",
"e",
".",
"GetRow",
"(",
"st",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
... | // WriteStruct takes a struct, marshals it to CSV and writhes the CSV
// record to the writer | [
"WriteStruct",
"takes",
"a",
"struct",
"marshals",
"it",
"to",
"CSV",
"and",
"writhes",
"the",
"CSV",
"record",
"to",
"the",
"writer"
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/writer.go#L45-L52 |
141,118 | mohae/struct2csv | writer.go | WriteStructs | func (w *Writer) WriteStructs(st interface{}) error {
rows, err := w.e.Marshal(st)
if err != nil {
return err
}
w.r = len(rows)
w.w.WriteAll(rows)
w.w.Flush()
return w.w.Error()
} | go | func (w *Writer) WriteStructs(st interface{}) error {
rows, err := w.e.Marshal(st)
if err != nil {
return err
}
w.r = len(rows)
w.w.WriteAll(rows)
w.w.Flush()
return w.w.Error()
} | [
"func",
"(",
"w",
"*",
"Writer",
")",
"WriteStructs",
"(",
"st",
"interface",
"{",
"}",
")",
"error",
"{",
"rows",
",",
"err",
":=",
"w",
".",
"e",
".",
"Marshal",
"(",
"st",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",... | // WriteStructs takes a slice of structs and writes them as CSV records. This
// includes writing out the column names as the first row. When done, Flush
// is called. | [
"WriteStructs",
"takes",
"a",
"slice",
"of",
"structs",
"and",
"writes",
"them",
"as",
"CSV",
"records",
".",
"This",
"includes",
"writing",
"out",
"the",
"column",
"names",
"as",
"the",
"first",
"row",
".",
"When",
"done",
"Flush",
"is",
"called",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/writer.go#L57-L66 |
141,119 | mohae/struct2csv | writer.go | Write | func (w *Writer) Write(row []string) error {
err := w.w.Write(row)
if err != nil {
return err
}
w.r++
return nil
} | go | func (w *Writer) Write(row []string) error {
err := w.w.Write(row)
if err != nil {
return err
}
w.r++
return nil
} | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Write",
"(",
"row",
"[",
"]",
"string",
")",
"error",
"{",
"err",
":=",
"w",
".",
"w",
".",
"Write",
"(",
"row",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"r... | // Write takes a slice of strings and writes them as a single CSV record. | [
"Write",
"takes",
"a",
"slice",
"of",
"strings",
"and",
"writes",
"them",
"as",
"a",
"single",
"CSV",
"record",
"."
] | e72239694eae3a8398bb3b39050330333eb66c44 | https://github.com/mohae/struct2csv/blob/e72239694eae3a8398bb3b39050330333eb66c44/writer.go#L69-L76 |
141,120 | kjk/betterguid | betterguid.go | New | func New() string {
var id [8 + 12]byte
mu.Lock()
timeMs := time.Now().UTC().UnixNano() / 1e6
if timeMs == lastPushTimeMs {
// increment lastRandChars
for i := 0; i < 12; i++ {
lastRandChars[i]++
if lastRandChars[i] < 64 {
break
}
// increment the next byte
lastRandChars[i] = 0
}
} else {
... | go | func New() string {
var id [8 + 12]byte
mu.Lock()
timeMs := time.Now().UTC().UnixNano() / 1e6
if timeMs == lastPushTimeMs {
// increment lastRandChars
for i := 0; i < 12; i++ {
lastRandChars[i]++
if lastRandChars[i] < 64 {
break
}
// increment the next byte
lastRandChars[i] = 0
}
} else {
... | [
"func",
"New",
"(",
")",
"string",
"{",
"var",
"id",
"[",
"8",
"+",
"12",
"]",
"byte",
"\n",
"mu",
".",
"Lock",
"(",
")",
"\n",
"timeMs",
":=",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
".",
"UnixNano",
"(",
")",
"/",
"1e6",
"\n",... | // New creates a new random, unique id | [
"New",
"creates",
"a",
"new",
"random",
"unique",
"id"
] | c442874ba63a7beb6c8b6f14ad1675de747b7f71 | https://github.com/kjk/betterguid/blob/c442874ba63a7beb6c8b6f14ad1675de747b7f71/betterguid.go#L38-L69 |
141,121 | cyberdelia/go-metrics-graphite | graphite.go | WithConfig | func WithConfig(c Config) {
for _ = range time.Tick(c.FlushInterval) {
if err := graphite(&c); nil != err {
log.Println(err)
}
}
} | go | func WithConfig(c Config) {
for _ = range time.Tick(c.FlushInterval) {
if err := graphite(&c); nil != err {
log.Println(err)
}
}
} | [
"func",
"WithConfig",
"(",
"c",
"Config",
")",
"{",
"for",
"_",
"=",
"range",
"time",
".",
"Tick",
"(",
"c",
".",
"FlushInterval",
")",
"{",
"if",
"err",
":=",
"graphite",
"(",
"&",
"c",
")",
";",
"nil",
"!=",
"err",
"{",
"log",
".",
"Println",
... | // WithConfig is a blocking exporter function just like Graphite,
// but it takes a GraphiteConfig instead. | [
"WithConfig",
"is",
"a",
"blocking",
"exporter",
"function",
"just",
"like",
"Graphite",
"but",
"it",
"takes",
"a",
"GraphiteConfig",
"instead",
"."
] | 39f87cc3b432bbb898d7c643c0e93cac2bc865ad | https://github.com/cyberdelia/go-metrics-graphite/blob/39f87cc3b432bbb898d7c643c0e93cac2bc865ad/graphite.go#L42-L48 |
141,122 | xinsnake/go-http-digest-auth-client | digest_auth_client.go | NewRequest | func NewRequest(username, password, method, uri, body string) DigestRequest {
dr := DigestRequest{}
dr.UpdateRequest(username, password, method, uri, body)
dr.CertVal = true
return dr
} | go | func NewRequest(username, password, method, uri, body string) DigestRequest {
dr := DigestRequest{}
dr.UpdateRequest(username, password, method, uri, body)
dr.CertVal = true
return dr
} | [
"func",
"NewRequest",
"(",
"username",
",",
"password",
",",
"method",
",",
"uri",
",",
"body",
"string",
")",
"DigestRequest",
"{",
"dr",
":=",
"DigestRequest",
"{",
"}",
"\n",
"dr",
".",
"UpdateRequest",
"(",
"username",
",",
"password",
",",
"method",
... | // NewRequest creates a new DigestRequest object | [
"NewRequest",
"creates",
"a",
"new",
"DigestRequest",
"object"
] | 9da83de55d71220f00cbffb736dba373e6e683b1 | https://github.com/xinsnake/go-http-digest-auth-client/blob/9da83de55d71220f00cbffb736dba373e6e683b1/digest_auth_client.go#L29-L34 |
141,123 | xinsnake/go-http-digest-auth-client | digest_auth_client.go | NewTransport | func NewTransport(username, password string) DigestTransport {
dt := DigestTransport{}
dt.Password = password
dt.Username = username
return dt
} | go | func NewTransport(username, password string) DigestTransport {
dt := DigestTransport{}
dt.Password = password
dt.Username = username
return dt
} | [
"func",
"NewTransport",
"(",
"username",
",",
"password",
"string",
")",
"DigestTransport",
"{",
"dt",
":=",
"DigestTransport",
"{",
"}",
"\n",
"dt",
".",
"Password",
"=",
"password",
"\n",
"dt",
".",
"Username",
"=",
"username",
"\n",
"return",
"dt",
"\n"... | // NewTransport creates a new DigestTransport object | [
"NewTransport",
"creates",
"a",
"new",
"DigestTransport",
"object"
] | 9da83de55d71220f00cbffb736dba373e6e683b1 | https://github.com/xinsnake/go-http-digest-auth-client/blob/9da83de55d71220f00cbffb736dba373e6e683b1/digest_auth_client.go#L37-L42 |
141,124 | xinsnake/go-http-digest-auth-client | digest_auth_client.go | UpdateRequest | func (dr *DigestRequest) UpdateRequest(username, password, method, uri, body string) *DigestRequest {
dr.Body = body
dr.Method = method
dr.Password = password
dr.URI = uri
dr.Username = username
dr.Header = make(map[string][]string)
return dr
} | go | func (dr *DigestRequest) UpdateRequest(username, password, method, uri, body string) *DigestRequest {
dr.Body = body
dr.Method = method
dr.Password = password
dr.URI = uri
dr.Username = username
dr.Header = make(map[string][]string)
return dr
} | [
"func",
"(",
"dr",
"*",
"DigestRequest",
")",
"UpdateRequest",
"(",
"username",
",",
"password",
",",
"method",
",",
"uri",
",",
"body",
"string",
")",
"*",
"DigestRequest",
"{",
"dr",
".",
"Body",
"=",
"body",
"\n",
"dr",
".",
"Method",
"=",
"method",... | // UpdateRequest is called when you want to reuse an existing
// DigestRequest connection with new request information | [
"UpdateRequest",
"is",
"called",
"when",
"you",
"want",
"to",
"reuse",
"an",
"existing",
"DigestRequest",
"connection",
"with",
"new",
"request",
"information"
] | 9da83de55d71220f00cbffb736dba373e6e683b1 | https://github.com/xinsnake/go-http-digest-auth-client/blob/9da83de55d71220f00cbffb736dba373e6e683b1/digest_auth_client.go#L46-L54 |
141,125 | xinsnake/go-http-digest-auth-client | digest_auth_client.go | Execute | func (dr *DigestRequest) Execute() (resp *http.Response, err error) {
if dr.Auth != nil {
return dr.executeExistingDigest()
}
var req *http.Request
if req, err = http.NewRequest(dr.Method, dr.URI, bytes.NewReader([]byte(dr.Body))); err != nil {
return nil, err
}
req.Header = dr.Header
client := &http.Clie... | go | func (dr *DigestRequest) Execute() (resp *http.Response, err error) {
if dr.Auth != nil {
return dr.executeExistingDigest()
}
var req *http.Request
if req, err = http.NewRequest(dr.Method, dr.URI, bytes.NewReader([]byte(dr.Body))); err != nil {
return nil, err
}
req.Header = dr.Header
client := &http.Clie... | [
"func",
"(",
"dr",
"*",
"DigestRequest",
")",
"Execute",
"(",
")",
"(",
"resp",
"*",
"http",
".",
"Response",
",",
"err",
"error",
")",
"{",
"if",
"dr",
".",
"Auth",
"!=",
"nil",
"{",
"return",
"dr",
".",
"executeExistingDigest",
"(",
")",
"\n",
"}... | // Execute initialise the request and get a response | [
"Execute",
"initialise",
"the",
"request",
"and",
"get",
"a",
"response"
] | 9da83de55d71220f00cbffb736dba373e6e683b1 | https://github.com/xinsnake/go-http-digest-auth-client/blob/9da83de55d71220f00cbffb736dba373e6e683b1/digest_auth_client.go#L75-L108 |
141,126 | intervention-engine/fhir | server/request_logger.go | RequestLoggerHandler | func RequestLoggerHandler(c *gin.Context) {
if c.Request != nil {
buf, _ := ioutil.ReadAll(c.Request.Body)
c.Request.Body.Close()
log.Println("-----------------------------------------------------------------------------------------------------")
log.Println("REQUEST HEADERS:")
for k, v := range c.Request.... | go | func RequestLoggerHandler(c *gin.Context) {
if c.Request != nil {
buf, _ := ioutil.ReadAll(c.Request.Body)
c.Request.Body.Close()
log.Println("-----------------------------------------------------------------------------------------------------")
log.Println("REQUEST HEADERS:")
for k, v := range c.Request.... | [
"func",
"RequestLoggerHandler",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"if",
"c",
".",
"Request",
"!=",
"nil",
"{",
"buf",
",",
"_",
":=",
"ioutil",
".",
"ReadAll",
"(",
"c",
".",
"Request",
".",
"Body",
")",
"\n",
"c",
".",
"Request",
"... | // RequestLoggerHandler is a handler intended to be used during debugging to log out the request details including
// the request headers and the request body. This should not be used in production as it has performance implications. | [
"RequestLoggerHandler",
"is",
"a",
"handler",
"intended",
"to",
"be",
"used",
"during",
"debugging",
"to",
"log",
"out",
"the",
"request",
"details",
"including",
"the",
"request",
"headers",
"and",
"the",
"request",
"body",
".",
"This",
"should",
"not",
"be",... | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/request_logger.go#L13-L30 |
141,127 | intervention-engine/fhir | auth/oidc.go | OIDCAuthenticationHandler | func OIDCAuthenticationHandler(config oauth2.Config) gin.HandlerFunc {
return func(c *gin.Context) {
// Let things pass through to the redirect path, as it sets up the session
if strings.Contains(c.Request.URL.Path, "/redirect") {
return
}
session := sessions.Default(c)
ui := session.Get("UserInfo")
if ... | go | func OIDCAuthenticationHandler(config oauth2.Config) gin.HandlerFunc {
return func(c *gin.Context) {
// Let things pass through to the redirect path, as it sets up the session
if strings.Contains(c.Request.URL.Path, "/redirect") {
return
}
session := sessions.Default(c)
ui := session.Get("UserInfo")
if ... | [
"func",
"OIDCAuthenticationHandler",
"(",
"config",
"oauth2",
".",
"Config",
")",
"gin",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"// Let things pass through to the redirect path, as it sets up the session",
"if",
"str... | // OIDCAuthenticationHandler is a middleware that will check for the presence of a session with
// a UserInfo value set. If it exists, it will assume that the has logged in at some point. It will then
// check the session for a token. If the token has not expired, it will set the
// UserInfo in a UserInfo value on the ... | [
"OIDCAuthenticationHandler",
"is",
"a",
"middleware",
"that",
"will",
"check",
"for",
"the",
"presence",
"of",
"a",
"session",
"with",
"a",
"UserInfo",
"value",
"set",
".",
"If",
"it",
"exists",
"it",
"will",
"assume",
"that",
"the",
"has",
"logged",
"in",
... | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/auth/oidc.go#L30-L61 |
141,128 | intervention-engine/fhir | server/resource_controller.go | NewResourceController | func NewResourceController(name string, dal DataAccessLayer) *ResourceController {
return &ResourceController{
Name: name,
DAL: dal,
}
} | go | func NewResourceController(name string, dal DataAccessLayer) *ResourceController {
return &ResourceController{
Name: name,
DAL: dal,
}
} | [
"func",
"NewResourceController",
"(",
"name",
"string",
",",
"dal",
"DataAccessLayer",
")",
"*",
"ResourceController",
"{",
"return",
"&",
"ResourceController",
"{",
"Name",
":",
"name",
",",
"DAL",
":",
"dal",
",",
"}",
"\n",
"}"
] | // NewResourceController creates a new resource controller for the passed in resource name and the passed in
// DataAccessLayer. | [
"NewResourceController",
"creates",
"a",
"new",
"resource",
"controller",
"for",
"the",
"passed",
"in",
"resource",
"name",
"and",
"the",
"passed",
"in",
"DataAccessLayer",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/resource_controller.go#L22-L27 |
141,129 | intervention-engine/fhir | server/resource_controller.go | IndexHandler | func (rc *ResourceController) IndexHandler(c *gin.Context) {
defer func() {
if r := recover(); r != nil {
switch x := r.(type) {
case *search.Error:
c.JSON(x.HTTPStatus, x.OperationOutcome)
return
default:
outcome := models.NewOperationOutcome("fatal", "exception", "")
c.JSON(http.StatusInte... | go | func (rc *ResourceController) IndexHandler(c *gin.Context) {
defer func() {
if r := recover(); r != nil {
switch x := r.(type) {
case *search.Error:
c.JSON(x.HTTPStatus, x.OperationOutcome)
return
default:
outcome := models.NewOperationOutcome("fatal", "exception", "")
c.JSON(http.StatusInte... | [
"func",
"(",
"rc",
"*",
"ResourceController",
")",
"IndexHandler",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"switch",
"x",
":=",
"r",
".",
... | // IndexHandler handles requests to list resource instances or search for them. | [
"IndexHandler",
"handles",
"requests",
"to",
"list",
"resource",
"instances",
"or",
"search",
"for",
"them",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/resource_controller.go#L30-L58 |
141,130 | intervention-engine/fhir | server/resource_controller.go | LoadResource | func (rc *ResourceController) LoadResource(c *gin.Context) (interface{}, error) {
result, err := rc.DAL.Get(c.Param("id"), rc.Name)
if err != nil {
return nil, err
}
c.Set(rc.Name, result)
c.Set("Resource", rc.Name)
return result, nil
} | go | func (rc *ResourceController) LoadResource(c *gin.Context) (interface{}, error) {
result, err := rc.DAL.Get(c.Param("id"), rc.Name)
if err != nil {
return nil, err
}
c.Set(rc.Name, result)
c.Set("Resource", rc.Name)
return result, nil
} | [
"func",
"(",
"rc",
"*",
"ResourceController",
")",
"LoadResource",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"result",
",",
"err",
":=",
"rc",
".",
"DAL",
".",
"Get",
"(",
"c",
".",
"Param",
"(... | // LoadResource uses the resource id in the request to get a resource from the DataAccessLayer and store it in the
// context. | [
"LoadResource",
"uses",
"the",
"resource",
"id",
"in",
"the",
"request",
"to",
"get",
"a",
"resource",
"from",
"the",
"DataAccessLayer",
"and",
"store",
"it",
"in",
"the",
"context",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/resource_controller.go#L62-L71 |
141,131 | intervention-engine/fhir | server/resource_controller.go | ShowHandler | func (rc *ResourceController) ShowHandler(c *gin.Context) {
c.Set("Action", "read")
_, err := rc.LoadResource(c)
if err != nil && err != ErrNotFound {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
if err == ErrNotFound {
c.Status(http.StatusNotFound)
return
}
resource, _ := c.Get(rc.Nam... | go | func (rc *ResourceController) ShowHandler(c *gin.Context) {
c.Set("Action", "read")
_, err := rc.LoadResource(c)
if err != nil && err != ErrNotFound {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
if err == ErrNotFound {
c.Status(http.StatusNotFound)
return
}
resource, _ := c.Get(rc.Nam... | [
"func",
"(",
"rc",
"*",
"ResourceController",
")",
"ShowHandler",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"c",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"_",
",",
"err",
":=",
"rc",
".",
"LoadResource",
"(",
"c",
")",
"\n... | // ShowHandler handles requests to get a particular resource by ID. | [
"ShowHandler",
"handles",
"requests",
"to",
"get",
"a",
"particular",
"resource",
"by",
"ID",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/resource_controller.go#L74-L88 |
141,132 | intervention-engine/fhir | server/resource_controller.go | CreateHandler | func (rc *ResourceController) CreateHandler(c *gin.Context) {
resource := models.NewStructForResourceName(rc.Name)
err := FHIRBind(c, resource)
if err != nil {
oo := models.NewOperationOutcome("fatal", "exception", err.Error())
c.JSON(http.StatusBadRequest, oo)
return
}
id, err := rc.DAL.Post(resource)
if ... | go | func (rc *ResourceController) CreateHandler(c *gin.Context) {
resource := models.NewStructForResourceName(rc.Name)
err := FHIRBind(c, resource)
if err != nil {
oo := models.NewOperationOutcome("fatal", "exception", err.Error())
c.JSON(http.StatusBadRequest, oo)
return
}
id, err := rc.DAL.Post(resource)
if ... | [
"func",
"(",
"rc",
"*",
"ResourceController",
")",
"CreateHandler",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"resource",
":=",
"models",
".",
"NewStructForResourceName",
"(",
"rc",
".",
"Name",
")",
"\n",
"err",
":=",
"FHIRBind",
"(",
"c",
",",
... | // CreateHandler handles requests to create a new resource instance, assigning it a new ID. | [
"CreateHandler",
"handles",
"requests",
"to",
"create",
"a",
"new",
"resource",
"instance",
"assigning",
"it",
"a",
"new",
"ID",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/resource_controller.go#L91-L112 |
141,133 | intervention-engine/fhir | server/resource_controller.go | UpdateHandler | func (rc *ResourceController) UpdateHandler(c *gin.Context) {
resource := models.NewStructForResourceName(rc.Name)
err := FHIRBind(c, resource)
if err != nil {
oo := models.NewOperationOutcome("fatal", "exception", err.Error())
c.JSON(http.StatusBadRequest, oo)
return
}
createdNew, err := rc.DAL.Put(c.Param... | go | func (rc *ResourceController) UpdateHandler(c *gin.Context) {
resource := models.NewStructForResourceName(rc.Name)
err := FHIRBind(c, resource)
if err != nil {
oo := models.NewOperationOutcome("fatal", "exception", err.Error())
c.JSON(http.StatusBadRequest, oo)
return
}
createdNew, err := rc.DAL.Put(c.Param... | [
"func",
"(",
"rc",
"*",
"ResourceController",
")",
"UpdateHandler",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"resource",
":=",
"models",
".",
"NewStructForResourceName",
"(",
"rc",
".",
"Name",
")",
"\n",
"err",
":=",
"FHIRBind",
"(",
"c",
",",
... | // UpdateHandler handles requests to update a resource having a given ID. If the resource with that ID does not
// exist, a new resource is created with that ID. | [
"UpdateHandler",
"handles",
"requests",
"to",
"update",
"a",
"resource",
"having",
"a",
"given",
"ID",
".",
"If",
"the",
"resource",
"with",
"that",
"ID",
"does",
"not",
"exist",
"a",
"new",
"resource",
"is",
"created",
"with",
"that",
"ID",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/resource_controller.go#L116-L142 |
141,134 | intervention-engine/fhir | server/resource_controller.go | ConditionalUpdateHandler | func (rc *ResourceController) ConditionalUpdateHandler(c *gin.Context) {
resource := models.NewStructForResourceName(rc.Name)
err := FHIRBind(c, resource)
if err != nil {
oo := models.NewOperationOutcome("fatal", "exception", err.Error())
c.JSON(http.StatusBadRequest, oo)
return
}
query := search.Query{Reso... | go | func (rc *ResourceController) ConditionalUpdateHandler(c *gin.Context) {
resource := models.NewStructForResourceName(rc.Name)
err := FHIRBind(c, resource)
if err != nil {
oo := models.NewOperationOutcome("fatal", "exception", err.Error())
c.JSON(http.StatusBadRequest, oo)
return
}
query := search.Query{Reso... | [
"func",
"(",
"rc",
"*",
"ResourceController",
")",
"ConditionalUpdateHandler",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"resource",
":=",
"models",
".",
"NewStructForResourceName",
"(",
"rc",
".",
"Name",
")",
"\n",
"err",
":=",
"FHIRBind",
"(",
"c"... | // ConditionalUpdateHandler handles requests for conditional updates. These requests contain search criteria for the
// resource to update. If the criteria results in no found resources, a new resource is created. If the criteria
// results in one found resource, that resource will be updated. Criteria resulting in... | [
"ConditionalUpdateHandler",
"handles",
"requests",
"for",
"conditional",
"updates",
".",
"These",
"requests",
"contain",
"search",
"criteria",
"for",
"the",
"resource",
"to",
"update",
".",
"If",
"the",
"criteria",
"results",
"in",
"no",
"found",
"resources",
"a",... | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/resource_controller.go#L148-L177 |
141,135 | intervention-engine/fhir | server/resource_controller.go | DeleteHandler | func (rc *ResourceController) DeleteHandler(c *gin.Context) {
id := c.Param("id")
if err := rc.DAL.Delete(id, rc.Name); err != nil && err != ErrNotFound {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
c.Set(rc.Name, id)
c.Set("Resource", rc.Name)
c.Set("Action", "delete")
c.Status(http.St... | go | func (rc *ResourceController) DeleteHandler(c *gin.Context) {
id := c.Param("id")
if err := rc.DAL.Delete(id, rc.Name); err != nil && err != ErrNotFound {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
c.Set(rc.Name, id)
c.Set("Resource", rc.Name)
c.Set("Action", "delete")
c.Status(http.St... | [
"func",
"(",
"rc",
"*",
"ResourceController",
")",
"DeleteHandler",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"id",
":=",
"c",
".",
"Param",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"err",
":=",
"rc",
".",
"DAL",
".",
"Delete",
"(",
"id",
",",
... | // DeleteHandler handles requests to delete a resource instance identified by its ID. | [
"DeleteHandler",
"handles",
"requests",
"to",
"delete",
"a",
"resource",
"instance",
"identified",
"by",
"its",
"ID",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/resource_controller.go#L180-L193 |
141,136 | intervention-engine/fhir | server/resource_controller.go | ConditionalDeleteHandler | func (rc *ResourceController) ConditionalDeleteHandler(c *gin.Context) {
query := search.Query{Resource: rc.Name, Query: c.Request.URL.RawQuery}
_, err := rc.DAL.ConditionalDelete(query)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
c.Set("Resource", rc.Name)
c.Set("Action", ... | go | func (rc *ResourceController) ConditionalDeleteHandler(c *gin.Context) {
query := search.Query{Resource: rc.Name, Query: c.Request.URL.RawQuery}
_, err := rc.DAL.ConditionalDelete(query)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
c.Set("Resource", rc.Name)
c.Set("Action", ... | [
"func",
"(",
"rc",
"*",
"ResourceController",
")",
"ConditionalDeleteHandler",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"query",
":=",
"search",
".",
"Query",
"{",
"Resource",
":",
"rc",
".",
"Name",
",",
"Query",
":",
"c",
".",
"Request",
".",
... | // ConditionalDeleteHandler handles requests to delete resources identified by search criteria. All resources
// matching the search criteria will be deleted. | [
"ConditionalDeleteHandler",
"handles",
"requests",
"to",
"delete",
"resources",
"identified",
"by",
"search",
"criteria",
".",
"All",
"resources",
"matching",
"the",
"search",
"criteria",
"will",
"be",
"deleted",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/resource_controller.go#L197-L209 |
141,137 | intervention-engine/fhir | search/search_param_types.go | Options | func (q *Query) Options() *QueryOptions {
options := NewQueryOptions()
queryParams, _ := ParseQuery(q.Query)
for _, queryParam := range queryParams.All() {
param, modifier, _ := ParseParamNameModifierAndPostFix(queryParam.Key)
if !strings.HasPrefix(param, "_") || isGlobalSearchParam(param) {
continue
}
s... | go | func (q *Query) Options() *QueryOptions {
options := NewQueryOptions()
queryParams, _ := ParseQuery(q.Query)
for _, queryParam := range queryParams.All() {
param, modifier, _ := ParseParamNameModifierAndPostFix(queryParam.Key)
if !strings.HasPrefix(param, "_") || isGlobalSearchParam(param) {
continue
}
s... | [
"func",
"(",
"q",
"*",
"Query",
")",
"Options",
"(",
")",
"*",
"QueryOptions",
"{",
"options",
":=",
"NewQueryOptions",
"(",
")",
"\n",
"queryParams",
",",
"_",
":=",
"ParseQuery",
"(",
"q",
".",
"Query",
")",
"\n",
"for",
"_",
",",
"queryParam",
":=... | // Options parses the query string and returns the QueryOptions. | [
"Options",
"parses",
"the",
"query",
"string",
"and",
"returns",
"the",
"QueryOptions",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L94-L200 |
141,138 | intervention-engine/fhir | search/search_param_types.go | URLQueryParameters | func (o *QueryOptions) URLQueryParameters() URLQueryParameters {
var queryParams URLQueryParameters
if o.IsSTU3Sort {
keys := make([]string, len(o.Sort))
for i := range o.Sort {
if o.Sort[i].Descending {
keys[i] = fmt.Sprintf("-%s", o.Sort[i].Parameter.Name)
} else {
keys[i] = o.Sort[i].Parameter.Na... | go | func (o *QueryOptions) URLQueryParameters() URLQueryParameters {
var queryParams URLQueryParameters
if o.IsSTU3Sort {
keys := make([]string, len(o.Sort))
for i := range o.Sort {
if o.Sort[i].Descending {
keys[i] = fmt.Sprintf("-%s", o.Sort[i].Parameter.Name)
} else {
keys[i] = o.Sort[i].Parameter.Na... | [
"func",
"(",
"o",
"*",
"QueryOptions",
")",
"URLQueryParameters",
"(",
")",
"URLQueryParameters",
"{",
"var",
"queryParams",
"URLQueryParameters",
"\n",
"if",
"o",
".",
"IsSTU3Sort",
"{",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"o",... | // URLQueryParameters returns URLQueryParameters representing the query options. | [
"URLQueryParameters",
"returns",
"URLQueryParameters",
"representing",
"the",
"query",
"options",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L256-L286 |
141,139 | intervention-engine/fhir | search/search_param_types.go | ParseCompositeParam | func ParseCompositeParam(paramString string, info SearchParamInfo) *CompositeParam {
return &CompositeParam{info, escapeFriendlySplit(paramString, '$')}
} | go | func ParseCompositeParam(paramString string, info SearchParamInfo) *CompositeParam {
return &CompositeParam{info, escapeFriendlySplit(paramString, '$')}
} | [
"func",
"ParseCompositeParam",
"(",
"paramString",
"string",
",",
"info",
"SearchParamInfo",
")",
"*",
"CompositeParam",
"{",
"return",
"&",
"CompositeParam",
"{",
"info",
",",
"escapeFriendlySplit",
"(",
"paramString",
",",
"'$'",
")",
"}",
"\n",
"}"
] | // ParseCompositeParam parses a composite query string and returns a pointer to
// a CompositeParam based on the query and the parameter definition. | [
"ParseCompositeParam",
"parses",
"a",
"composite",
"query",
"string",
"and",
"returns",
"a",
"pointer",
"to",
"a",
"CompositeParam",
"based",
"on",
"the",
"query",
"and",
"the",
"parameter",
"definition",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L415-L417 |
141,140 | intervention-engine/fhir | search/search_param_types.go | ParseDateParam | func ParseDateParam(paramStr string, info SearchParamInfo) *DateParam {
date := &DateParam{SearchParamInfo: info}
var value string
date.Prefix, value = ExtractPrefixAndValue(paramStr)
date.Date = ParseDate(value)
return date
} | go | func ParseDateParam(paramStr string, info SearchParamInfo) *DateParam {
date := &DateParam{SearchParamInfo: info}
var value string
date.Prefix, value = ExtractPrefixAndValue(paramStr)
date.Date = ParseDate(value)
return date
} | [
"func",
"ParseDateParam",
"(",
"paramStr",
"string",
",",
"info",
"SearchParamInfo",
")",
"*",
"DateParam",
"{",
"date",
":=",
"&",
"DateParam",
"{",
"SearchParamInfo",
":",
"info",
"}",
"\n\n",
"var",
"value",
"string",
"\n",
"date",
".",
"Prefix",
",",
"... | // ParseDateParam parses a date-based query string and returns a pointer to a
// DateParam based on the query and the parameter definition. | [
"ParseDateParam",
"parses",
"a",
"date",
"-",
"based",
"query",
"string",
"and",
"returns",
"a",
"pointer",
"to",
"a",
"DateParam",
"based",
"on",
"the",
"query",
"and",
"the",
"parameter",
"definition",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L441-L449 |
141,141 | intervention-engine/fhir | search/search_param_types.go | String | func (d *Date) String() string {
s := d.Value.Format(d.Precision.layout())
if strings.HasSuffix(s, "+00:00") {
s = strings.Replace(s, "+00:00", "Z", 1)
}
return s
} | go | func (d *Date) String() string {
s := d.Value.Format(d.Precision.layout())
if strings.HasSuffix(s, "+00:00") {
s = strings.Replace(s, "+00:00", "Z", 1)
}
return s
} | [
"func",
"(",
"d",
"*",
"Date",
")",
"String",
"(",
")",
"string",
"{",
"s",
":=",
"d",
".",
"Value",
".",
"Format",
"(",
"d",
".",
"Precision",
".",
"layout",
"(",
")",
")",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"s",
",",
"\"",
"\"",
... | // String returns a string representation of the date, honoring the supplied
// precision. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"date",
"honoring",
"the",
"supplied",
"precision",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L462-L468 |
141,142 | intervention-engine/fhir | search/search_param_types.go | RangeHighExcl | func (d *Date) RangeHighExcl() time.Time {
switch d.Precision {
case Year:
return d.Value.AddDate(1, 0, 0)
case Month:
return d.Value.AddDate(0, 1, 0)
case Day:
return d.Value.AddDate(0, 0, 1)
case Minute:
return d.Value.Add(time.Minute)
case Second:
return d.Value.Add(time.Second)
case Millisecond:
... | go | func (d *Date) RangeHighExcl() time.Time {
switch d.Precision {
case Year:
return d.Value.AddDate(1, 0, 0)
case Month:
return d.Value.AddDate(0, 1, 0)
case Day:
return d.Value.AddDate(0, 0, 1)
case Minute:
return d.Value.Add(time.Minute)
case Second:
return d.Value.Add(time.Second)
case Millisecond:
... | [
"func",
"(",
"d",
"*",
"Date",
")",
"RangeHighExcl",
"(",
")",
"time",
".",
"Time",
"{",
"switch",
"d",
".",
"Precision",
"{",
"case",
"Year",
":",
"return",
"d",
".",
"Value",
".",
"AddDate",
"(",
"1",
",",
"0",
",",
"0",
")",
"\n",
"case",
"M... | // RangeHighExcl represents the high end of a date range to match against. As
// the name suggests, the high end of the range is exclusive. | [
"RangeHighExcl",
"represents",
"the",
"high",
"end",
"of",
"a",
"date",
"range",
"to",
"match",
"against",
".",
"As",
"the",
"name",
"suggests",
"the",
"high",
"end",
"of",
"the",
"range",
"is",
"exclusive",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L478-L495 |
141,143 | intervention-engine/fhir | search/search_param_types.go | ParseNumberParam | func ParseNumberParam(paramStr string, info SearchParamInfo) *NumberParam {
n := &NumberParam{SearchParamInfo: info}
var value string
n.Prefix, value = ExtractPrefixAndValue(paramStr)
n.Number = ParseNumber(value)
return n
} | go | func ParseNumberParam(paramStr string, info SearchParamInfo) *NumberParam {
n := &NumberParam{SearchParamInfo: info}
var value string
n.Prefix, value = ExtractPrefixAndValue(paramStr)
n.Number = ParseNumber(value)
return n
} | [
"func",
"ParseNumberParam",
"(",
"paramStr",
"string",
",",
"info",
"SearchParamInfo",
")",
"*",
"NumberParam",
"{",
"n",
":=",
"&",
"NumberParam",
"{",
"SearchParamInfo",
":",
"info",
"}",
"\n\n",
"var",
"value",
"string",
"\n",
"n",
".",
"Prefix",
",",
"... | // ParseNumberParam parses a number-based query string and returns a pointer to
// a NumberParam based on the query and the parameter definition. | [
"ParseNumberParam",
"parses",
"a",
"number",
"-",
"based",
"query",
"string",
"and",
"returns",
"a",
"pointer",
"to",
"a",
"NumberParam",
"based",
"on",
"the",
"query",
"and",
"the",
"parameter",
"definition",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L629-L637 |
141,144 | intervention-engine/fhir | search/search_param_types.go | RangeLowIncl | func (n *Number) RangeLowIncl() *big.Rat {
return new(big.Rat).Sub(n.Value, n.rangeDelta())
} | go | func (n *Number) RangeLowIncl() *big.Rat {
return new(big.Rat).Sub(n.Value, n.rangeDelta())
} | [
"func",
"(",
"n",
"*",
"Number",
")",
"RangeLowIncl",
"(",
")",
"*",
"big",
".",
"Rat",
"{",
"return",
"new",
"(",
"big",
".",
"Rat",
")",
".",
"Sub",
"(",
"n",
".",
"Value",
",",
"n",
".",
"rangeDelta",
"(",
")",
")",
"\n",
"}"
] | // RangeLowIncl represents the low end of a range to match against. As
// the name suggests, the low end of the range is inclusive. | [
"RangeLowIncl",
"represents",
"the",
"low",
"end",
"of",
"a",
"range",
"to",
"match",
"against",
".",
"As",
"the",
"name",
"suggests",
"the",
"low",
"end",
"of",
"the",
"range",
"is",
"inclusive",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L657-L659 |
141,145 | intervention-engine/fhir | search/search_param_types.go | RangeHighExcl | func (n *Number) RangeHighExcl() *big.Rat {
return new(big.Rat).Add(n.Value, n.rangeDelta())
} | go | func (n *Number) RangeHighExcl() *big.Rat {
return new(big.Rat).Add(n.Value, n.rangeDelta())
} | [
"func",
"(",
"n",
"*",
"Number",
")",
"RangeHighExcl",
"(",
")",
"*",
"big",
".",
"Rat",
"{",
"return",
"new",
"(",
"big",
".",
"Rat",
")",
".",
"Add",
"(",
"n",
".",
"Value",
",",
"n",
".",
"rangeDelta",
"(",
")",
")",
"\n",
"}"
] | // RangeHighExcl represents the high end of a range to match against. As
// the name suggests, the high end of the range is exclusive. | [
"RangeHighExcl",
"represents",
"the",
"high",
"end",
"of",
"a",
"range",
"to",
"match",
"against",
".",
"As",
"the",
"name",
"suggests",
"the",
"high",
"end",
"of",
"the",
"range",
"is",
"exclusive",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L663-L665 |
141,146 | intervention-engine/fhir | search/search_param_types.go | ParseNumber | func ParseNumber(numStr string) *Number {
n := &Number{}
numStr = strings.TrimSpace(numStr)
n.Value, _ = new(big.Rat).SetString(numStr)
i := strings.Index(numStr, ".")
if i != -1 {
n.Precision = len(numStr) - i - 1
} else {
n.Precision = 0
}
return n
} | go | func ParseNumber(numStr string) *Number {
n := &Number{}
numStr = strings.TrimSpace(numStr)
n.Value, _ = new(big.Rat).SetString(numStr)
i := strings.Index(numStr, ".")
if i != -1 {
n.Precision = len(numStr) - i - 1
} else {
n.Precision = 0
}
return n
} | [
"func",
"ParseNumber",
"(",
"numStr",
"string",
")",
"*",
"Number",
"{",
"n",
":=",
"&",
"Number",
"{",
"}",
"\n\n",
"numStr",
"=",
"strings",
".",
"TrimSpace",
"(",
"numStr",
")",
"\n",
"n",
".",
"Value",
",",
"_",
"=",
"new",
"(",
"big",
".",
"... | // ParseNumber parses a numeric string into a Number object, maintaining the
// value and precision supplied. | [
"ParseNumber",
"parses",
"a",
"numeric",
"string",
"into",
"a",
"Number",
"object",
"maintaining",
"the",
"value",
"and",
"precision",
"supplied",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L684-L697 |
141,147 | intervention-engine/fhir | search/search_param_types.go | ParseQuantityParam | func ParseQuantityParam(paramStr string, info SearchParamInfo) *QuantityParam {
q := &QuantityParam{SearchParamInfo: info}
var value string
q.Prefix, value = ExtractPrefixAndValue(paramStr)
split := escapeFriendlySplit(value, '|')
q.Number = ParseNumber(split[0])
if len(split) == 3 {
q.System = unescape(split... | go | func ParseQuantityParam(paramStr string, info SearchParamInfo) *QuantityParam {
q := &QuantityParam{SearchParamInfo: info}
var value string
q.Prefix, value = ExtractPrefixAndValue(paramStr)
split := escapeFriendlySplit(value, '|')
q.Number = ParseNumber(split[0])
if len(split) == 3 {
q.System = unescape(split... | [
"func",
"ParseQuantityParam",
"(",
"paramStr",
"string",
",",
"info",
"SearchParamInfo",
")",
"*",
"QuantityParam",
"{",
"q",
":=",
"&",
"QuantityParam",
"{",
"SearchParamInfo",
":",
"info",
"}",
"\n\n",
"var",
"value",
"string",
"\n",
"q",
".",
"Prefix",
",... | // ParseQuantityParam parses a quantity-based query string and returns a
// pointer to a QuantityParam based on the query and the parameter definition. | [
"ParseQuantityParam",
"parses",
"a",
"quantity",
"-",
"based",
"query",
"string",
"and",
"returns",
"a",
"pointer",
"to",
"a",
"QuantityParam",
"based",
"on",
"the",
"query",
"and",
"the",
"parameter",
"definition",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L724-L738 |
141,148 | intervention-engine/fhir | search/search_param_types.go | ParseReferenceParam | func ParseReferenceParam(paramStr string, info SearchParamInfo) *ReferenceParam {
if info.Postfix != "" {
typ := findReferencedType("", info)
q := Query{Resource: typ, Query: info.Postfix + "=" + paramStr}
return &ReferenceParam{info, ChainedQueryReference{Type: typ, ChainedQuery: q}}
} else {
ref := unescape... | go | func ParseReferenceParam(paramStr string, info SearchParamInfo) *ReferenceParam {
if info.Postfix != "" {
typ := findReferencedType("", info)
q := Query{Resource: typ, Query: info.Postfix + "=" + paramStr}
return &ReferenceParam{info, ChainedQueryReference{Type: typ, ChainedQuery: q}}
} else {
ref := unescape... | [
"func",
"ParseReferenceParam",
"(",
"paramStr",
"string",
",",
"info",
"SearchParamInfo",
")",
"*",
"ReferenceParam",
"{",
"if",
"info",
".",
"Postfix",
"!=",
"\"",
"\"",
"{",
"typ",
":=",
"findReferencedType",
"(",
"\"",
"\"",
",",
"info",
")",
"\n",
"q",... | // ParseReferenceParam parses a reference-based query string and returns a
// pointer to a ReferenceParam based on the query and the parameter definition. | [
"ParseReferenceParam",
"parses",
"a",
"reference",
"-",
"based",
"query",
"string",
"and",
"returns",
"a",
"pointer",
"to",
"a",
"ReferenceParam",
"based",
"on",
"the",
"query",
"and",
"the",
"parameter",
"definition",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L779-L797 |
141,149 | intervention-engine/fhir | search/search_param_types.go | ParseStringParam | func ParseStringParam(paramString string, info SearchParamInfo) *StringParam {
return &StringParam{info, unescape(paramString)}
} | go | func ParseStringParam(paramString string, info SearchParamInfo) *StringParam {
return &StringParam{info, unescape(paramString)}
} | [
"func",
"ParseStringParam",
"(",
"paramString",
"string",
",",
"info",
"SearchParamInfo",
")",
"*",
"StringParam",
"{",
"return",
"&",
"StringParam",
"{",
"info",
",",
"unescape",
"(",
"paramString",
")",
"}",
"\n",
"}"
] | // ParseStringParam parses a string-based query string and returns a pointer to
// a StringParam based on the query and the parameter definition. | [
"ParseStringParam",
"parses",
"a",
"string",
"-",
"based",
"query",
"string",
"and",
"returns",
"a",
"pointer",
"to",
"a",
"StringParam",
"based",
"on",
"the",
"query",
"and",
"the",
"parameter",
"definition",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L878-L880 |
141,150 | intervention-engine/fhir | search/search_param_types.go | ParseTokenParam | func ParseTokenParam(paramString string, info SearchParamInfo) *TokenParam {
t := &TokenParam{SearchParamInfo: info}
splitCode := escapeFriendlySplit(paramString, '|')
if len(splitCode) > 1 {
t.System = unescape(splitCode[0])
t.Code = unescape(splitCode[1])
} else {
t.AnySystem = true
t.Code = unescape(spli... | go | func ParseTokenParam(paramString string, info SearchParamInfo) *TokenParam {
t := &TokenParam{SearchParamInfo: info}
splitCode := escapeFriendlySplit(paramString, '|')
if len(splitCode) > 1 {
t.System = unescape(splitCode[0])
t.Code = unescape(splitCode[1])
} else {
t.AnySystem = true
t.Code = unescape(spli... | [
"func",
"ParseTokenParam",
"(",
"paramString",
"string",
",",
"info",
"SearchParamInfo",
")",
"*",
"TokenParam",
"{",
"t",
":=",
"&",
"TokenParam",
"{",
"SearchParamInfo",
":",
"info",
"}",
"\n",
"splitCode",
":=",
"escapeFriendlySplit",
"(",
"paramString",
",",... | // ParseTokenParam parses a token-based query string and returns a pointer to
// a TokenParam based on the query and the parameter definition. | [
"ParseTokenParam",
"parses",
"a",
"token",
"-",
"based",
"query",
"string",
"and",
"returns",
"a",
"pointer",
"to",
"a",
"TokenParam",
"based",
"on",
"the",
"query",
"and",
"the",
"parameter",
"definition",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L910-L921 |
141,151 | intervention-engine/fhir | search/search_param_types.go | ParseURIParam | func ParseURIParam(paramStr string, info SearchParamInfo) *URIParam {
return &URIParam{info, unescape(paramStr)}
} | go | func ParseURIParam(paramStr string, info SearchParamInfo) *URIParam {
return &URIParam{info, unescape(paramStr)}
} | [
"func",
"ParseURIParam",
"(",
"paramStr",
"string",
",",
"info",
"SearchParamInfo",
")",
"*",
"URIParam",
"{",
"return",
"&",
"URIParam",
"{",
"info",
",",
"unescape",
"(",
"paramStr",
")",
"}",
"\n",
"}"
] | // ParseURIParam parses an uri-based query string and returns a pointer to
// an URIParam based on the query and the parameter definition. | [
"ParseURIParam",
"parses",
"an",
"uri",
"-",
"based",
"query",
"string",
"and",
"returns",
"a",
"pointer",
"to",
"an",
"URIParam",
"based",
"on",
"the",
"query",
"and",
"the",
"parameter",
"definition",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L944-L946 |
141,152 | intervention-engine/fhir | search/search_param_types.go | ParseOrParam | func ParseOrParam(paramStr []string, info SearchParamInfo) *OrParam {
ors := make([]SearchParam, len(paramStr))
for i := range paramStr {
ors[i] = info.CreateSearchParam(paramStr[i])
}
return &OrParam{SearchParamInfo{Name: info.Name, Type: "or"}, ors}
} | go | func ParseOrParam(paramStr []string, info SearchParamInfo) *OrParam {
ors := make([]SearchParam, len(paramStr))
for i := range paramStr {
ors[i] = info.CreateSearchParam(paramStr[i])
}
return &OrParam{SearchParamInfo{Name: info.Name, Type: "or"}, ors}
} | [
"func",
"ParseOrParam",
"(",
"paramStr",
"[",
"]",
"string",
",",
"info",
"SearchParamInfo",
")",
"*",
"OrParam",
"{",
"ors",
":=",
"make",
"(",
"[",
"]",
"SearchParam",
",",
"len",
"(",
"paramStr",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"paramStr"... | // ParseOrParam parses a slice of values to be ORed and returns a pointer to
// an OrParam based on the query and the parameter definition. | [
"ParseOrParam",
"parses",
"a",
"slice",
"of",
"values",
"to",
"be",
"ORed",
"and",
"returns",
"a",
"pointer",
"to",
"an",
"OrParam",
"based",
"on",
"the",
"query",
"and",
"the",
"parameter",
"definition",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L980-L986 |
141,153 | intervention-engine/fhir | search/search_param_types.go | ExtractPrefixAndValue | func ExtractPrefixAndValue(s string) (Prefix, string) {
prefix := EQ
for _, p := range []Prefix{EQ, NE, GT, LT, GE, LE, SA, EB, AP} {
if strings.HasPrefix(s, p.String()) {
prefix = p
break
}
}
return prefix, strings.TrimPrefix(s, prefix.String())
} | go | func ExtractPrefixAndValue(s string) (Prefix, string) {
prefix := EQ
for _, p := range []Prefix{EQ, NE, GT, LT, GE, LE, SA, EB, AP} {
if strings.HasPrefix(s, p.String()) {
prefix = p
break
}
}
return prefix, strings.TrimPrefix(s, prefix.String())
} | [
"func",
"ExtractPrefixAndValue",
"(",
"s",
"string",
")",
"(",
"Prefix",
",",
"string",
")",
"{",
"prefix",
":=",
"EQ",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"[",
"]",
"Prefix",
"{",
"EQ",
",",
"NE",
",",
"GT",
",",
"LT",
",",
"GE",
",",
"... | // ExtractPrefixAndValue parses a string parameter value into an optional
// prefix and value. | [
"ExtractPrefixAndValue",
"parses",
"a",
"string",
"parameter",
"value",
"into",
"an",
"optional",
"prefix",
"and",
"value",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/search_param_types.go#L1032-L1041 |
141,154 | intervention-engine/fhir | search/url_query_parser.go | ParseQuery | func ParseQuery(query string) (u URLQueryParameters, err error) {
// Replace ";" with "&" so we can split on a single character
query = strings.Replace(query, ";", "&", -1)
// Split it into parts (e.g., "foo=bar" is a part)
parts := strings.Split(query, "&")
// iterate the parts and add them to the URLQueryParamet... | go | func ParseQuery(query string) (u URLQueryParameters, err error) {
// Replace ";" with "&" so we can split on a single character
query = strings.Replace(query, ";", "&", -1)
// Split it into parts (e.g., "foo=bar" is a part)
parts := strings.Split(query, "&")
// iterate the parts and add them to the URLQueryParamet... | [
"func",
"ParseQuery",
"(",
"query",
"string",
")",
"(",
"u",
"URLQueryParameters",
",",
"err",
"error",
")",
"{",
"// Replace \";\" with \"&\" so we can split on a single character",
"query",
"=",
"strings",
".",
"Replace",
"(",
"query",
",",
"\"",
"\"",
",",
"\""... | // ParseQuery provides an alternative to url.ParseQuery when the order of parameters must be retained. ParseQuery
// parses the URL-encoded query string and returns a URLQueryParameters object that can be used to get the ordered list
// of parameters, a map of the parameters, or parameters by name. ParseQuery always ... | [
"ParseQuery",
"provides",
"an",
"alternative",
"to",
"url",
".",
"ParseQuery",
"when",
"the",
"order",
"of",
"parameters",
"must",
"be",
"retained",
".",
"ParseQuery",
"parses",
"the",
"URL",
"-",
"encoded",
"query",
"string",
"and",
"returns",
"a",
"URLQueryP... | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/url_query_parser.go#L14-L41 |
141,155 | intervention-engine/fhir | search/url_query_parser.go | Get | func (u *URLQueryParameters) Get(key string) string {
for i := range u.params {
if u.params[i].Key == key {
return u.params[i].Value
}
}
return ""
} | go | func (u *URLQueryParameters) Get(key string) string {
for i := range u.params {
if u.params[i].Key == key {
return u.params[i].Value
}
}
return ""
} | [
"func",
"(",
"u",
"*",
"URLQueryParameters",
")",
"Get",
"(",
"key",
"string",
")",
"string",
"{",
"for",
"i",
":=",
"range",
"u",
".",
"params",
"{",
"if",
"u",
".",
"params",
"[",
"i",
"]",
".",
"Key",
"==",
"key",
"{",
"return",
"u",
".",
"p... | // Get returns the value of the first query parameter with the specified key. If no query parameters have the specified
// key, an empty string is returned. | [
"Get",
"returns",
"the",
"value",
"of",
"the",
"first",
"query",
"parameter",
"with",
"the",
"specified",
"key",
".",
"If",
"no",
"query",
"parameters",
"have",
"the",
"specified",
"key",
"an",
"empty",
"string",
"is",
"returned",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/url_query_parser.go#L91-L98 |
141,156 | intervention-engine/fhir | search/url_query_parser.go | GetMulti | func (u *URLQueryParameters) GetMulti(key string) []string {
var multi []string
for i := range u.params {
if u.params[i].Key == key {
multi = append(multi, u.params[i].Value)
}
}
return multi
} | go | func (u *URLQueryParameters) GetMulti(key string) []string {
var multi []string
for i := range u.params {
if u.params[i].Key == key {
multi = append(multi, u.params[i].Value)
}
}
return multi
} | [
"func",
"(",
"u",
"*",
"URLQueryParameters",
")",
"GetMulti",
"(",
"key",
"string",
")",
"[",
"]",
"string",
"{",
"var",
"multi",
"[",
"]",
"string",
"\n",
"for",
"i",
":=",
"range",
"u",
".",
"params",
"{",
"if",
"u",
".",
"params",
"[",
"i",
"]... | // GetMulti returns a slice containing the values of all the query parameters with the specified key, in the order in which
// they were originally specified. If no query parameters have the specified key, an empty slice is returned. | [
"GetMulti",
"returns",
"a",
"slice",
"containing",
"the",
"values",
"of",
"all",
"the",
"query",
"parameters",
"with",
"the",
"specified",
"key",
"in",
"the",
"order",
"in",
"which",
"they",
"were",
"originally",
"specified",
".",
"If",
"no",
"query",
"param... | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/url_query_parser.go#L102-L110 |
141,157 | intervention-engine/fhir | search/url_query_parser.go | All | func (u *URLQueryParameters) All() []URLQueryParameter {
all := make([]URLQueryParameter, len(u.params))
copy(all, u.params)
return all
} | go | func (u *URLQueryParameters) All() []URLQueryParameter {
all := make([]URLQueryParameter, len(u.params))
copy(all, u.params)
return all
} | [
"func",
"(",
"u",
"*",
"URLQueryParameters",
")",
"All",
"(",
")",
"[",
"]",
"URLQueryParameter",
"{",
"all",
":=",
"make",
"(",
"[",
"]",
"URLQueryParameter",
",",
"len",
"(",
"u",
".",
"params",
")",
")",
"\n",
"copy",
"(",
"all",
",",
"u",
".",
... | // All returns a copy of the slice containing all of the URLQueryParameters in the original order. | [
"All",
"returns",
"a",
"copy",
"of",
"the",
"slice",
"containing",
"all",
"of",
"the",
"URLQueryParameters",
"in",
"the",
"original",
"order",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/url_query_parser.go#L113-L117 |
141,158 | intervention-engine/fhir | search/url_query_parser.go | Encode | func (u *URLQueryParameters) Encode() string {
if len(u.params) == 0 {
return ""
}
parts := make([]string, len(u.params))
for i, param := range u.params {
parts[i] = fmt.Sprintf("%s=%s", url.QueryEscape(param.Key), url.QueryEscape(param.Value))
}
return strings.Join(parts, "&")
} | go | func (u *URLQueryParameters) Encode() string {
if len(u.params) == 0 {
return ""
}
parts := make([]string, len(u.params))
for i, param := range u.params {
parts[i] = fmt.Sprintf("%s=%s", url.QueryEscape(param.Key), url.QueryEscape(param.Value))
}
return strings.Join(parts, "&")
} | [
"func",
"(",
"u",
"*",
"URLQueryParameters",
")",
"Encode",
"(",
")",
"string",
"{",
"if",
"len",
"(",
"u",
".",
"params",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"parts",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
... | // Encode returns a URL-encoded string representing the query parameters in the original order. | [
"Encode",
"returns",
"a",
"URL",
"-",
"encoded",
"string",
"representing",
"the",
"query",
"parameters",
"in",
"the",
"original",
"order",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/url_query_parser.go#L130-L141 |
141,159 | intervention-engine/fhir | upload/upload.go | sortResourcesByDependency | func sortResourcesByDependency(resources []interface{}) []interface{} {
var result []interface{}
for _, resource := range resources {
var i int
for i = 0; i < len(result); i++ {
if references(result[i], resource) {
break
}
}
result = append(result[:i], append([]interface{}{resource}, result[i:]...).... | go | func sortResourcesByDependency(resources []interface{}) []interface{} {
var result []interface{}
for _, resource := range resources {
var i int
for i = 0; i < len(result); i++ {
if references(result[i], resource) {
break
}
}
result = append(result[:i], append([]interface{}{resource}, result[i:]...).... | [
"func",
"sortResourcesByDependency",
"(",
"resources",
"[",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"var",
"result",
"[",
"]",
"interface",
"{",
"}",
"\n",
"for",
"_",
",",
"resource",
":=",
"range",
"resources",
"{",
"va... | // In order for upload to work correctly, resources must go after the resources they depend on. | [
"In",
"order",
"for",
"upload",
"to",
"work",
"correctly",
"resources",
"must",
"go",
"after",
"the",
"resources",
"they",
"depend",
"on",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/upload/upload.go#L125-L137 |
141,160 | intervention-engine/fhir | search/mongo_search.go | CreateQueryObject | func (m *MongoSearcher) CreateQueryObject(query Query) bson.M {
return m.createQueryObject(query)
} | go | func (m *MongoSearcher) CreateQueryObject(query Query) bson.M {
return m.createQueryObject(query)
} | [
"func",
"(",
"m",
"*",
"MongoSearcher",
")",
"CreateQueryObject",
"(",
"query",
"Query",
")",
"bson",
".",
"M",
"{",
"return",
"m",
".",
"createQueryObject",
"(",
"query",
")",
"\n",
"}"
] | // CreateQueryObject is temporarily exposed as public to support ConditionalDelete.
// This should be made private again when all mongo implementations are in a single
// package. | [
"CreateQueryObject",
"is",
"temporarily",
"exposed",
"as",
"public",
"to",
"support",
"ConditionalDelete",
".",
"This",
"should",
"be",
"made",
"private",
"again",
"when",
"all",
"mongo",
"implementations",
"are",
"in",
"a",
"single",
"package",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/mongo_search.go#L56-L58 |
141,161 | intervention-engine/fhir | search/mongo_search.go | ci | func ci(s string) bson.RegEx {
return bson.RegEx{Pattern: fmt.Sprintf("^%s$", regexp.QuoteMeta(s)), Options: "i"}
} | go | func ci(s string) bson.RegEx {
return bson.RegEx{Pattern: fmt.Sprintf("^%s$", regexp.QuoteMeta(s)), Options: "i"}
} | [
"func",
"ci",
"(",
"s",
"string",
")",
"bson",
".",
"RegEx",
"{",
"return",
"bson",
".",
"RegEx",
"{",
"Pattern",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"regexp",
".",
"QuoteMeta",
"(",
"s",
")",
")",
",",
"Options",
":",
"\"",
"\"",
... | // Case-insensitive match | [
"Case",
"-",
"insensitive",
"match"
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/mongo_search.go#L818-L820 |
141,162 | intervention-engine/fhir | search/mongo_search.go | orPaths | func orPaths(objFunc func(SearchParamPath) bson.M, paths []SearchParamPath) bson.M {
results := make([]bson.M, 0, len(paths))
for i := range paths {
result := objFunc(paths[i])
// If the bson is just an $or, then bring the components up to the top-level $or
if len(result) == 1 && result["$or"] != nil {
neste... | go | func orPaths(objFunc func(SearchParamPath) bson.M, paths []SearchParamPath) bson.M {
results := make([]bson.M, 0, len(paths))
for i := range paths {
result := objFunc(paths[i])
// If the bson is just an $or, then bring the components up to the top-level $or
if len(result) == 1 && result["$or"] != nil {
neste... | [
"func",
"orPaths",
"(",
"objFunc",
"func",
"(",
"SearchParamPath",
")",
"bson",
".",
"M",
",",
"paths",
"[",
"]",
"SearchParamPath",
")",
"bson",
".",
"M",
"{",
"results",
":=",
"make",
"(",
"[",
"]",
"bson",
".",
"M",
",",
"0",
",",
"len",
"(",
... | // When multiple paths are present, they should be represented as an OR.
// objFunc is a function that generates a single query for a path | [
"When",
"multiple",
"paths",
"are",
"present",
"they",
"should",
"be",
"represented",
"as",
"an",
"OR",
".",
"objFunc",
"is",
"a",
"function",
"that",
"generates",
"a",
"single",
"query",
"for",
"a",
"path"
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/mongo_search.go#L829-L849 |
141,163 | intervention-engine/fhir | search/mongo_registry.go | GlobalMongoRegistry | func GlobalMongoRegistry() *MongoRegistry {
mongoRegistryOnce.Do(func() {
mongoRegistry = new(MongoRegistry)
mongoRegistry.builders = make(map[string]BSONBuilder)
})
return mongoRegistry
} | go | func GlobalMongoRegistry() *MongoRegistry {
mongoRegistryOnce.Do(func() {
mongoRegistry = new(MongoRegistry)
mongoRegistry.builders = make(map[string]BSONBuilder)
})
return mongoRegistry
} | [
"func",
"GlobalMongoRegistry",
"(",
")",
"*",
"MongoRegistry",
"{",
"mongoRegistryOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"mongoRegistry",
"=",
"new",
"(",
"MongoRegistry",
")",
"\n",
"mongoRegistry",
".",
"builders",
"=",
"make",
"(",
"map",
"[",
"s... | // GlobalMongoRegistry returns an instance of the global search parameter registry | [
"GlobalMongoRegistry",
"returns",
"an",
"instance",
"of",
"the",
"global",
"search",
"parameter",
"registry"
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/mongo_registry.go#L14-L20 |
141,164 | intervention-engine/fhir | search/mongo_registry.go | RegisterBSONBuilder | func (r *MongoRegistry) RegisterBSONBuilder(paramType string, builder BSONBuilder) {
r.buildersLock.Lock()
defer r.buildersLock.Unlock()
r.builders[paramType] = builder
} | go | func (r *MongoRegistry) RegisterBSONBuilder(paramType string, builder BSONBuilder) {
r.buildersLock.Lock()
defer r.buildersLock.Unlock()
r.builders[paramType] = builder
} | [
"func",
"(",
"r",
"*",
"MongoRegistry",
")",
"RegisterBSONBuilder",
"(",
"paramType",
"string",
",",
"builder",
"BSONBuilder",
")",
"{",
"r",
".",
"buildersLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"buildersLock",
".",
"Unlock",
"(",
")",
"\... | // RegisterBSONBuilder registers a BSON builder for a given parameter type. | [
"RegisterBSONBuilder",
"registers",
"a",
"BSON",
"builder",
"for",
"a",
"given",
"parameter",
"type",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/mongo_registry.go#L29-L33 |
141,165 | intervention-engine/fhir | search/mongo_registry.go | LookupBSONBuilder | func (r *MongoRegistry) LookupBSONBuilder(paramType string) (builder BSONBuilder, err error) {
r.buildersLock.RLock()
defer r.buildersLock.RUnlock()
b, ok := r.builders[paramType]
if !ok {
return nil, fmt.Errorf("Could not find BSON builder for %s", paramType)
}
return b, nil
} | go | func (r *MongoRegistry) LookupBSONBuilder(paramType string) (builder BSONBuilder, err error) {
r.buildersLock.RLock()
defer r.buildersLock.RUnlock()
b, ok := r.builders[paramType]
if !ok {
return nil, fmt.Errorf("Could not find BSON builder for %s", paramType)
}
return b, nil
} | [
"func",
"(",
"r",
"*",
"MongoRegistry",
")",
"LookupBSONBuilder",
"(",
"paramType",
"string",
")",
"(",
"builder",
"BSONBuilder",
",",
"err",
"error",
")",
"{",
"r",
".",
"buildersLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"buildersLock",
".... | // LookupBSONBuilder looks up a BSON builder by type. If no builder is registered, it will return an error. | [
"LookupBSONBuilder",
"looks",
"up",
"a",
"BSON",
"builder",
"by",
"type",
".",
"If",
"no",
"builder",
"is",
"registered",
"it",
"will",
"return",
"an",
"error",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/mongo_registry.go#L36-L44 |
141,166 | intervention-engine/fhir | models/constructors.go | NewOperationOutcome | func NewOperationOutcome(severity, code, diagnostics string) *OperationOutcome {
return &OperationOutcome{
Issue: []OperationOutcomeIssueComponent{
OperationOutcomeIssueComponent{
Severity: severity,
Code: code,
Diagnostics: diagnostics,
},
},
}
} | go | func NewOperationOutcome(severity, code, diagnostics string) *OperationOutcome {
return &OperationOutcome{
Issue: []OperationOutcomeIssueComponent{
OperationOutcomeIssueComponent{
Severity: severity,
Code: code,
Diagnostics: diagnostics,
},
},
}
} | [
"func",
"NewOperationOutcome",
"(",
"severity",
",",
"code",
",",
"diagnostics",
"string",
")",
"*",
"OperationOutcome",
"{",
"return",
"&",
"OperationOutcome",
"{",
"Issue",
":",
"[",
"]",
"OperationOutcomeIssueComponent",
"{",
"OperationOutcomeIssueComponent",
"{",
... | // This file contains manually generated convenience constructors for our
// models.
// NewOperationOutcome creates a pointer to an OperationOutcome and sets the
// severity, code and diagnostics for the first issue. | [
"This",
"file",
"contains",
"manually",
"generated",
"convenience",
"constructors",
"for",
"our",
"models",
".",
"NewOperationOutcome",
"creates",
"a",
"pointer",
"to",
"an",
"OperationOutcome",
"and",
"sets",
"the",
"severity",
"code",
"and",
"diagnostics",
"for",
... | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/models/constructors.go#L8-L18 |
141,167 | intervention-engine/fhir | server/server_setup.go | AbortNonJSONRequests | func AbortNonJSONRequests(c *gin.Context) {
acceptHeader := c.Request.Header.Get("Accept")
if acceptHeader != "" && !strings.Contains(acceptHeader, "json") && !strings.Contains(acceptHeader, "*/*") {
c.AbortWithStatus(http.StatusNotAcceptable)
}
} | go | func AbortNonJSONRequests(c *gin.Context) {
acceptHeader := c.Request.Header.Get("Accept")
if acceptHeader != "" && !strings.Contains(acceptHeader, "json") && !strings.Contains(acceptHeader, "*/*") {
c.AbortWithStatus(http.StatusNotAcceptable)
}
} | [
"func",
"AbortNonJSONRequests",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"acceptHeader",
":=",
"c",
".",
"Request",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"acceptHeader",
"!=",
"\"",
"\"",
"&&",
"!",
"strings",
".",
"Cont... | // AbortNonJSONRequests is middleware that responds to any request that Accepts a format
// other than JSON with a 406 Not Acceptable status. | [
"AbortNonJSONRequests",
"is",
"middleware",
"that",
"responds",
"to",
"any",
"request",
"that",
"Accepts",
"a",
"format",
"other",
"than",
"JSON",
"with",
"a",
"406",
"Not",
"Acceptable",
"status",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/server/server_setup.go#L74-L79 |
141,168 | intervention-engine/fhir | search/registry.go | GlobalRegistry | func GlobalRegistry() *Registry {
registryOnce.Do(func() {
registry = new(Registry)
registry.infos = make(map[string]map[string]SearchParamInfo)
registry.parsers = make(map[string]ParameterParser)
})
return registry
} | go | func GlobalRegistry() *Registry {
registryOnce.Do(func() {
registry = new(Registry)
registry.infos = make(map[string]map[string]SearchParamInfo)
registry.parsers = make(map[string]ParameterParser)
})
return registry
} | [
"func",
"GlobalRegistry",
"(",
")",
"*",
"Registry",
"{",
"registryOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"registry",
"=",
"new",
"(",
"Registry",
")",
"\n",
"registry",
".",
"infos",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
... | // GlobalRegistry returns an instance of the global search parameter registry | [
"GlobalRegistry",
"returns",
"an",
"instance",
"of",
"the",
"global",
"search",
"parameter",
"registry"
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/registry.go#L12-L19 |
141,169 | intervention-engine/fhir | search/registry.go | LookupParameterInfo | func (r *Registry) LookupParameterInfo(resource, name string) (param SearchParamInfo, err error) {
r.infosLock.RLock()
defer r.infosLock.RUnlock()
param, ok := r.infos[resource][name]
if !ok {
return SearchParamInfo{}, fmt.Errorf("Could not find info for parameter %s for resource %s", name, resource)
}
return p... | go | func (r *Registry) LookupParameterInfo(resource, name string) (param SearchParamInfo, err error) {
r.infosLock.RLock()
defer r.infosLock.RUnlock()
param, ok := r.infos[resource][name]
if !ok {
return SearchParamInfo{}, fmt.Errorf("Could not find info for parameter %s for resource %s", name, resource)
}
return p... | [
"func",
"(",
"r",
"*",
"Registry",
")",
"LookupParameterInfo",
"(",
"resource",
",",
"name",
"string",
")",
"(",
"param",
"SearchParamInfo",
",",
"err",
"error",
")",
"{",
"r",
".",
"infosLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"infosLo... | // LookupParameterInfo looks up search parameter info by resource and name. If no parameter info is registered, it will
// return an error. | [
"LookupParameterInfo",
"looks",
"up",
"search",
"parameter",
"info",
"by",
"resource",
"and",
"name",
".",
"If",
"no",
"parameter",
"info",
"is",
"registered",
"it",
"will",
"return",
"an",
"error",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/registry.go#L54-L62 |
141,170 | intervention-engine/fhir | search/registry.go | RegisterParameterParser | func (r *Registry) RegisterParameterParser(paramType string, parser ParameterParser) {
r.parsersLock.Lock()
defer r.parsersLock.Unlock()
r.parsers[paramType] = parser
} | go | func (r *Registry) RegisterParameterParser(paramType string, parser ParameterParser) {
r.parsersLock.Lock()
defer r.parsersLock.Unlock()
r.parsers[paramType] = parser
} | [
"func",
"(",
"r",
"*",
"Registry",
")",
"RegisterParameterParser",
"(",
"paramType",
"string",
",",
"parser",
"ParameterParser",
")",
"{",
"r",
".",
"parsersLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"parsersLock",
".",
"Unlock",
"(",
")",
"\... | // RegisterParameterParser registers a parameter parser for a given type name. | [
"RegisterParameterParser",
"registers",
"a",
"parameter",
"parser",
"for",
"a",
"given",
"type",
"name",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/registry.go#L65-L69 |
141,171 | intervention-engine/fhir | search/registry.go | LookupParameterParser | func (r *Registry) LookupParameterParser(paramType string) (parser ParameterParser, err error) {
r.parsersLock.RLock()
defer r.parsersLock.RUnlock()
p, ok := r.parsers[paramType]
if !ok {
return nil, fmt.Errorf("Could not find parameter parser for %s", paramType)
}
return p, nil
} | go | func (r *Registry) LookupParameterParser(paramType string) (parser ParameterParser, err error) {
r.parsersLock.RLock()
defer r.parsersLock.RUnlock()
p, ok := r.parsers[paramType]
if !ok {
return nil, fmt.Errorf("Could not find parameter parser for %s", paramType)
}
return p, nil
} | [
"func",
"(",
"r",
"*",
"Registry",
")",
"LookupParameterParser",
"(",
"paramType",
"string",
")",
"(",
"parser",
"ParameterParser",
",",
"err",
"error",
")",
"{",
"r",
".",
"parsersLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"parsersLock",
".... | // LookupParameterParser looks up a parameter parser by type. If no parser is registered, it will return an error. | [
"LookupParameterParser",
"looks",
"up",
"a",
"parameter",
"parser",
"by",
"type",
".",
"If",
"no",
"parser",
"is",
"registered",
"it",
"will",
"return",
"an",
"error",
"."
] | cd152e6130c66ff56d91ad3603065e10ca1326ac | https://github.com/intervention-engine/fhir/blob/cd152e6130c66ff56d91ad3603065e10ca1326ac/search/registry.go#L72-L80 |
141,172 | goadesign/gorma | relationalmodel.go | NewRelationalModelDefinition | func NewRelationalModelDefinition() *RelationalModelDefinition {
baseAttr := &design.AttributeDefinition{}
utd := &design.UserTypeDefinition{
AttributeDefinition: baseAttr,
}
utd.Type = design.Object{}
m := &RelationalModelDefinition{
RelationalFields: make(map[string]*RelationalFieldDefinition),
BuiltFrom: ... | go | func NewRelationalModelDefinition() *RelationalModelDefinition {
baseAttr := &design.AttributeDefinition{}
utd := &design.UserTypeDefinition{
AttributeDefinition: baseAttr,
}
utd.Type = design.Object{}
m := &RelationalModelDefinition{
RelationalFields: make(map[string]*RelationalFieldDefinition),
BuiltFrom: ... | [
"func",
"NewRelationalModelDefinition",
"(",
")",
"*",
"RelationalModelDefinition",
"{",
"baseAttr",
":=",
"&",
"design",
".",
"AttributeDefinition",
"{",
"}",
"\n",
"utd",
":=",
"&",
"design",
".",
"UserTypeDefinition",
"{",
"AttributeDefinition",
":",
"baseAttr",
... | // NewRelationalModelDefinition returns an initialized
// RelationalModelDefinition. | [
"NewRelationalModelDefinition",
"returns",
"an",
"initialized",
"RelationalModelDefinition",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L19-L38 |
141,173 | goadesign/gorma | relationalmodel.go | TableName | func (f RelationalModelDefinition) TableName() string {
return inflect.Underscore(inflection.Plural(f.ModelName))
} | go | func (f RelationalModelDefinition) TableName() string {
return inflect.Underscore(inflection.Plural(f.ModelName))
} | [
"func",
"(",
"f",
"RelationalModelDefinition",
")",
"TableName",
"(",
")",
"string",
"{",
"return",
"inflect",
".",
"Underscore",
"(",
"inflection",
".",
"Plural",
"(",
"f",
".",
"ModelName",
")",
")",
"\n",
"}"
] | // TableName returns the TableName of the struct. | [
"TableName",
"returns",
"the",
"TableName",
"of",
"the",
"struct",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L54-L56 |
141,174 | goadesign/gorma | relationalmodel.go | PKAttributes | func (f *RelationalModelDefinition) PKAttributes() string {
var attr []string
for _, pk := range f.PrimaryKeys {
attr = append(attr, fmt.Sprintf("%s %s", codegen.Goify(pk.DatabaseFieldName, false), goDatatype(pk, true)))
}
return strings.Join(attr, ",")
} | go | func (f *RelationalModelDefinition) PKAttributes() string {
var attr []string
for _, pk := range f.PrimaryKeys {
attr = append(attr, fmt.Sprintf("%s %s", codegen.Goify(pk.DatabaseFieldName, false), goDatatype(pk, true)))
}
return strings.Join(attr, ",")
} | [
"func",
"(",
"f",
"*",
"RelationalModelDefinition",
")",
"PKAttributes",
"(",
")",
"string",
"{",
"var",
"attr",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"pk",
":=",
"range",
"f",
".",
"PrimaryKeys",
"{",
"attr",
"=",
"append",
"(",
"attr",
",",
"f... | // PKAttributes constructs a pair of field + definition strings
// useful for method parameters. | [
"PKAttributes",
"constructs",
"a",
"pair",
"of",
"field",
"+",
"definition",
"strings",
"useful",
"for",
"method",
"parameters",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L69-L75 |
141,175 | goadesign/gorma | relationalmodel.go | PKWhereFields | func (f *RelationalModelDefinition) PKWhereFields() string {
var pkwhere []string
for _, pk := range f.PrimaryKeys {
def := fmt.Sprintf("%s", codegen.Goify(pk.DatabaseFieldName, false))
pkwhere = append(pkwhere, def)
}
return strings.Join(pkwhere, ",")
} | go | func (f *RelationalModelDefinition) PKWhereFields() string {
var pkwhere []string
for _, pk := range f.PrimaryKeys {
def := fmt.Sprintf("%s", codegen.Goify(pk.DatabaseFieldName, false))
pkwhere = append(pkwhere, def)
}
return strings.Join(pkwhere, ",")
} | [
"func",
"(",
"f",
"*",
"RelationalModelDefinition",
")",
"PKWhereFields",
"(",
")",
"string",
"{",
"var",
"pkwhere",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"pk",
":=",
"range",
"f",
".",
"PrimaryKeys",
"{",
"def",
":=",
"fmt",
".",
"Sprintf",
"(",
... | // PKWhereFields returns the fields for a where clause for the primary
// keys of a model. | [
"PKWhereFields",
"returns",
"the",
"fields",
"for",
"a",
"where",
"clause",
"for",
"the",
"primary",
"keys",
"of",
"a",
"model",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L90-L97 |
141,176 | goadesign/gorma | relationalmodel.go | PKUpdateFields | func (f *RelationalModelDefinition) PKUpdateFields(modelname string) string {
var pkwhere []string
for _, pk := range f.PrimaryKeys {
def := fmt.Sprintf("%s.%s", modelname, codegen.Goify(pk.FieldName, true))
pkwhere = append(pkwhere, def)
}
pkw := strings.Join(pkwhere, ",")
return pkw
} | go | func (f *RelationalModelDefinition) PKUpdateFields(modelname string) string {
var pkwhere []string
for _, pk := range f.PrimaryKeys {
def := fmt.Sprintf("%s.%s", modelname, codegen.Goify(pk.FieldName, true))
pkwhere = append(pkwhere, def)
}
pkw := strings.Join(pkwhere, ",")
return pkw
} | [
"func",
"(",
"f",
"*",
"RelationalModelDefinition",
")",
"PKUpdateFields",
"(",
"modelname",
"string",
")",
"string",
"{",
"var",
"pkwhere",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"pk",
":=",
"range",
"f",
".",
"PrimaryKeys",
"{",
"def",
":=",
"fmt",... | // PKUpdateFields returns something? This function doesn't look useful in
// current form. Perhaps it isn't. | [
"PKUpdateFields",
"returns",
"something?",
"This",
"function",
"doesn",
"t",
"look",
"useful",
"in",
"current",
"form",
".",
"Perhaps",
"it",
"isn",
"t",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L101-L110 |
141,177 | goadesign/gorma | relationalmodel.go | StructDefinition | func (f *RelationalModelDefinition) StructDefinition() string {
header := fmt.Sprintf("type %s struct {\n", f.ModelName)
var output string
f.IterateFields(func(field *RelationalFieldDefinition) error {
output = output + field.FieldDefinition()
return nil
})
// Get a sortable slice of BelongsTo relationships
... | go | func (f *RelationalModelDefinition) StructDefinition() string {
header := fmt.Sprintf("type %s struct {\n", f.ModelName)
var output string
f.IterateFields(func(field *RelationalFieldDefinition) error {
output = output + field.FieldDefinition()
return nil
})
// Get a sortable slice of BelongsTo relationships
... | [
"func",
"(",
"f",
"*",
"RelationalModelDefinition",
")",
"StructDefinition",
"(",
")",
"string",
"{",
"header",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"f",
".",
"ModelName",
")",
"\n",
"var",
"output",
"string",
"\n",
"f",
".",
"Iter... | // StructDefinition returns the struct definition for the model. | [
"StructDefinition",
"returns",
"the",
"struct",
"definition",
"for",
"the",
"model",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L113-L133 |
141,178 | goadesign/gorma | relationalmodel.go | LowerName | func (f *RelationalModelDefinition) LowerName() string {
return codegen.Goify(strings.ToLower(f.ModelName), false)
} | go | func (f *RelationalModelDefinition) LowerName() string {
return codegen.Goify(strings.ToLower(f.ModelName), false)
} | [
"func",
"(",
"f",
"*",
"RelationalModelDefinition",
")",
"LowerName",
"(",
")",
"string",
"{",
"return",
"codegen",
".",
"Goify",
"(",
"strings",
".",
"ToLower",
"(",
"f",
".",
"ModelName",
")",
",",
"false",
")",
"\n",
"}"
] | // LowerName returns the model name as a lowercase string. | [
"LowerName",
"returns",
"the",
"model",
"name",
"as",
"a",
"lowercase",
"string",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L150-L152 |
141,179 | goadesign/gorma | relationalmodel.go | Underscore | func (f *RelationalModelDefinition) Underscore() string {
runes := []rune(f.ModelName)
length := len(runes)
var out []rune
for i := 0; i < length; i++ {
if i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {
out = append(out, '_')
}
out = ... | go | func (f *RelationalModelDefinition) Underscore() string {
runes := []rune(f.ModelName)
length := len(runes)
var out []rune
for i := 0; i < length; i++ {
if i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {
out = append(out, '_')
}
out = ... | [
"func",
"(",
"f",
"*",
"RelationalModelDefinition",
")",
"Underscore",
"(",
")",
"string",
"{",
"runes",
":=",
"[",
"]",
"rune",
"(",
"f",
".",
"ModelName",
")",
"\n",
"length",
":=",
"len",
"(",
"runes",
")",
"\n\n",
"var",
"out",
"[",
"]",
"rune",
... | // Underscore returns the model name as a lowercase string in snake case. | [
"Underscore",
"returns",
"the",
"model",
"name",
"as",
"a",
"lowercase",
"string",
"in",
"snake",
"case",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L155-L168 |
141,180 | goadesign/gorma | relationalmodel.go | IterateBuildSources | func (f *RelationalModelDefinition) IterateBuildSources(it BuildSourceIterator) error {
for _, bs := range f.BuildSources {
if err := it(bs); err != nil {
return err
}
}
return nil
} | go | func (f *RelationalModelDefinition) IterateBuildSources(it BuildSourceIterator) error {
for _, bs := range f.BuildSources {
if err := it(bs); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"f",
"*",
"RelationalModelDefinition",
")",
"IterateBuildSources",
"(",
"it",
"BuildSourceIterator",
")",
"error",
"{",
"for",
"_",
",",
"bs",
":=",
"range",
"f",
".",
"BuildSources",
"{",
"if",
"err",
":=",
"it",
"(",
"bs",
")",
";",
"err",... | // IterateBuildSources runs an iterator function once per Model in the Store's model list. | [
"IterateBuildSources",
"runs",
"an",
"iterator",
"function",
"once",
"per",
"Model",
"in",
"the",
"Store",
"s",
"model",
"list",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L171-L179 |
141,181 | goadesign/gorma | relationalmodel.go | IterateFields | func (f *RelationalModelDefinition) IterateFields(it FieldIterator) error {
// Break out each type of fields
var pkkeys []string
pks := make(map[string]string)
for n := range f.RelationalFields {
if f.RelationalFields[n].PrimaryKey {
pks[n] = n
pkkeys = append(pkkeys, n)
}
}
sort.Strings(pkkeys)
var ... | go | func (f *RelationalModelDefinition) IterateFields(it FieldIterator) error {
// Break out each type of fields
var pkkeys []string
pks := make(map[string]string)
for n := range f.RelationalFields {
if f.RelationalFields[n].PrimaryKey {
pks[n] = n
pkkeys = append(pkkeys, n)
}
}
sort.Strings(pkkeys)
var ... | [
"func",
"(",
"f",
"*",
"RelationalModelDefinition",
")",
"IterateFields",
"(",
"it",
"FieldIterator",
")",
"error",
"{",
"// Break out each type of fields",
"var",
"pkkeys",
"[",
"]",
"string",
"\n",
"pks",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string... | // IterateFields returns an iterator function useful for iterating through
// this model's field list. | [
"IterateFields",
"returns",
"an",
"iterator",
"function",
"useful",
"for",
"iterating",
"through",
"this",
"model",
"s",
"field",
"list",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/relationalmodel.go#L183-L229 |
141,182 | goadesign/gorma | dsl/relationalfield.go | DatabaseFieldName | func DatabaseFieldName(name string) {
if f, ok := relationalFieldDefinition(true); ok {
f.DatabaseFieldName = name
}
} | go | func DatabaseFieldName(name string) {
if f, ok := relationalFieldDefinition(true); ok {
f.DatabaseFieldName = name
}
} | [
"func",
"DatabaseFieldName",
"(",
"name",
"string",
")",
"{",
"if",
"f",
",",
"ok",
":=",
"relationalFieldDefinition",
"(",
"true",
")",
";",
"ok",
"{",
"f",
".",
"DatabaseFieldName",
"=",
"name",
"\n",
"}",
"\n",
"}"
] | // DatabaseFieldName allows for customization of the column name
// by seting the struct tags. This is necessary to create correlate
// non standard column naming conventions in gorm. | [
"DatabaseFieldName",
"allows",
"for",
"customization",
"of",
"the",
"column",
"name",
"by",
"seting",
"the",
"struct",
"tags",
".",
"This",
"is",
"necessary",
"to",
"create",
"correlate",
"non",
"standard",
"column",
"naming",
"conventions",
"in",
"gorm",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalfield.go#L17-L21 |
141,183 | goadesign/gorma | dsl/relationalfield.go | MapsFrom | func MapsFrom(utd *design.UserTypeDefinition, field string) {
if f, ok := relationalFieldDefinition(true); ok {
md := gorma.NewMapDefinition()
md.RemoteField = field
md.RemoteType = utd
f.Mappings[utd.TypeName] = md
}
} | go | func MapsFrom(utd *design.UserTypeDefinition, field string) {
if f, ok := relationalFieldDefinition(true); ok {
md := gorma.NewMapDefinition()
md.RemoteField = field
md.RemoteType = utd
f.Mappings[utd.TypeName] = md
}
} | [
"func",
"MapsFrom",
"(",
"utd",
"*",
"design",
".",
"UserTypeDefinition",
",",
"field",
"string",
")",
"{",
"if",
"f",
",",
"ok",
":=",
"relationalFieldDefinition",
"(",
"true",
")",
";",
"ok",
"{",
"md",
":=",
"gorma",
".",
"NewMapDefinition",
"(",
")",... | // MapsFrom establishes a mapping relationship between a source
// Type field and this model. The source type must be a UserTypeDefinition "Type"
// in goa. These are typically Payloads. | [
"MapsFrom",
"establishes",
"a",
"mapping",
"relationship",
"between",
"a",
"source",
"Type",
"field",
"and",
"this",
"model",
".",
"The",
"source",
"type",
"must",
"be",
"a",
"UserTypeDefinition",
"Type",
"in",
"goa",
".",
"These",
"are",
"typically",
"Payload... | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalfield.go#L78-L86 |
141,184 | goadesign/gorma | dsl/relationalfield.go | MapsTo | func MapsTo(mtd *design.MediaTypeDefinition, field string) {
if f, ok := relationalFieldDefinition(true); ok {
md := gorma.NewMapDefinition()
md.RemoteField = field
md.RemoteType = mtd.UserTypeDefinition
f.Mappings[mtd.UserTypeDefinition.TypeName] = md
}
} | go | func MapsTo(mtd *design.MediaTypeDefinition, field string) {
if f, ok := relationalFieldDefinition(true); ok {
md := gorma.NewMapDefinition()
md.RemoteField = field
md.RemoteType = mtd.UserTypeDefinition
f.Mappings[mtd.UserTypeDefinition.TypeName] = md
}
} | [
"func",
"MapsTo",
"(",
"mtd",
"*",
"design",
".",
"MediaTypeDefinition",
",",
"field",
"string",
")",
"{",
"if",
"f",
",",
"ok",
":=",
"relationalFieldDefinition",
"(",
"true",
")",
";",
"ok",
"{",
"md",
":=",
"gorma",
".",
"NewMapDefinition",
"(",
")",
... | // MapsTo establishes a mapping relationship between a field in model and
// a MediaType in goa. | [
"MapsTo",
"establishes",
"a",
"mapping",
"relationship",
"between",
"a",
"field",
"in",
"model",
"and",
"a",
"MediaType",
"in",
"goa",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalfield.go#L90-L97 |
141,185 | goadesign/gorma | dsl/relationalfield.go | PrimaryKey | func PrimaryKey() {
if f, ok := relationalFieldDefinition(true); ok {
if f.Datatype != gorma.Integer && f.Datatype != gorma.UUID {
dslengine.ReportError("Integer and UUID are the only supported Primary Key field types.")
}
f.PrimaryKey = true
f.Nullable = false
f.Description = "primary key"
f.Parent.Pr... | go | func PrimaryKey() {
if f, ok := relationalFieldDefinition(true); ok {
if f.Datatype != gorma.Integer && f.Datatype != gorma.UUID {
dslengine.ReportError("Integer and UUID are the only supported Primary Key field types.")
}
f.PrimaryKey = true
f.Nullable = false
f.Description = "primary key"
f.Parent.Pr... | [
"func",
"PrimaryKey",
"(",
")",
"{",
"if",
"f",
",",
"ok",
":=",
"relationalFieldDefinition",
"(",
"true",
")",
";",
"ok",
"{",
"if",
"f",
".",
"Datatype",
"!=",
"gorma",
".",
"Integer",
"&&",
"f",
".",
"Datatype",
"!=",
"gorma",
".",
"UUID",
"{",
... | // PrimaryKey establishes a field as a Primary Key by
// seting the struct tags necessary to create the PK in gorm.
// Valid only for `Integer` datatypes currently | [
"PrimaryKey",
"establishes",
"a",
"field",
"as",
"a",
"Primary",
"Key",
"by",
"seting",
"the",
"struct",
"tags",
"necessary",
"to",
"create",
"the",
"PK",
"in",
"gorm",
".",
"Valid",
"only",
"for",
"Integer",
"datatypes",
"currently"
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalfield.go#L119-L130 |
141,186 | goadesign/gorma | dsl/relationalfield.go | SanitizeFieldName | func SanitizeFieldName(name string) string {
name = codegen.Goify(name, true)
if strings.HasSuffix(name, "Id") {
name = strings.TrimSuffix(name, "Id")
name = name + "ID"
}
return name
} | go | func SanitizeFieldName(name string) string {
name = codegen.Goify(name, true)
if strings.HasSuffix(name, "Id") {
name = strings.TrimSuffix(name, "Id")
name = name + "ID"
}
return name
} | [
"func",
"SanitizeFieldName",
"(",
"name",
"string",
")",
"string",
"{",
"name",
"=",
"codegen",
".",
"Goify",
"(",
"name",
",",
"true",
")",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"name",
",",
"\"",
"\"",
")",
"{",
"name",
"=",
"strings",
".",... | // SanitizeFieldName is exported for testing purposes | [
"SanitizeFieldName",
"is",
"exported",
"for",
"testing",
"purposes"
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalfield.go#L133-L141 |
141,187 | goadesign/gorma | dsl/relationalfield.go | SanitizeDBFieldName | func SanitizeDBFieldName(name string) string {
name = goifyToCamelCase(name)
name = codegen.SnakeCase(name)
if strings.HasSuffix(name, "_i_d") {
name = strings.TrimSuffix(name, "_i_d")
name = name + "_id"
}
if name == "i_d" {
name = "id"
}
return name
} | go | func SanitizeDBFieldName(name string) string {
name = goifyToCamelCase(name)
name = codegen.SnakeCase(name)
if strings.HasSuffix(name, "_i_d") {
name = strings.TrimSuffix(name, "_i_d")
name = name + "_id"
}
if name == "i_d" {
name = "id"
}
return name
} | [
"func",
"SanitizeDBFieldName",
"(",
"name",
"string",
")",
"string",
"{",
"name",
"=",
"goifyToCamelCase",
"(",
"name",
")",
"\n",
"name",
"=",
"codegen",
".",
"SnakeCase",
"(",
"name",
")",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"name",
",",
"\""... | // SanitizeDBFieldName is exported for testing purposes | [
"SanitizeDBFieldName",
"is",
"exported",
"for",
"testing",
"purposes"
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalfield.go#L144-L156 |
141,188 | goadesign/gorma | dsl/storagegroup.go | StorageGroup | func StorageGroup(name string, dsli func()) *gorma.StorageGroupDefinition {
if !dslengine.IsTopLevelDefinition() {
return nil
}
if name == "" {
dslengine.ReportError("Storage Group name cannot be empty")
}
if gorma.GormaDesign != nil {
if gorma.GormaDesign.Name == name {
dslengine.ReportError("Only one S... | go | func StorageGroup(name string, dsli func()) *gorma.StorageGroupDefinition {
if !dslengine.IsTopLevelDefinition() {
return nil
}
if name == "" {
dslengine.ReportError("Storage Group name cannot be empty")
}
if gorma.GormaDesign != nil {
if gorma.GormaDesign.Name == name {
dslengine.ReportError("Only one S... | [
"func",
"StorageGroup",
"(",
"name",
"string",
",",
"dsli",
"func",
"(",
")",
")",
"*",
"gorma",
".",
"StorageGroupDefinition",
"{",
"if",
"!",
"dslengine",
".",
"IsTopLevelDefinition",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"name",
"==",... | // StorageGroup implements the top level Gorma DSL
// There should be one StorageGroup per Goa application. | [
"StorageGroup",
"implements",
"the",
"top",
"level",
"Gorma",
"DSL",
"There",
"should",
"be",
"one",
"StorageGroup",
"per",
"Goa",
"application",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/storagegroup.go#L10-L27 |
141,189 | goadesign/gorma | dsl/storagegroup.go | Description | func Description(d string) {
if a, ok := storageGroupDefinition(false); ok {
a.Description = d
} else if v, ok := relationalStoreDefinition(false); ok {
v.Description = d
} else if r, ok := relationalModelDefinition(false); ok {
r.Description = d
} else if f, ok := relationalFieldDefinition(false); ok {
f.D... | go | func Description(d string) {
if a, ok := storageGroupDefinition(false); ok {
a.Description = d
} else if v, ok := relationalStoreDefinition(false); ok {
v.Description = d
} else if r, ok := relationalModelDefinition(false); ok {
r.Description = d
} else if f, ok := relationalFieldDefinition(false); ok {
f.D... | [
"func",
"Description",
"(",
"d",
"string",
")",
"{",
"if",
"a",
",",
"ok",
":=",
"storageGroupDefinition",
"(",
"false",
")",
";",
"ok",
"{",
"a",
".",
"Description",
"=",
"d",
"\n",
"}",
"else",
"if",
"v",
",",
"ok",
":=",
"relationalStoreDefinition",... | // Description sets the definition description.
// Description can be called inside StorageGroup, RelationalStore, RelationalModel, RelationalField | [
"Description",
"sets",
"the",
"definition",
"description",
".",
"Description",
"can",
"be",
"called",
"inside",
"StorageGroup",
"RelationalStore",
"RelationalModel",
"RelationalField"
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/storagegroup.go#L31-L41 |
141,190 | goadesign/gorma | dsl/relationalmodel.go | Alias | func Alias(d string) {
if r, ok := relationalModelDefinition(false); ok {
r.Alias = d
} else if f, ok := relationalFieldDefinition(false); ok {
f.DatabaseFieldName = d
}
} | go | func Alias(d string) {
if r, ok := relationalModelDefinition(false); ok {
r.Alias = d
} else if f, ok := relationalFieldDefinition(false); ok {
f.DatabaseFieldName = d
}
} | [
"func",
"Alias",
"(",
"d",
"string",
")",
"{",
"if",
"r",
",",
"ok",
":=",
"relationalModelDefinition",
"(",
"false",
")",
";",
"ok",
"{",
"r",
".",
"Alias",
"=",
"d",
"\n",
"}",
"else",
"if",
"f",
",",
"ok",
":=",
"relationalFieldDefinition",
"(",
... | // Alias overrides the name of the SQL store's table or field. | [
"Alias",
"overrides",
"the",
"name",
"of",
"the",
"SQL",
"store",
"s",
"table",
"or",
"field",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalmodel.go#L334-L340 |
141,191 | goadesign/gorma | dsl/relationalmodel.go | Cached | func Cached(d string) {
if r, ok := relationalModelDefinition(false); ok {
r.Cached = true
dur, err := strconv.Atoi(d)
if err != nil {
dslengine.ReportError("Duration %s couldn't be parsed as integer", d)
}
r.CacheDuration = dur
}
} | go | func Cached(d string) {
if r, ok := relationalModelDefinition(false); ok {
r.Cached = true
dur, err := strconv.Atoi(d)
if err != nil {
dslengine.ReportError("Duration %s couldn't be parsed as integer", d)
}
r.CacheDuration = dur
}
} | [
"func",
"Cached",
"(",
"d",
"string",
")",
"{",
"if",
"r",
",",
"ok",
":=",
"relationalModelDefinition",
"(",
"false",
")",
";",
"ok",
"{",
"r",
".",
"Cached",
"=",
"true",
"\n",
"dur",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"d",
")",
"\n... | // Cached caches the models for `duration` seconds.
// Not fully implemented yet, and not guaranteed to stay
// in Gorma long-term because of the complex rendering
// that happens in the conversion functions. | [
"Cached",
"caches",
"the",
"models",
"for",
"duration",
"seconds",
".",
"Not",
"fully",
"implemented",
"yet",
"and",
"not",
"guaranteed",
"to",
"stay",
"in",
"Gorma",
"long",
"-",
"term",
"because",
"of",
"the",
"complex",
"rendering",
"that",
"happens",
"in... | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalmodel.go#L346-L355 |
141,192 | goadesign/gorma | dsl/relationalmodel.go | SQLTag | func SQLTag(d string) {
if r, ok := relationalModelDefinition(false); ok {
r.SQLTag = d
} else if f, ok := relationalFieldDefinition(false); ok {
f.SQLTag = d
}
} | go | func SQLTag(d string) {
if r, ok := relationalModelDefinition(false); ok {
r.SQLTag = d
} else if f, ok := relationalFieldDefinition(false); ok {
f.SQLTag = d
}
} | [
"func",
"SQLTag",
"(",
"d",
"string",
")",
"{",
"if",
"r",
",",
"ok",
":=",
"relationalModelDefinition",
"(",
"false",
")",
";",
"ok",
"{",
"r",
".",
"SQLTag",
"=",
"d",
"\n",
"}",
"else",
"if",
"f",
",",
"ok",
":=",
"relationalFieldDefinition",
"(",... | // SQLTag sets the model's struct tag `sql` value
// for indexing and other purposes. | [
"SQLTag",
"sets",
"the",
"model",
"s",
"struct",
"tag",
"sql",
"value",
"for",
"indexing",
"and",
"other",
"purposes",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalmodel.go#L385-L391 |
141,193 | goadesign/gorma | writers.go | NewUserHelperWriter | func NewUserHelperWriter(filename string) (*UserHelperWriter, error) {
file, err := codegen.SourceFileFor(filename)
if err != nil {
return nil, err
}
return &UserHelperWriter{SourceFile: file}, nil
} | go | func NewUserHelperWriter(filename string) (*UserHelperWriter, error) {
file, err := codegen.SourceFileFor(filename)
if err != nil {
return nil, err
}
return &UserHelperWriter{SourceFile: file}, nil
} | [
"func",
"NewUserHelperWriter",
"(",
"filename",
"string",
")",
"(",
"*",
"UserHelperWriter",
",",
"error",
")",
"{",
"file",
",",
"err",
":=",
"codegen",
".",
"SourceFileFor",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",... | // NewUserHelperWriter returns a contexts code writer.
// User types contain custom data structured defined in the DSL with "Type". | [
"NewUserHelperWriter",
"returns",
"a",
"contexts",
"code",
"writer",
".",
"User",
"types",
"contain",
"custom",
"data",
"structured",
"defined",
"in",
"the",
"DSL",
"with",
"Type",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/writers.go#L327-L333 |
141,194 | goadesign/gorma | dsl/relationalstore.go | Store | func Store(name string, storeType gorma.RelationalStorageType, dsl func()) {
if name == "" || len(name) == 0 {
dslengine.ReportError("Relational Store requires a name.")
return
}
if len(storeType) == 0 {
dslengine.ReportError("Relational Store requires a RelationalStoreType.")
return
}
if dsl == nil {
ds... | go | func Store(name string, storeType gorma.RelationalStorageType, dsl func()) {
if name == "" || len(name) == 0 {
dslengine.ReportError("Relational Store requires a name.")
return
}
if len(storeType) == 0 {
dslengine.ReportError("Relational Store requires a RelationalStoreType.")
return
}
if dsl == nil {
ds... | [
"func",
"Store",
"(",
"name",
"string",
",",
"storeType",
"gorma",
".",
"RelationalStorageType",
",",
"dsl",
"func",
"(",
")",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"||",
"len",
"(",
"name",
")",
"==",
"0",
"{",
"dslengine",
".",
"ReportError",
"... | // Store represents a database. Gorma lets you specify
// a database type, but it's currently not used for any generation
// logic. | [
"Store",
"represents",
"a",
"database",
".",
"Gorma",
"lets",
"you",
"specify",
"a",
"database",
"type",
"but",
"it",
"s",
"currently",
"not",
"used",
"for",
"any",
"generation",
"logic",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalstore.go#L11-L43 |
141,195 | goadesign/gorma | dsl/relationalstore.go | NoAutomaticTimestamps | func NoAutomaticTimestamps() {
if s, ok := relationalStoreDefinition(false); ok {
s.NoAutoTimestamps = true
} else if m, ok := relationalModelDefinition(false); ok {
delete(m.RelationalFields, "CreatedAt")
delete(m.RelationalFields, "UpdatedAt")
}
} | go | func NoAutomaticTimestamps() {
if s, ok := relationalStoreDefinition(false); ok {
s.NoAutoTimestamps = true
} else if m, ok := relationalModelDefinition(false); ok {
delete(m.RelationalFields, "CreatedAt")
delete(m.RelationalFields, "UpdatedAt")
}
} | [
"func",
"NoAutomaticTimestamps",
"(",
")",
"{",
"if",
"s",
",",
"ok",
":=",
"relationalStoreDefinition",
"(",
"false",
")",
";",
"ok",
"{",
"s",
".",
"NoAutoTimestamps",
"=",
"true",
"\n",
"}",
"else",
"if",
"m",
",",
"ok",
":=",
"relationalModelDefinition... | // NoAutomaticTimestamps applies to a `Store` or `Model` type. It allows you
// to turn off the default behavior that will automatically create
// an `CreatedAt` and `UpdatedAt` fields for each model. | [
"NoAutomaticTimestamps",
"applies",
"to",
"a",
"Store",
"or",
"Model",
"type",
".",
"It",
"allows",
"you",
"to",
"turn",
"off",
"the",
"default",
"behavior",
"that",
"will",
"automatically",
"create",
"an",
"CreatedAt",
"and",
"UpdatedAt",
"fields",
"for",
"ea... | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/relationalstore.go#L59-L66 |
141,196 | goadesign/gorma | dsl/runner.go | storageGroupDefinition | func storageGroupDefinition(failIfNotSD bool) (*gorma.StorageGroupDefinition, bool) {
a, ok := dslengine.CurrentDefinition().(*gorma.StorageGroupDefinition)
if !ok && failIfNotSD {
dslengine.IncompatibleDSL()
}
return a, ok
} | go | func storageGroupDefinition(failIfNotSD bool) (*gorma.StorageGroupDefinition, bool) {
a, ok := dslengine.CurrentDefinition().(*gorma.StorageGroupDefinition)
if !ok && failIfNotSD {
dslengine.IncompatibleDSL()
}
return a, ok
} | [
"func",
"storageGroupDefinition",
"(",
"failIfNotSD",
"bool",
")",
"(",
"*",
"gorma",
".",
"StorageGroupDefinition",
",",
"bool",
")",
"{",
"a",
",",
"ok",
":=",
"dslengine",
".",
"CurrentDefinition",
"(",
")",
".",
"(",
"*",
"gorma",
".",
"StorageGroupDefin... | // storageDefinition returns true and current context if it is an StorageGroupDefinition,
// nil and false otherwise. | [
"storageDefinition",
"returns",
"true",
"and",
"current",
"context",
"if",
"it",
"is",
"an",
"StorageGroupDefinition",
"nil",
"and",
"false",
"otherwise",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/runner.go#L16-L22 |
141,197 | goadesign/gorma | dsl/runner.go | relationalStoreDefinition | func relationalStoreDefinition(failIfNotSD bool) (*gorma.RelationalStoreDefinition, bool) {
a, ok := dslengine.CurrentDefinition().(*gorma.RelationalStoreDefinition)
if !ok && failIfNotSD {
dslengine.IncompatibleDSL()
}
return a, ok
} | go | func relationalStoreDefinition(failIfNotSD bool) (*gorma.RelationalStoreDefinition, bool) {
a, ok := dslengine.CurrentDefinition().(*gorma.RelationalStoreDefinition)
if !ok && failIfNotSD {
dslengine.IncompatibleDSL()
}
return a, ok
} | [
"func",
"relationalStoreDefinition",
"(",
"failIfNotSD",
"bool",
")",
"(",
"*",
"gorma",
".",
"RelationalStoreDefinition",
",",
"bool",
")",
"{",
"a",
",",
"ok",
":=",
"dslengine",
".",
"CurrentDefinition",
"(",
")",
".",
"(",
"*",
"gorma",
".",
"RelationalS... | // relationalStoreDefinition returns true and current context if it is an RelationalStoreDefinition,
// nil and false otherwise. | [
"relationalStoreDefinition",
"returns",
"true",
"and",
"current",
"context",
"if",
"it",
"is",
"an",
"RelationalStoreDefinition",
"nil",
"and",
"false",
"otherwise",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/runner.go#L26-L32 |
141,198 | goadesign/gorma | dsl/runner.go | relationalModelDefinition | func relationalModelDefinition(failIfNotSD bool) (*gorma.RelationalModelDefinition, bool) {
a, ok := dslengine.CurrentDefinition().(*gorma.RelationalModelDefinition)
if !ok && failIfNotSD {
dslengine.IncompatibleDSL()
}
return a, ok
} | go | func relationalModelDefinition(failIfNotSD bool) (*gorma.RelationalModelDefinition, bool) {
a, ok := dslengine.CurrentDefinition().(*gorma.RelationalModelDefinition)
if !ok && failIfNotSD {
dslengine.IncompatibleDSL()
}
return a, ok
} | [
"func",
"relationalModelDefinition",
"(",
"failIfNotSD",
"bool",
")",
"(",
"*",
"gorma",
".",
"RelationalModelDefinition",
",",
"bool",
")",
"{",
"a",
",",
"ok",
":=",
"dslengine",
".",
"CurrentDefinition",
"(",
")",
".",
"(",
"*",
"gorma",
".",
"RelationalM... | // relationalModelDefinition returns true and current context if it is an RelationalModelDefinition,
// nil and false otherwise. | [
"relationalModelDefinition",
"returns",
"true",
"and",
"current",
"context",
"if",
"it",
"is",
"an",
"RelationalModelDefinition",
"nil",
"and",
"false",
"otherwise",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/runner.go#L36-L42 |
141,199 | goadesign/gorma | dsl/runner.go | relationalFieldDefinition | func relationalFieldDefinition(failIfNotSD bool) (*gorma.RelationalFieldDefinition, bool) {
a, ok := dslengine.CurrentDefinition().(*gorma.RelationalFieldDefinition)
if !ok && failIfNotSD {
dslengine.IncompatibleDSL()
}
return a, ok
} | go | func relationalFieldDefinition(failIfNotSD bool) (*gorma.RelationalFieldDefinition, bool) {
a, ok := dslengine.CurrentDefinition().(*gorma.RelationalFieldDefinition)
if !ok && failIfNotSD {
dslengine.IncompatibleDSL()
}
return a, ok
} | [
"func",
"relationalFieldDefinition",
"(",
"failIfNotSD",
"bool",
")",
"(",
"*",
"gorma",
".",
"RelationalFieldDefinition",
",",
"bool",
")",
"{",
"a",
",",
"ok",
":=",
"dslengine",
".",
"CurrentDefinition",
"(",
")",
".",
"(",
"*",
"gorma",
".",
"RelationalF... | // relationalFieldDefinition returns true and current context if it is an RelationalFieldDefinition,
// nil and false otherwise. | [
"relationalFieldDefinition",
"returns",
"true",
"and",
"current",
"context",
"if",
"it",
"is",
"an",
"RelationalFieldDefinition",
"nil",
"and",
"false",
"otherwise",
"."
] | 0c763c6f61bb451947875a3eec66926760a17db0 | https://github.com/goadesign/gorma/blob/0c763c6f61bb451947875a3eec66926760a17db0/dsl/runner.go#L46-L52 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.