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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
24,600 | kardianos/govendor | internal/gt/gopath.go | Check | func (g *GopathTest) Check(err error) {
if err == nil {
return
}
g.Fatal(err)
} | go | func (g *GopathTest) Check(err error) {
if err == nil {
return
}
g.Fatal(err)
} | [
"func",
"(",
"g",
"*",
"GopathTest",
")",
"Check",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"g",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}"
] | // Check is fatal to the test if err is not nil. | [
"Check",
"is",
"fatal",
"to",
"the",
"test",
"if",
"err",
"is",
"not",
"nil",
"."
] | d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62 | https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/internal/gt/gopath.go#L114-L119 |
24,601 | kardianos/govendor | context/context.go | NewContextWD | func NewContextWD(rt RootType) (*Context, error) {
wd, err := os.Getwd()
if err != nil {
return nil, err
}
rootIndicator := "vendor"
root := wd
switch rt {
case RootVendor:
tryRoot, err := findRoot(wd, rootIndicator)
if err != nil {
return nil, err
}
root = tryRoot
case RootVendorOrWD:
tryRoot, ... | go | func NewContextWD(rt RootType) (*Context, error) {
wd, err := os.Getwd()
if err != nil {
return nil, err
}
rootIndicator := "vendor"
root := wd
switch rt {
case RootVendor:
tryRoot, err := findRoot(wd, rootIndicator)
if err != nil {
return nil, err
}
root = tryRoot
case RootVendorOrWD:
tryRoot, ... | [
"func",
"NewContextWD",
"(",
"rt",
"RootType",
")",
"(",
"*",
"Context",
",",
"error",
")",
"{",
"wd",
",",
"err",
":=",
"os",
".",
"Getwd",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"rootIndicat... | // NewContextWD creates a new context. It looks for a root folder by finding
// a vendor file. | [
"NewContextWD",
"creates",
"a",
"new",
"context",
".",
"It",
"looks",
"for",
"a",
"root",
"folder",
"by",
"finding",
"a",
"vendor",
"file",
"."
] | d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62 | https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/context.go#L154-L198 |
24,602 | kardianos/govendor | context/context.go | NewContextRoot | func NewContextRoot(root string) (*Context, error) {
pathToVendorFile := filepath.Join("vendor", vendorFilename)
vendorFolder := "vendor"
return NewContext(root, pathToVendorFile, vendorFolder, false)
} | go | func NewContextRoot(root string) (*Context, error) {
pathToVendorFile := filepath.Join("vendor", vendorFilename)
vendorFolder := "vendor"
return NewContext(root, pathToVendorFile, vendorFolder, false)
} | [
"func",
"NewContextRoot",
"(",
"root",
"string",
")",
"(",
"*",
"Context",
",",
"error",
")",
"{",
"pathToVendorFile",
":=",
"filepath",
".",
"Join",
"(",
"\"",
"\"",
",",
"vendorFilename",
")",
"\n",
"vendorFolder",
":=",
"\"",
"\"",
"\n\n",
"return",
"... | // NewContextRoot creates a new context for the given root folder. | [
"NewContextRoot",
"creates",
"a",
"new",
"context",
"for",
"the",
"given",
"root",
"folder",
"."
] | d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62 | https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/context.go#L201-L206 |
24,603 | kardianos/govendor | context/context.go | NewContext | func NewContext(root, vendorFilePathRel, vendorFolder string, rewriteImports bool) (*Context, error) {
dprintf("CTX: %s\n", root)
var err error
env, err := NewEnv()
if err != nil {
return nil, err
}
goroot := env["GOROOT"]
all := env["GOPATH"]
if goroot == "" {
return nil, ErrMissingGOROOT
}
goroot = fi... | go | func NewContext(root, vendorFilePathRel, vendorFolder string, rewriteImports bool) (*Context, error) {
dprintf("CTX: %s\n", root)
var err error
env, err := NewEnv()
if err != nil {
return nil, err
}
goroot := env["GOROOT"]
all := env["GOPATH"]
if goroot == "" {
return nil, ErrMissingGOROOT
}
goroot = fi... | [
"func",
"NewContext",
"(",
"root",
",",
"vendorFilePathRel",
",",
"vendorFolder",
"string",
",",
"rewriteImports",
"bool",
")",
"(",
"*",
"Context",
",",
"error",
")",
"{",
"dprintf",
"(",
"\"",
"\\n",
"\"",
",",
"root",
")",
"\n",
"var",
"err",
"error",... | // NewContext creates new context from a given root folder and vendor file path.
// The vendorFolder is where vendor packages should be placed. | [
"NewContext",
"creates",
"new",
"context",
"from",
"a",
"given",
"root",
"folder",
"and",
"vendor",
"file",
"path",
".",
"The",
"vendorFolder",
"is",
"where",
"vendor",
"packages",
"should",
"be",
"placed",
"."
] | d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62 | https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/context.go#L210-L281 |
24,604 | kardianos/govendor | context/context.go | Write | func (ctx *Context) Write(s []byte) (int, error) {
if ctx.Logger != nil {
return ctx.Logger.Write(s)
}
return len(s), nil
} | go | func (ctx *Context) Write(s []byte) (int, error) {
if ctx.Logger != nil {
return ctx.Logger.Write(s)
}
return len(s), nil
} | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"Write",
"(",
"s",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"ctx",
".",
"Logger",
"!=",
"nil",
"{",
"return",
"ctx",
".",
"Logger",
".",
"Write",
"(",
"s",
")",
"\n",
"}",
"\n",... | // Write to the set io.Writer for logging. | [
"Write",
"to",
"the",
"set",
"io",
".",
"Writer",
"for",
"logging",
"."
] | d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62 | https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/context.go#L308-L313 |
24,605 | kardianos/govendor | context/context.go | VendorFilePackagePath | func (ctx *Context) VendorFilePackagePath(path string) *vendorfile.Package {
for _, pkg := range ctx.VendorFile.Package {
if pkg.Remove {
continue
}
if pkg.Path == path {
return pkg
}
}
return nil
} | go | func (ctx *Context) VendorFilePackagePath(path string) *vendorfile.Package {
for _, pkg := range ctx.VendorFile.Package {
if pkg.Remove {
continue
}
if pkg.Path == path {
return pkg
}
}
return nil
} | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"VendorFilePackagePath",
"(",
"path",
"string",
")",
"*",
"vendorfile",
".",
"Package",
"{",
"for",
"_",
",",
"pkg",
":=",
"range",
"ctx",
".",
"VendorFile",
".",
"Package",
"{",
"if",
"pkg",
".",
"Remove",
"{",... | // VendorFilePackagePath finds a given vendor file package give the import path. | [
"VendorFilePackagePath",
"finds",
"a",
"given",
"vendor",
"file",
"package",
"give",
"the",
"import",
"path",
"."
] | d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62 | https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/context.go#L316-L326 |
24,606 | kardianos/govendor | context/context.go | findPackageChild | func (ctx *Context) findPackageChild(ck *Package) []*Package {
out := make([]*Package, 0, 3)
for _, pkg := range ctx.Package {
if pkg == ck {
continue
}
if !pkg.inVendor {
continue
}
if pkg.Status.Presence == PresenceTree {
continue
}
if strings.HasPrefix(pkg.Path, ck.Path+"/") {
out = appen... | go | func (ctx *Context) findPackageChild(ck *Package) []*Package {
out := make([]*Package, 0, 3)
for _, pkg := range ctx.Package {
if pkg == ck {
continue
}
if !pkg.inVendor {
continue
}
if pkg.Status.Presence == PresenceTree {
continue
}
if strings.HasPrefix(pkg.Path, ck.Path+"/") {
out = appen... | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"findPackageChild",
"(",
"ck",
"*",
"Package",
")",
"[",
"]",
"*",
"Package",
"{",
"out",
":=",
"make",
"(",
"[",
"]",
"*",
"Package",
",",
"0",
",",
"3",
")",
"\n",
"for",
"_",
",",
"pkg",
":=",
"range"... | // findPackageChild finds any package under the current package.
// Used for finding tree overlaps. | [
"findPackageChild",
"finds",
"any",
"package",
"under",
"the",
"current",
"package",
".",
"Used",
"for",
"finding",
"tree",
"overlaps",
"."
] | d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62 | https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/context.go#L330-L347 |
24,607 | kardianos/govendor | context/context.go | findPackageParentTree | func (ctx *Context) findPackageParentTree(ck *Package) []string {
out := make([]string, 0, 1)
for _, pkg := range ctx.Package {
if !pkg.inVendor {
continue
}
if !pkg.IncludeTree || pkg == ck {
continue
}
// pkg.Path = github.com/usera/pkg, tree = true
// ck.Path = github.com/usera/pkg/dance
if str... | go | func (ctx *Context) findPackageParentTree(ck *Package) []string {
out := make([]string, 0, 1)
for _, pkg := range ctx.Package {
if !pkg.inVendor {
continue
}
if !pkg.IncludeTree || pkg == ck {
continue
}
// pkg.Path = github.com/usera/pkg, tree = true
// ck.Path = github.com/usera/pkg/dance
if str... | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"findPackageParentTree",
"(",
"ck",
"*",
"Package",
")",
"[",
"]",
"string",
"{",
"out",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"1",
")",
"\n",
"for",
"_",
",",
"pkg",
":=",
"range",
"ctx",
... | // findPackageParentTree finds any parent tree package that would
// include the given canonical path. | [
"findPackageParentTree",
"finds",
"any",
"parent",
"tree",
"package",
"that",
"would",
"include",
"the",
"given",
"canonical",
"path",
"."
] | d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62 | https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/context.go#L351-L367 |
24,608 | kardianos/govendor | context/context.go | updatePackageReferences | func (ctx *Context) updatePackageReferences() {
pathUnderDirLookup := make(map[string]map[string]*Package)
findCanonicalUnderDir := func(dir, path string) *Package {
if importMap, found := pathUnderDirLookup[dir]; found {
if pkg, found2 := importMap[path]; found2 {
return pkg
}
} else {
pathUnderDirL... | go | func (ctx *Context) updatePackageReferences() {
pathUnderDirLookup := make(map[string]map[string]*Package)
findCanonicalUnderDir := func(dir, path string) *Package {
if importMap, found := pathUnderDirLookup[dir]; found {
if pkg, found2 := importMap[path]; found2 {
return pkg
}
} else {
pathUnderDirL... | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"updatePackageReferences",
"(",
")",
"{",
"pathUnderDirLookup",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"*",
"Package",
")",
"\n",
"findCanonicalUnderDir",
":=",
"func",
"(",
"dir",
... | // updatePackageReferences populates the referenced field in each Package. | [
"updatePackageReferences",
"populates",
"the",
"referenced",
"field",
"in",
"each",
"Package",
"."
] | d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62 | https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/context.go#L370-L436 |
24,609 | go-ini/ini | file.go | newFile | func newFile(dataSources []dataSource, opts LoadOptions) *File {
if len(opts.KeyValueDelimiters) == 0 {
opts.KeyValueDelimiters = "=:"
}
return &File{
BlockMode: true,
dataSources: dataSources,
sections: make(map[string]*Section),
sectionList: make([]string, 0, 10),
options: opts,
}
} | go | func newFile(dataSources []dataSource, opts LoadOptions) *File {
if len(opts.KeyValueDelimiters) == 0 {
opts.KeyValueDelimiters = "=:"
}
return &File{
BlockMode: true,
dataSources: dataSources,
sections: make(map[string]*Section),
sectionList: make([]string, 0, 10),
options: opts,
}
} | [
"func",
"newFile",
"(",
"dataSources",
"[",
"]",
"dataSource",
",",
"opts",
"LoadOptions",
")",
"*",
"File",
"{",
"if",
"len",
"(",
"opts",
".",
"KeyValueDelimiters",
")",
"==",
"0",
"{",
"opts",
".",
"KeyValueDelimiters",
"=",
"\"",
"\"",
"\n",
"}",
"... | // newFile initializes File object with given data sources. | [
"newFile",
"initializes",
"File",
"object",
"with",
"given",
"data",
"sources",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L47-L58 |
24,610 | go-ini/ini | file.go | NewRawSection | func (f *File) NewRawSection(name, body string) (*Section, error) {
section, err := f.NewSection(name)
if err != nil {
return nil, err
}
section.isRawSection = true
section.rawBody = body
return section, nil
} | go | func (f *File) NewRawSection(name, body string) (*Section, error) {
section, err := f.NewSection(name)
if err != nil {
return nil, err
}
section.isRawSection = true
section.rawBody = body
return section, nil
} | [
"func",
"(",
"f",
"*",
"File",
")",
"NewRawSection",
"(",
"name",
",",
"body",
"string",
")",
"(",
"*",
"Section",
",",
"error",
")",
"{",
"section",
",",
"err",
":=",
"f",
".",
"NewSection",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // NewRawSection creates a new section with an unparseable body. | [
"NewRawSection",
"creates",
"a",
"new",
"section",
"with",
"an",
"unparseable",
"body",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L90-L99 |
24,611 | go-ini/ini | file.go | NewSections | func (f *File) NewSections(names ...string) (err error) {
for _, name := range names {
if _, err = f.NewSection(name); err != nil {
return err
}
}
return nil
} | go | func (f *File) NewSections(names ...string) (err error) {
for _, name := range names {
if _, err = f.NewSection(name); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"f",
"*",
"File",
")",
"NewSections",
"(",
"names",
"...",
"string",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"if",
"_",
",",
"err",
"=",
"f",
".",
"NewSection",
"(",
"name",
")",
";... | // NewSections creates a list of sections. | [
"NewSections",
"creates",
"a",
"list",
"of",
"sections",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L102-L109 |
24,612 | go-ini/ini | file.go | GetSection | func (f *File) GetSection(name string) (*Section, error) {
if len(name) == 0 {
name = DefaultSection
}
if f.options.Insensitive {
name = strings.ToLower(name)
}
if f.BlockMode {
f.lock.RLock()
defer f.lock.RUnlock()
}
sec := f.sections[name]
if sec == nil {
return nil, fmt.Errorf("section '%s' does ... | go | func (f *File) GetSection(name string) (*Section, error) {
if len(name) == 0 {
name = DefaultSection
}
if f.options.Insensitive {
name = strings.ToLower(name)
}
if f.BlockMode {
f.lock.RLock()
defer f.lock.RUnlock()
}
sec := f.sections[name]
if sec == nil {
return nil, fmt.Errorf("section '%s' does ... | [
"func",
"(",
"f",
"*",
"File",
")",
"GetSection",
"(",
"name",
"string",
")",
"(",
"*",
"Section",
",",
"error",
")",
"{",
"if",
"len",
"(",
"name",
")",
"==",
"0",
"{",
"name",
"=",
"DefaultSection",
"\n",
"}",
"\n",
"if",
"f",
".",
"options",
... | // GetSection returns section by given name. | [
"GetSection",
"returns",
"section",
"by",
"given",
"name",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L112-L130 |
24,613 | go-ini/ini | file.go | Section | func (f *File) Section(name string) *Section {
sec, err := f.GetSection(name)
if err != nil {
// Note: It's OK here because the only possible error is empty section name,
// but if it's empty, this piece of code won't be executed.
sec, _ = f.NewSection(name)
return sec
}
return sec
} | go | func (f *File) Section(name string) *Section {
sec, err := f.GetSection(name)
if err != nil {
// Note: It's OK here because the only possible error is empty section name,
// but if it's empty, this piece of code won't be executed.
sec, _ = f.NewSection(name)
return sec
}
return sec
} | [
"func",
"(",
"f",
"*",
"File",
")",
"Section",
"(",
"name",
"string",
")",
"*",
"Section",
"{",
"sec",
",",
"err",
":=",
"f",
".",
"GetSection",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Note: It's OK here because the only possible error i... | // Section assumes named section exists and returns a zero-value when not. | [
"Section",
"assumes",
"named",
"section",
"exists",
"and",
"returns",
"a",
"zero",
"-",
"value",
"when",
"not",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L133-L142 |
24,614 | go-ini/ini | file.go | Sections | func (f *File) Sections() []*Section {
if f.BlockMode {
f.lock.RLock()
defer f.lock.RUnlock()
}
sections := make([]*Section, len(f.sectionList))
for i, name := range f.sectionList {
sections[i] = f.sections[name]
}
return sections
} | go | func (f *File) Sections() []*Section {
if f.BlockMode {
f.lock.RLock()
defer f.lock.RUnlock()
}
sections := make([]*Section, len(f.sectionList))
for i, name := range f.sectionList {
sections[i] = f.sections[name]
}
return sections
} | [
"func",
"(",
"f",
"*",
"File",
")",
"Sections",
"(",
")",
"[",
"]",
"*",
"Section",
"{",
"if",
"f",
".",
"BlockMode",
"{",
"f",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"f",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n",
"}",
"\n\n",... | // Sections returns a list of Section stored in the current instance. | [
"Sections",
"returns",
"a",
"list",
"of",
"Section",
"stored",
"in",
"the",
"current",
"instance",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L145-L156 |
24,615 | go-ini/ini | file.go | ChildSections | func (f *File) ChildSections(name string) []*Section {
return f.Section(name).ChildSections()
} | go | func (f *File) ChildSections(name string) []*Section {
return f.Section(name).ChildSections()
} | [
"func",
"(",
"f",
"*",
"File",
")",
"ChildSections",
"(",
"name",
"string",
")",
"[",
"]",
"*",
"Section",
"{",
"return",
"f",
".",
"Section",
"(",
"name",
")",
".",
"ChildSections",
"(",
")",
"\n",
"}"
] | // ChildSections returns a list of child sections of given section name. | [
"ChildSections",
"returns",
"a",
"list",
"of",
"child",
"sections",
"of",
"given",
"section",
"name",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L159-L161 |
24,616 | go-ini/ini | file.go | SectionStrings | func (f *File) SectionStrings() []string {
list := make([]string, len(f.sectionList))
copy(list, f.sectionList)
return list
} | go | func (f *File) SectionStrings() []string {
list := make([]string, len(f.sectionList))
copy(list, f.sectionList)
return list
} | [
"func",
"(",
"f",
"*",
"File",
")",
"SectionStrings",
"(",
")",
"[",
"]",
"string",
"{",
"list",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"f",
".",
"sectionList",
")",
")",
"\n",
"copy",
"(",
"list",
",",
"f",
".",
"sectionList",
... | // SectionStrings returns list of section names. | [
"SectionStrings",
"returns",
"list",
"of",
"section",
"names",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L164-L168 |
24,617 | go-ini/ini | file.go | DeleteSection | func (f *File) DeleteSection(name string) {
if f.BlockMode {
f.lock.Lock()
defer f.lock.Unlock()
}
if len(name) == 0 {
name = DefaultSection
}
for i, s := range f.sectionList {
if s == name {
f.sectionList = append(f.sectionList[:i], f.sectionList[i+1:]...)
delete(f.sections, name)
return
}
}... | go | func (f *File) DeleteSection(name string) {
if f.BlockMode {
f.lock.Lock()
defer f.lock.Unlock()
}
if len(name) == 0 {
name = DefaultSection
}
for i, s := range f.sectionList {
if s == name {
f.sectionList = append(f.sectionList[:i], f.sectionList[i+1:]...)
delete(f.sections, name)
return
}
}... | [
"func",
"(",
"f",
"*",
"File",
")",
"DeleteSection",
"(",
"name",
"string",
")",
"{",
"if",
"f",
".",
"BlockMode",
"{",
"f",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"f",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n\n",
"if",
... | // DeleteSection deletes a section. | [
"DeleteSection",
"deletes",
"a",
"section",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L171-L188 |
24,618 | go-ini/ini | file.go | Reload | func (f *File) Reload() (err error) {
for _, s := range f.dataSources {
if err = f.reload(s); err != nil {
// In loose mode, we create an empty default section for nonexistent files.
if os.IsNotExist(err) && f.options.Loose {
f.parse(bytes.NewBuffer(nil))
continue
}
return err
}
}
return nil
... | go | func (f *File) Reload() (err error) {
for _, s := range f.dataSources {
if err = f.reload(s); err != nil {
// In loose mode, we create an empty default section for nonexistent files.
if os.IsNotExist(err) && f.options.Loose {
f.parse(bytes.NewBuffer(nil))
continue
}
return err
}
}
return nil
... | [
"func",
"(",
"f",
"*",
"File",
")",
"Reload",
"(",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"f",
".",
"dataSources",
"{",
"if",
"err",
"=",
"f",
".",
"reload",
"(",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"//... | // Reload reloads and parses all data sources. | [
"Reload",
"reloads",
"and",
"parses",
"all",
"data",
"sources",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L201-L213 |
24,619 | go-ini/ini | file.go | Append | func (f *File) Append(source interface{}, others ...interface{}) error {
ds, err := parseDataSource(source)
if err != nil {
return err
}
f.dataSources = append(f.dataSources, ds)
for _, s := range others {
ds, err = parseDataSource(s)
if err != nil {
return err
}
f.dataSources = append(f.dataSources, ... | go | func (f *File) Append(source interface{}, others ...interface{}) error {
ds, err := parseDataSource(source)
if err != nil {
return err
}
f.dataSources = append(f.dataSources, ds)
for _, s := range others {
ds, err = parseDataSource(s)
if err != nil {
return err
}
f.dataSources = append(f.dataSources, ... | [
"func",
"(",
"f",
"*",
"File",
")",
"Append",
"(",
"source",
"interface",
"{",
"}",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"ds",
",",
"err",
":=",
"parseDataSource",
"(",
"source",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // Append appends one or more data sources and reloads automatically. | [
"Append",
"appends",
"one",
"or",
"more",
"data",
"sources",
"and",
"reloads",
"automatically",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L216-L230 |
24,620 | go-ini/ini | file.go | WriteToIndent | func (f *File) WriteToIndent(w io.Writer, indent string) (int64, error) {
buf, err := f.writeToBuffer(indent)
if err != nil {
return 0, err
}
return buf.WriteTo(w)
} | go | func (f *File) WriteToIndent(w io.Writer, indent string) (int64, error) {
buf, err := f.writeToBuffer(indent)
if err != nil {
return 0, err
}
return buf.WriteTo(w)
} | [
"func",
"(",
"f",
"*",
"File",
")",
"WriteToIndent",
"(",
"w",
"io",
".",
"Writer",
",",
"indent",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"buf",
",",
"err",
":=",
"f",
".",
"writeToBuffer",
"(",
"indent",
")",
"\n",
"if",
"err",
"!=... | // WriteToIndent writes content into io.Writer with given indention.
// If PrettyFormat has been set to be true,
// it will align "=" sign with spaces under each section. | [
"WriteToIndent",
"writes",
"content",
"into",
"io",
".",
"Writer",
"with",
"given",
"indention",
".",
"If",
"PrettyFormat",
"has",
"been",
"set",
"to",
"be",
"true",
"it",
"will",
"align",
"=",
"sign",
"with",
"spaces",
"under",
"each",
"section",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L390-L396 |
24,621 | go-ini/ini | file.go | WriteTo | func (f *File) WriteTo(w io.Writer) (int64, error) {
return f.WriteToIndent(w, "")
} | go | func (f *File) WriteTo(w io.Writer) (int64, error) {
return f.WriteToIndent(w, "")
} | [
"func",
"(",
"f",
"*",
"File",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"f",
".",
"WriteToIndent",
"(",
"w",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // WriteTo writes file content into io.Writer. | [
"WriteTo",
"writes",
"file",
"content",
"into",
"io",
".",
"Writer",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L399-L401 |
24,622 | go-ini/ini | file.go | SaveToIndent | func (f *File) SaveToIndent(filename, indent string) error {
// Note: Because we are truncating with os.Create,
// so it's safer to save to a temporary file location and rename afte done.
buf, err := f.writeToBuffer(indent)
if err != nil {
return err
}
return ioutil.WriteFile(filename, buf.Bytes(), 0666)
} | go | func (f *File) SaveToIndent(filename, indent string) error {
// Note: Because we are truncating with os.Create,
// so it's safer to save to a temporary file location and rename afte done.
buf, err := f.writeToBuffer(indent)
if err != nil {
return err
}
return ioutil.WriteFile(filename, buf.Bytes(), 0666)
} | [
"func",
"(",
"f",
"*",
"File",
")",
"SaveToIndent",
"(",
"filename",
",",
"indent",
"string",
")",
"error",
"{",
"// Note: Because we are truncating with os.Create,",
"// \tso it's safer to save to a temporary file location and rename afte done.",
"buf",
",",
"err",
":=",
"... | // SaveToIndent writes content to file system with given value indention. | [
"SaveToIndent",
"writes",
"content",
"to",
"file",
"system",
"with",
"given",
"value",
"indention",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/file.go#L404-L413 |
24,623 | go-ini/ini | ini.go | LooseLoad | func LooseLoad(source interface{}, others ...interface{}) (*File, error) {
return LoadSources(LoadOptions{Loose: true}, source, others...)
} | go | func LooseLoad(source interface{}, others ...interface{}) (*File, error) {
return LoadSources(LoadOptions{Loose: true}, source, others...)
} | [
"func",
"LooseLoad",
"(",
"source",
"interface",
"{",
"}",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"(",
"*",
"File",
",",
"error",
")",
"{",
"return",
"LoadSources",
"(",
"LoadOptions",
"{",
"Loose",
":",
"true",
"}",
",",
"source",
",",
"o... | // LooseLoad has exactly same functionality as Load function
// except it ignores nonexistent files instead of returning error. | [
"LooseLoad",
"has",
"exactly",
"same",
"functionality",
"as",
"Load",
"function",
"except",
"it",
"ignores",
"nonexistent",
"files",
"instead",
"of",
"returning",
"error",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/ini.go#L209-L211 |
24,624 | go-ini/ini | ini.go | InsensitiveLoad | func InsensitiveLoad(source interface{}, others ...interface{}) (*File, error) {
return LoadSources(LoadOptions{Insensitive: true}, source, others...)
} | go | func InsensitiveLoad(source interface{}, others ...interface{}) (*File, error) {
return LoadSources(LoadOptions{Insensitive: true}, source, others...)
} | [
"func",
"InsensitiveLoad",
"(",
"source",
"interface",
"{",
"}",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"(",
"*",
"File",
",",
"error",
")",
"{",
"return",
"LoadSources",
"(",
"LoadOptions",
"{",
"Insensitive",
":",
"true",
"}",
",",
"source",... | // InsensitiveLoad has exactly same functionality as Load function
// except it forces all section and key names to be lowercased. | [
"InsensitiveLoad",
"has",
"exactly",
"same",
"functionality",
"as",
"Load",
"function",
"except",
"it",
"forces",
"all",
"section",
"and",
"key",
"names",
"to",
"be",
"lowercased",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/ini.go#L215-L217 |
24,625 | go-ini/ini | ini.go | ShadowLoad | func ShadowLoad(source interface{}, others ...interface{}) (*File, error) {
return LoadSources(LoadOptions{AllowShadows: true}, source, others...)
} | go | func ShadowLoad(source interface{}, others ...interface{}) (*File, error) {
return LoadSources(LoadOptions{AllowShadows: true}, source, others...)
} | [
"func",
"ShadowLoad",
"(",
"source",
"interface",
"{",
"}",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"(",
"*",
"File",
",",
"error",
")",
"{",
"return",
"LoadSources",
"(",
"LoadOptions",
"{",
"AllowShadows",
":",
"true",
"}",
",",
"source",
"... | // ShadowLoad has exactly same functionality as Load function
// except it allows have shadow keys. | [
"ShadowLoad",
"has",
"exactly",
"same",
"functionality",
"as",
"Load",
"function",
"except",
"it",
"allows",
"have",
"shadow",
"keys",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/ini.go#L221-L223 |
24,626 | go-ini/ini | key.go | newKey | func newKey(s *Section, name, val string) *Key {
return &Key{
s: s,
name: name,
value: val,
}
} | go | func newKey(s *Section, name, val string) *Key {
return &Key{
s: s,
name: name,
value: val,
}
} | [
"func",
"newKey",
"(",
"s",
"*",
"Section",
",",
"name",
",",
"val",
"string",
")",
"*",
"Key",
"{",
"return",
"&",
"Key",
"{",
"s",
":",
"s",
",",
"name",
":",
"name",
",",
"value",
":",
"val",
",",
"}",
"\n",
"}"
] | // newKey simply return a key object with given values. | [
"newKey",
"simply",
"return",
"a",
"key",
"object",
"with",
"given",
"values",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L42-L48 |
24,627 | go-ini/ini | key.go | AddShadow | func (k *Key) AddShadow(val string) error {
if !k.s.f.options.AllowShadows {
return errors.New("shadow key is not allowed")
}
return k.addShadow(val)
} | go | func (k *Key) AddShadow(val string) error {
if !k.s.f.options.AllowShadows {
return errors.New("shadow key is not allowed")
}
return k.addShadow(val)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"AddShadow",
"(",
"val",
"string",
")",
"error",
"{",
"if",
"!",
"k",
".",
"s",
".",
"f",
".",
"options",
".",
"AllowShadows",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"retur... | // AddShadow adds a new shadow key to itself. | [
"AddShadow",
"adds",
"a",
"new",
"shadow",
"key",
"to",
"itself",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L64-L69 |
24,628 | go-ini/ini | key.go | AddNestedValue | func (k *Key) AddNestedValue(val string) error {
if !k.s.f.options.AllowNestedValues {
return errors.New("nested value is not allowed")
}
return k.addNestedValue(val)
} | go | func (k *Key) AddNestedValue(val string) error {
if !k.s.f.options.AllowNestedValues {
return errors.New("nested value is not allowed")
}
return k.addNestedValue(val)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"AddNestedValue",
"(",
"val",
"string",
")",
"error",
"{",
"if",
"!",
"k",
".",
"s",
".",
"f",
".",
"options",
".",
"AllowNestedValues",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n"... | // AddNestedValue adds a nested value to the key. | [
"AddNestedValue",
"adds",
"a",
"nested",
"value",
"to",
"the",
"key",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L81-L86 |
24,629 | go-ini/ini | key.go | ValueWithShadows | func (k *Key) ValueWithShadows() []string {
if len(k.shadows) == 0 {
return []string{k.value}
}
vals := make([]string, len(k.shadows)+1)
vals[0] = k.value
for i := range k.shadows {
vals[i+1] = k.shadows[i].value
}
return vals
} | go | func (k *Key) ValueWithShadows() []string {
if len(k.shadows) == 0 {
return []string{k.value}
}
vals := make([]string, len(k.shadows)+1)
vals[0] = k.value
for i := range k.shadows {
vals[i+1] = k.shadows[i].value
}
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"ValueWithShadows",
"(",
")",
"[",
"]",
"string",
"{",
"if",
"len",
"(",
"k",
".",
"shadows",
")",
"==",
"0",
"{",
"return",
"[",
"]",
"string",
"{",
"k",
".",
"value",
"}",
"\n",
"}",
"\n",
"vals",
":=",
"m... | // ValueWithShadows returns raw values of key and its shadows if any. | [
"ValueWithShadows",
"returns",
"raw",
"values",
"of",
"key",
"and",
"its",
"shadows",
"if",
"any",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L102-L112 |
24,630 | go-ini/ini | key.go | transformValue | func (k *Key) transformValue(val string) string {
if k.s.f.ValueMapper != nil {
val = k.s.f.ValueMapper(val)
}
// Fail-fast if no indicate char found for recursive value
if !strings.Contains(val, "%") {
return val
}
for i := 0; i < depthValues; i++ {
vr := varPattern.FindString(val)
if len(vr) == 0 {
... | go | func (k *Key) transformValue(val string) string {
if k.s.f.ValueMapper != nil {
val = k.s.f.ValueMapper(val)
}
// Fail-fast if no indicate char found for recursive value
if !strings.Contains(val, "%") {
return val
}
for i := 0; i < depthValues; i++ {
vr := varPattern.FindString(val)
if len(vr) == 0 {
... | [
"func",
"(",
"k",
"*",
"Key",
")",
"transformValue",
"(",
"val",
"string",
")",
"string",
"{",
"if",
"k",
".",
"s",
".",
"f",
".",
"ValueMapper",
"!=",
"nil",
"{",
"val",
"=",
"k",
".",
"s",
".",
"f",
".",
"ValueMapper",
"(",
"val",
")",
"\n",
... | // transformValue takes a raw value and transforms to its final string. | [
"transformValue",
"takes",
"a",
"raw",
"value",
"and",
"transforms",
"to",
"its",
"final",
"string",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L121-L150 |
24,631 | go-ini/ini | key.go | Validate | func (k *Key) Validate(fn func(string) string) string {
return fn(k.String())
} | go | func (k *Key) Validate(fn func(string) string) string {
return fn(k.String())
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Validate",
"(",
"fn",
"func",
"(",
"string",
")",
"string",
")",
"string",
"{",
"return",
"fn",
"(",
"k",
".",
"String",
"(",
")",
")",
"\n",
"}"
] | // Validate accepts a validate function which can
// return modifed result as key value. | [
"Validate",
"accepts",
"a",
"validate",
"function",
"which",
"can",
"return",
"modifed",
"result",
"as",
"key",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L159-L161 |
24,632 | go-ini/ini | key.go | parseBool | func parseBool(str string) (value bool, err error) {
switch str {
case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "y", "ON", "on", "On":
return true, nil
case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "n", "OFF", "off", "Off":
return false, nil
}
return false, fmt.Errorf("par... | go | func parseBool(str string) (value bool, err error) {
switch str {
case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "y", "ON", "on", "On":
return true, nil
case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "n", "OFF", "off", "Off":
return false, nil
}
return false, fmt.Errorf("par... | [
"func",
"parseBool",
"(",
"str",
"string",
")",
"(",
"value",
"bool",
",",
"err",
"error",
")",
"{",
"switch",
"str",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"... | // parseBool returns the boolean value represented by the string.
//
// It accepts 1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On,
// 0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off.
// Any other value returns an error. | [
"parseBool",
"returns",
"the",
"boolean",
"value",
"represented",
"by",
"the",
"string",
".",
"It",
"accepts",
"1",
"t",
"T",
"TRUE",
"true",
"True",
"YES",
"yes",
"Yes",
"y",
"ON",
"on",
"On",
"0",
"f",
"F",
"FALSE",
"false",
"False",
"NO",
"no",
"N... | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L168-L176 |
24,633 | go-ini/ini | key.go | Uint | func (k *Key) Uint() (uint, error) {
u, e := strconv.ParseUint(k.String(), 0, 64)
return uint(u), e
} | go | func (k *Key) Uint() (uint, error) {
u, e := strconv.ParseUint(k.String(), 0, 64)
return uint(u), e
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Uint",
"(",
")",
"(",
"uint",
",",
"error",
")",
"{",
"u",
",",
"e",
":=",
"strconv",
".",
"ParseUint",
"(",
"k",
".",
"String",
"(",
")",
",",
"0",
",",
"64",
")",
"\n",
"return",
"uint",
"(",
"u",
")",
... | // Uint returns uint type valued. | [
"Uint",
"returns",
"uint",
"type",
"valued",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L200-L203 |
24,634 | go-ini/ini | key.go | Duration | func (k *Key) Duration() (time.Duration, error) {
return time.ParseDuration(k.String())
} | go | func (k *Key) Duration() (time.Duration, error) {
return time.ParseDuration(k.String())
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Duration",
"(",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"return",
"time",
".",
"ParseDuration",
"(",
"k",
".",
"String",
"(",
")",
")",
"\n",
"}"
] | // Duration returns time.Duration type value. | [
"Duration",
"returns",
"time",
".",
"Duration",
"type",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L211-L213 |
24,635 | go-ini/ini | key.go | TimeFormat | func (k *Key) TimeFormat(format string) (time.Time, error) {
return time.Parse(format, k.String())
} | go | func (k *Key) TimeFormat(format string) (time.Time, error) {
return time.Parse(format, k.String())
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"TimeFormat",
"(",
"format",
"string",
")",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"return",
"time",
".",
"Parse",
"(",
"format",
",",
"k",
".",
"String",
"(",
")",
")",
"\n",
"}"
] | // TimeFormat parses with given format and returns time.Time type value. | [
"TimeFormat",
"parses",
"with",
"given",
"format",
"and",
"returns",
"time",
".",
"Time",
"type",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L216-L218 |
24,636 | go-ini/ini | key.go | Time | func (k *Key) Time() (time.Time, error) {
return k.TimeFormat(time.RFC3339)
} | go | func (k *Key) Time() (time.Time, error) {
return k.TimeFormat(time.RFC3339)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Time",
"(",
")",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"return",
"k",
".",
"TimeFormat",
"(",
"time",
".",
"RFC3339",
")",
"\n",
"}"
] | // Time parses with RFC3339 format and returns time.Time type value. | [
"Time",
"parses",
"with",
"RFC3339",
"format",
"and",
"returns",
"time",
".",
"Time",
"type",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L221-L223 |
24,637 | go-ini/ini | key.go | MustString | func (k *Key) MustString(defaultVal string) string {
val := k.String()
if len(val) == 0 {
k.value = defaultVal
return defaultVal
}
return val
} | go | func (k *Key) MustString(defaultVal string) string {
val := k.String()
if len(val) == 0 {
k.value = defaultVal
return defaultVal
}
return val
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"MustString",
"(",
"defaultVal",
"string",
")",
"string",
"{",
"val",
":=",
"k",
".",
"String",
"(",
")",
"\n",
"if",
"len",
"(",
"val",
")",
"==",
"0",
"{",
"k",
".",
"value",
"=",
"defaultVal",
"\n",
"return",... | // MustString returns default value if key value is empty. | [
"MustString",
"returns",
"default",
"value",
"if",
"key",
"value",
"is",
"empty",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L226-L233 |
24,638 | go-ini/ini | key.go | MustUint | func (k *Key) MustUint(defaultVal ...uint) uint {
val, err := k.Uint()
if len(defaultVal) > 0 && err != nil {
k.value = strconv.FormatUint(uint64(defaultVal[0]), 10)
return defaultVal[0]
}
return val
} | go | func (k *Key) MustUint(defaultVal ...uint) uint {
val, err := k.Uint()
if len(defaultVal) > 0 && err != nil {
k.value = strconv.FormatUint(uint64(defaultVal[0]), 10)
return defaultVal[0]
}
return val
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"MustUint",
"(",
"defaultVal",
"...",
"uint",
")",
"uint",
"{",
"val",
",",
"err",
":=",
"k",
".",
"Uint",
"(",
")",
"\n",
"if",
"len",
"(",
"defaultVal",
")",
">",
"0",
"&&",
"err",
"!=",
"nil",
"{",
"k",
"... | // MustUint always returns value without error,
// it returns 0 if error occurs. | [
"MustUint",
"always",
"returns",
"value",
"without",
"error",
"it",
"returns",
"0",
"if",
"error",
"occurs",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L281-L288 |
24,639 | go-ini/ini | key.go | MustUint64 | func (k *Key) MustUint64(defaultVal ...uint64) uint64 {
val, err := k.Uint64()
if len(defaultVal) > 0 && err != nil {
k.value = strconv.FormatUint(defaultVal[0], 10)
return defaultVal[0]
}
return val
} | go | func (k *Key) MustUint64(defaultVal ...uint64) uint64 {
val, err := k.Uint64()
if len(defaultVal) > 0 && err != nil {
k.value = strconv.FormatUint(defaultVal[0], 10)
return defaultVal[0]
}
return val
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"MustUint64",
"(",
"defaultVal",
"...",
"uint64",
")",
"uint64",
"{",
"val",
",",
"err",
":=",
"k",
".",
"Uint64",
"(",
")",
"\n",
"if",
"len",
"(",
"defaultVal",
")",
">",
"0",
"&&",
"err",
"!=",
"nil",
"{",
... | // MustUint64 always returns value without error,
// it returns 0 if error occurs. | [
"MustUint64",
"always",
"returns",
"value",
"without",
"error",
"it",
"returns",
"0",
"if",
"error",
"occurs",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L292-L299 |
24,640 | go-ini/ini | key.go | MustDuration | func (k *Key) MustDuration(defaultVal ...time.Duration) time.Duration {
val, err := k.Duration()
if len(defaultVal) > 0 && err != nil {
k.value = defaultVal[0].String()
return defaultVal[0]
}
return val
} | go | func (k *Key) MustDuration(defaultVal ...time.Duration) time.Duration {
val, err := k.Duration()
if len(defaultVal) > 0 && err != nil {
k.value = defaultVal[0].String()
return defaultVal[0]
}
return val
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"MustDuration",
"(",
"defaultVal",
"...",
"time",
".",
"Duration",
")",
"time",
".",
"Duration",
"{",
"val",
",",
"err",
":=",
"k",
".",
"Duration",
"(",
")",
"\n",
"if",
"len",
"(",
"defaultVal",
")",
">",
"0",
... | // MustDuration always returns value without error,
// it returns zero value if error occurs. | [
"MustDuration",
"always",
"returns",
"value",
"without",
"error",
"it",
"returns",
"zero",
"value",
"if",
"error",
"occurs",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L303-L310 |
24,641 | go-ini/ini | key.go | MustTimeFormat | func (k *Key) MustTimeFormat(format string, defaultVal ...time.Time) time.Time {
val, err := k.TimeFormat(format)
if len(defaultVal) > 0 && err != nil {
k.value = defaultVal[0].Format(format)
return defaultVal[0]
}
return val
} | go | func (k *Key) MustTimeFormat(format string, defaultVal ...time.Time) time.Time {
val, err := k.TimeFormat(format)
if len(defaultVal) > 0 && err != nil {
k.value = defaultVal[0].Format(format)
return defaultVal[0]
}
return val
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"MustTimeFormat",
"(",
"format",
"string",
",",
"defaultVal",
"...",
"time",
".",
"Time",
")",
"time",
".",
"Time",
"{",
"val",
",",
"err",
":=",
"k",
".",
"TimeFormat",
"(",
"format",
")",
"\n",
"if",
"len",
"(",... | // MustTimeFormat always parses with given format and returns value without error,
// it returns zero value if error occurs. | [
"MustTimeFormat",
"always",
"parses",
"with",
"given",
"format",
"and",
"returns",
"value",
"without",
"error",
"it",
"returns",
"zero",
"value",
"if",
"error",
"occurs",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L314-L321 |
24,642 | go-ini/ini | key.go | MustTime | func (k *Key) MustTime(defaultVal ...time.Time) time.Time {
return k.MustTimeFormat(time.RFC3339, defaultVal...)
} | go | func (k *Key) MustTime(defaultVal ...time.Time) time.Time {
return k.MustTimeFormat(time.RFC3339, defaultVal...)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"MustTime",
"(",
"defaultVal",
"...",
"time",
".",
"Time",
")",
"time",
".",
"Time",
"{",
"return",
"k",
".",
"MustTimeFormat",
"(",
"time",
".",
"RFC3339",
",",
"defaultVal",
"...",
")",
"\n",
"}"
] | // MustTime always parses with RFC3339 format and returns value without error,
// it returns zero value if error occurs. | [
"MustTime",
"always",
"parses",
"with",
"RFC3339",
"format",
"and",
"returns",
"value",
"without",
"error",
"it",
"returns",
"zero",
"value",
"if",
"error",
"occurs",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L325-L327 |
24,643 | go-ini/ini | key.go | In | func (k *Key) In(defaultVal string, candidates []string) string {
val := k.String()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | go | func (k *Key) In(defaultVal string, candidates []string) string {
val := k.String()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"In",
"(",
"defaultVal",
"string",
",",
"candidates",
"[",
"]",
"string",
")",
"string",
"{",
"val",
":=",
"k",
".",
"String",
"(",
")",
"\n",
"for",
"_",
",",
"cand",
":=",
"range",
"candidates",
"{",
"if",
"va... | // In always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates. | [
"In",
"always",
"returns",
"value",
"without",
"error",
"it",
"returns",
"default",
"value",
"if",
"error",
"occurs",
"or",
"doesn",
"t",
"fit",
"into",
"candidates",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L331-L339 |
24,644 | go-ini/ini | key.go | InFloat64 | func (k *Key) InFloat64(defaultVal float64, candidates []float64) float64 {
val := k.MustFloat64()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | go | func (k *Key) InFloat64(defaultVal float64, candidates []float64) float64 {
val := k.MustFloat64()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"InFloat64",
"(",
"defaultVal",
"float64",
",",
"candidates",
"[",
"]",
"float64",
")",
"float64",
"{",
"val",
":=",
"k",
".",
"MustFloat64",
"(",
")",
"\n",
"for",
"_",
",",
"cand",
":=",
"range",
"candidates",
"{"... | // InFloat64 always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates. | [
"InFloat64",
"always",
"returns",
"value",
"without",
"error",
"it",
"returns",
"default",
"value",
"if",
"error",
"occurs",
"or",
"doesn",
"t",
"fit",
"into",
"candidates",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L343-L351 |
24,645 | go-ini/ini | key.go | InInt | func (k *Key) InInt(defaultVal int, candidates []int) int {
val := k.MustInt()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | go | func (k *Key) InInt(defaultVal int, candidates []int) int {
val := k.MustInt()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"InInt",
"(",
"defaultVal",
"int",
",",
"candidates",
"[",
"]",
"int",
")",
"int",
"{",
"val",
":=",
"k",
".",
"MustInt",
"(",
")",
"\n",
"for",
"_",
",",
"cand",
":=",
"range",
"candidates",
"{",
"if",
"val",
... | // InInt always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates. | [
"InInt",
"always",
"returns",
"value",
"without",
"error",
"it",
"returns",
"default",
"value",
"if",
"error",
"occurs",
"or",
"doesn",
"t",
"fit",
"into",
"candidates",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L355-L363 |
24,646 | go-ini/ini | key.go | InInt64 | func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 {
val := k.MustInt64()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | go | func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 {
val := k.MustInt64()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"InInt64",
"(",
"defaultVal",
"int64",
",",
"candidates",
"[",
"]",
"int64",
")",
"int64",
"{",
"val",
":=",
"k",
".",
"MustInt64",
"(",
")",
"\n",
"for",
"_",
",",
"cand",
":=",
"range",
"candidates",
"{",
"if",
... | // InInt64 always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates. | [
"InInt64",
"always",
"returns",
"value",
"without",
"error",
"it",
"returns",
"default",
"value",
"if",
"error",
"occurs",
"or",
"doesn",
"t",
"fit",
"into",
"candidates",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L367-L375 |
24,647 | go-ini/ini | key.go | InUint | func (k *Key) InUint(defaultVal uint, candidates []uint) uint {
val := k.MustUint()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | go | func (k *Key) InUint(defaultVal uint, candidates []uint) uint {
val := k.MustUint()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"InUint",
"(",
"defaultVal",
"uint",
",",
"candidates",
"[",
"]",
"uint",
")",
"uint",
"{",
"val",
":=",
"k",
".",
"MustUint",
"(",
")",
"\n",
"for",
"_",
",",
"cand",
":=",
"range",
"candidates",
"{",
"if",
"va... | // InUint always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates. | [
"InUint",
"always",
"returns",
"value",
"without",
"error",
"it",
"returns",
"default",
"value",
"if",
"error",
"occurs",
"or",
"doesn",
"t",
"fit",
"into",
"candidates",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L379-L387 |
24,648 | go-ini/ini | key.go | InUint64 | func (k *Key) InUint64(defaultVal uint64, candidates []uint64) uint64 {
val := k.MustUint64()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | go | func (k *Key) InUint64(defaultVal uint64, candidates []uint64) uint64 {
val := k.MustUint64()
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"InUint64",
"(",
"defaultVal",
"uint64",
",",
"candidates",
"[",
"]",
"uint64",
")",
"uint64",
"{",
"val",
":=",
"k",
".",
"MustUint64",
"(",
")",
"\n",
"for",
"_",
",",
"cand",
":=",
"range",
"candidates",
"{",
"... | // InUint64 always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates. | [
"InUint64",
"always",
"returns",
"value",
"without",
"error",
"it",
"returns",
"default",
"value",
"if",
"error",
"occurs",
"or",
"doesn",
"t",
"fit",
"into",
"candidates",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L391-L399 |
24,649 | go-ini/ini | key.go | InTimeFormat | func (k *Key) InTimeFormat(format string, defaultVal time.Time, candidates []time.Time) time.Time {
val := k.MustTimeFormat(format)
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | go | func (k *Key) InTimeFormat(format string, defaultVal time.Time, candidates []time.Time) time.Time {
val := k.MustTimeFormat(format)
for _, cand := range candidates {
if val == cand {
return val
}
}
return defaultVal
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"InTimeFormat",
"(",
"format",
"string",
",",
"defaultVal",
"time",
".",
"Time",
",",
"candidates",
"[",
"]",
"time",
".",
"Time",
")",
"time",
".",
"Time",
"{",
"val",
":=",
"k",
".",
"MustTimeFormat",
"(",
"format... | // InTimeFormat always parses with given format and returns value without error,
// it returns default value if error occurs or doesn't fit into candidates. | [
"InTimeFormat",
"always",
"parses",
"with",
"given",
"format",
"and",
"returns",
"value",
"without",
"error",
"it",
"returns",
"default",
"value",
"if",
"error",
"occurs",
"or",
"doesn",
"t",
"fit",
"into",
"candidates",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L403-L411 |
24,650 | go-ini/ini | key.go | InTime | func (k *Key) InTime(defaultVal time.Time, candidates []time.Time) time.Time {
return k.InTimeFormat(time.RFC3339, defaultVal, candidates)
} | go | func (k *Key) InTime(defaultVal time.Time, candidates []time.Time) time.Time {
return k.InTimeFormat(time.RFC3339, defaultVal, candidates)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"InTime",
"(",
"defaultVal",
"time",
".",
"Time",
",",
"candidates",
"[",
"]",
"time",
".",
"Time",
")",
"time",
".",
"Time",
"{",
"return",
"k",
".",
"InTimeFormat",
"(",
"time",
".",
"RFC3339",
",",
"defaultVal",
... | // InTime always parses with RFC3339 format and returns value without error,
// it returns default value if error occurs or doesn't fit into candidates. | [
"InTime",
"always",
"parses",
"with",
"RFC3339",
"format",
"and",
"returns",
"value",
"without",
"error",
"it",
"returns",
"default",
"value",
"if",
"error",
"occurs",
"or",
"doesn",
"t",
"fit",
"into",
"candidates",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L415-L417 |
24,651 | go-ini/ini | key.go | RangeFloat64 | func (k *Key) RangeFloat64(defaultVal, min, max float64) float64 {
val := k.MustFloat64()
if val < min || val > max {
return defaultVal
}
return val
} | go | func (k *Key) RangeFloat64(defaultVal, min, max float64) float64 {
val := k.MustFloat64()
if val < min || val > max {
return defaultVal
}
return val
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"RangeFloat64",
"(",
"defaultVal",
",",
"min",
",",
"max",
"float64",
")",
"float64",
"{",
"val",
":=",
"k",
".",
"MustFloat64",
"(",
")",
"\n",
"if",
"val",
"<",
"min",
"||",
"val",
">",
"max",
"{",
"return",
"... | // RangeFloat64 checks if value is in given range inclusively,
// and returns default value if it's not. | [
"RangeFloat64",
"checks",
"if",
"value",
"is",
"in",
"given",
"range",
"inclusively",
"and",
"returns",
"default",
"value",
"if",
"it",
"s",
"not",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L421-L427 |
24,652 | go-ini/ini | key.go | RangeInt | func (k *Key) RangeInt(defaultVal, min, max int) int {
val := k.MustInt()
if val < min || val > max {
return defaultVal
}
return val
} | go | func (k *Key) RangeInt(defaultVal, min, max int) int {
val := k.MustInt()
if val < min || val > max {
return defaultVal
}
return val
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"RangeInt",
"(",
"defaultVal",
",",
"min",
",",
"max",
"int",
")",
"int",
"{",
"val",
":=",
"k",
".",
"MustInt",
"(",
")",
"\n",
"if",
"val",
"<",
"min",
"||",
"val",
">",
"max",
"{",
"return",
"defaultVal",
"... | // RangeInt checks if value is in given range inclusively,
// and returns default value if it's not. | [
"RangeInt",
"checks",
"if",
"value",
"is",
"in",
"given",
"range",
"inclusively",
"and",
"returns",
"default",
"value",
"if",
"it",
"s",
"not",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L431-L437 |
24,653 | go-ini/ini | key.go | RangeInt64 | func (k *Key) RangeInt64(defaultVal, min, max int64) int64 {
val := k.MustInt64()
if val < min || val > max {
return defaultVal
}
return val
} | go | func (k *Key) RangeInt64(defaultVal, min, max int64) int64 {
val := k.MustInt64()
if val < min || val > max {
return defaultVal
}
return val
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"RangeInt64",
"(",
"defaultVal",
",",
"min",
",",
"max",
"int64",
")",
"int64",
"{",
"val",
":=",
"k",
".",
"MustInt64",
"(",
")",
"\n",
"if",
"val",
"<",
"min",
"||",
"val",
">",
"max",
"{",
"return",
"defaultV... | // RangeInt64 checks if value is in given range inclusively,
// and returns default value if it's not. | [
"RangeInt64",
"checks",
"if",
"value",
"is",
"in",
"given",
"range",
"inclusively",
"and",
"returns",
"default",
"value",
"if",
"it",
"s",
"not",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L441-L447 |
24,654 | go-ini/ini | key.go | RangeTimeFormat | func (k *Key) RangeTimeFormat(format string, defaultVal, min, max time.Time) time.Time {
val := k.MustTimeFormat(format)
if val.Unix() < min.Unix() || val.Unix() > max.Unix() {
return defaultVal
}
return val
} | go | func (k *Key) RangeTimeFormat(format string, defaultVal, min, max time.Time) time.Time {
val := k.MustTimeFormat(format)
if val.Unix() < min.Unix() || val.Unix() > max.Unix() {
return defaultVal
}
return val
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"RangeTimeFormat",
"(",
"format",
"string",
",",
"defaultVal",
",",
"min",
",",
"max",
"time",
".",
"Time",
")",
"time",
".",
"Time",
"{",
"val",
":=",
"k",
".",
"MustTimeFormat",
"(",
"format",
")",
"\n",
"if",
"... | // RangeTimeFormat checks if value with given format is in given range inclusively,
// and returns default value if it's not. | [
"RangeTimeFormat",
"checks",
"if",
"value",
"with",
"given",
"format",
"is",
"in",
"given",
"range",
"inclusively",
"and",
"returns",
"default",
"value",
"if",
"it",
"s",
"not",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L451-L457 |
24,655 | go-ini/ini | key.go | RangeTime | func (k *Key) RangeTime(defaultVal, min, max time.Time) time.Time {
return k.RangeTimeFormat(time.RFC3339, defaultVal, min, max)
} | go | func (k *Key) RangeTime(defaultVal, min, max time.Time) time.Time {
return k.RangeTimeFormat(time.RFC3339, defaultVal, min, max)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"RangeTime",
"(",
"defaultVal",
",",
"min",
",",
"max",
"time",
".",
"Time",
")",
"time",
".",
"Time",
"{",
"return",
"k",
".",
"RangeTimeFormat",
"(",
"time",
".",
"RFC3339",
",",
"defaultVal",
",",
"min",
",",
"... | // RangeTime checks if value with RFC3339 format is in given range inclusively,
// and returns default value if it's not. | [
"RangeTime",
"checks",
"if",
"value",
"with",
"RFC3339",
"format",
"is",
"in",
"given",
"range",
"inclusively",
"and",
"returns",
"default",
"value",
"if",
"it",
"s",
"not",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L461-L463 |
24,656 | go-ini/ini | key.go | Strings | func (k *Key) Strings(delim string) []string {
str := k.String()
if len(str) == 0 {
return []string{}
}
runes := []rune(str)
vals := make([]string, 0, 2)
var buf bytes.Buffer
escape := false
idx := 0
for {
if escape {
escape = false
if runes[idx] != '\\' && !strings.HasPrefix(string(runes[idx:]), de... | go | func (k *Key) Strings(delim string) []string {
str := k.String()
if len(str) == 0 {
return []string{}
}
runes := []rune(str)
vals := make([]string, 0, 2)
var buf bytes.Buffer
escape := false
idx := 0
for {
if escape {
escape = false
if runes[idx] != '\\' && !strings.HasPrefix(string(runes[idx:]), de... | [
"func",
"(",
"k",
"*",
"Key",
")",
"Strings",
"(",
"delim",
"string",
")",
"[",
"]",
"string",
"{",
"str",
":=",
"k",
".",
"String",
"(",
")",
"\n",
"if",
"len",
"(",
"str",
")",
"==",
"0",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
"\n",
... | // Strings returns list of string divided by given delimiter. | [
"Strings",
"returns",
"list",
"of",
"string",
"divided",
"by",
"given",
"delimiter",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L466-L506 |
24,657 | go-ini/ini | key.go | StringsWithShadows | func (k *Key) StringsWithShadows(delim string) []string {
vals := k.ValueWithShadows()
results := make([]string, 0, len(vals)*2)
for i := range vals {
if len(vals) == 0 {
continue
}
results = append(results, strings.Split(vals[i], delim)...)
}
for i := range results {
results[i] = k.transformValue(str... | go | func (k *Key) StringsWithShadows(delim string) []string {
vals := k.ValueWithShadows()
results := make([]string, 0, len(vals)*2)
for i := range vals {
if len(vals) == 0 {
continue
}
results = append(results, strings.Split(vals[i], delim)...)
}
for i := range results {
results[i] = k.transformValue(str... | [
"func",
"(",
"k",
"*",
"Key",
")",
"StringsWithShadows",
"(",
"delim",
"string",
")",
"[",
"]",
"string",
"{",
"vals",
":=",
"k",
".",
"ValueWithShadows",
"(",
")",
"\n",
"results",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
... | // StringsWithShadows returns list of string divided by given delimiter.
// Shadows will also be appended if any. | [
"StringsWithShadows",
"returns",
"list",
"of",
"string",
"divided",
"by",
"given",
"delimiter",
".",
"Shadows",
"will",
"also",
"be",
"appended",
"if",
"any",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L510-L525 |
24,658 | go-ini/ini | key.go | Float64s | func (k *Key) Float64s(delim string) []float64 {
vals, _ := k.parseFloat64s(k.Strings(delim), true, false)
return vals
} | go | func (k *Key) Float64s(delim string) []float64 {
vals, _ := k.parseFloat64s(k.Strings(delim), true, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Float64s",
"(",
"delim",
"string",
")",
"[",
"]",
"float64",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseFloat64s",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"true",
",",
"false",
")",
"\n",
"return",
... | // Float64s returns list of float64 divided by given delimiter. Any invalid input will be treated as zero value. | [
"Float64s",
"returns",
"list",
"of",
"float64",
"divided",
"by",
"given",
"delimiter",
".",
"Any",
"invalid",
"input",
"will",
"be",
"treated",
"as",
"zero",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L528-L531 |
24,659 | go-ini/ini | key.go | Ints | func (k *Key) Ints(delim string) []int {
vals, _ := k.parseInts(k.Strings(delim), true, false)
return vals
} | go | func (k *Key) Ints(delim string) []int {
vals, _ := k.parseInts(k.Strings(delim), true, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Ints",
"(",
"delim",
"string",
")",
"[",
"]",
"int",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseInts",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"true",
",",
"false",
")",
"\n",
"return",
"vals",
... | // Ints returns list of int divided by given delimiter. Any invalid input will be treated as zero value. | [
"Ints",
"returns",
"list",
"of",
"int",
"divided",
"by",
"given",
"delimiter",
".",
"Any",
"invalid",
"input",
"will",
"be",
"treated",
"as",
"zero",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L534-L537 |
24,660 | go-ini/ini | key.go | Int64s | func (k *Key) Int64s(delim string) []int64 {
vals, _ := k.parseInt64s(k.Strings(delim), true, false)
return vals
} | go | func (k *Key) Int64s(delim string) []int64 {
vals, _ := k.parseInt64s(k.Strings(delim), true, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Int64s",
"(",
"delim",
"string",
")",
"[",
"]",
"int64",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseInt64s",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"true",
",",
"false",
")",
"\n",
"return",
"val... | // Int64s returns list of int64 divided by given delimiter. Any invalid input will be treated as zero value. | [
"Int64s",
"returns",
"list",
"of",
"int64",
"divided",
"by",
"given",
"delimiter",
".",
"Any",
"invalid",
"input",
"will",
"be",
"treated",
"as",
"zero",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L540-L543 |
24,661 | go-ini/ini | key.go | Uints | func (k *Key) Uints(delim string) []uint {
vals, _ := k.parseUints(k.Strings(delim), true, false)
return vals
} | go | func (k *Key) Uints(delim string) []uint {
vals, _ := k.parseUints(k.Strings(delim), true, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Uints",
"(",
"delim",
"string",
")",
"[",
"]",
"uint",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseUints",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"true",
",",
"false",
")",
"\n",
"return",
"vals",... | // Uints returns list of uint divided by given delimiter. Any invalid input will be treated as zero value. | [
"Uints",
"returns",
"list",
"of",
"uint",
"divided",
"by",
"given",
"delimiter",
".",
"Any",
"invalid",
"input",
"will",
"be",
"treated",
"as",
"zero",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L546-L549 |
24,662 | go-ini/ini | key.go | Uint64s | func (k *Key) Uint64s(delim string) []uint64 {
vals, _ := k.parseUint64s(k.Strings(delim), true, false)
return vals
} | go | func (k *Key) Uint64s(delim string) []uint64 {
vals, _ := k.parseUint64s(k.Strings(delim), true, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Uint64s",
"(",
"delim",
"string",
")",
"[",
"]",
"uint64",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseUint64s",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"true",
",",
"false",
")",
"\n",
"return",
"... | // Uint64s returns list of uint64 divided by given delimiter. Any invalid input will be treated as zero value. | [
"Uint64s",
"returns",
"list",
"of",
"uint64",
"divided",
"by",
"given",
"delimiter",
".",
"Any",
"invalid",
"input",
"will",
"be",
"treated",
"as",
"zero",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L552-L555 |
24,663 | go-ini/ini | key.go | ValidFloat64s | func (k *Key) ValidFloat64s(delim string) []float64 {
vals, _ := k.parseFloat64s(k.Strings(delim), false, false)
return vals
} | go | func (k *Key) ValidFloat64s(delim string) []float64 {
vals, _ := k.parseFloat64s(k.Strings(delim), false, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"ValidFloat64s",
"(",
"delim",
"string",
")",
"[",
"]",
"float64",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseFloat64s",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"false",
")",
"\n",
"ret... | // ValidFloat64s returns list of float64 divided by given delimiter. If some value is not float, then
// it will not be included to result list. | [
"ValidFloat64s",
"returns",
"list",
"of",
"float64",
"divided",
"by",
"given",
"delimiter",
".",
"If",
"some",
"value",
"is",
"not",
"float",
"then",
"it",
"will",
"not",
"be",
"included",
"to",
"result",
"list",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L572-L575 |
24,664 | go-ini/ini | key.go | ValidInts | func (k *Key) ValidInts(delim string) []int {
vals, _ := k.parseInts(k.Strings(delim), false, false)
return vals
} | go | func (k *Key) ValidInts(delim string) []int {
vals, _ := k.parseInts(k.Strings(delim), false, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"ValidInts",
"(",
"delim",
"string",
")",
"[",
"]",
"int",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseInts",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"false",
")",
"\n",
"return",
"val... | // ValidInts returns list of int divided by given delimiter. If some value is not integer, then it will
// not be included to result list. | [
"ValidInts",
"returns",
"list",
"of",
"int",
"divided",
"by",
"given",
"delimiter",
".",
"If",
"some",
"value",
"is",
"not",
"integer",
"then",
"it",
"will",
"not",
"be",
"included",
"to",
"result",
"list",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L579-L582 |
24,665 | go-ini/ini | key.go | ValidInt64s | func (k *Key) ValidInt64s(delim string) []int64 {
vals, _ := k.parseInt64s(k.Strings(delim), false, false)
return vals
} | go | func (k *Key) ValidInt64s(delim string) []int64 {
vals, _ := k.parseInt64s(k.Strings(delim), false, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"ValidInt64s",
"(",
"delim",
"string",
")",
"[",
"]",
"int64",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseInt64s",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"false",
")",
"\n",
"return",
... | // ValidInt64s returns list of int64 divided by given delimiter. If some value is not 64-bit integer,
// then it will not be included to result list. | [
"ValidInt64s",
"returns",
"list",
"of",
"int64",
"divided",
"by",
"given",
"delimiter",
".",
"If",
"some",
"value",
"is",
"not",
"64",
"-",
"bit",
"integer",
"then",
"it",
"will",
"not",
"be",
"included",
"to",
"result",
"list",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L586-L589 |
24,666 | go-ini/ini | key.go | ValidUints | func (k *Key) ValidUints(delim string) []uint {
vals, _ := k.parseUints(k.Strings(delim), false, false)
return vals
} | go | func (k *Key) ValidUints(delim string) []uint {
vals, _ := k.parseUints(k.Strings(delim), false, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"ValidUints",
"(",
"delim",
"string",
")",
"[",
"]",
"uint",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseUints",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"false",
")",
"\n",
"return",
"... | // ValidUints returns list of uint divided by given delimiter. If some value is not unsigned integer,
// then it will not be included to result list. | [
"ValidUints",
"returns",
"list",
"of",
"uint",
"divided",
"by",
"given",
"delimiter",
".",
"If",
"some",
"value",
"is",
"not",
"unsigned",
"integer",
"then",
"it",
"will",
"not",
"be",
"included",
"to",
"result",
"list",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L593-L596 |
24,667 | go-ini/ini | key.go | ValidUint64s | func (k *Key) ValidUint64s(delim string) []uint64 {
vals, _ := k.parseUint64s(k.Strings(delim), false, false)
return vals
} | go | func (k *Key) ValidUint64s(delim string) []uint64 {
vals, _ := k.parseUint64s(k.Strings(delim), false, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"ValidUint64s",
"(",
"delim",
"string",
")",
"[",
"]",
"uint64",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseUint64s",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"false",
")",
"\n",
"return... | // ValidUint64s returns list of uint64 divided by given delimiter. If some value is not 64-bit unsigned
// integer, then it will not be included to result list. | [
"ValidUint64s",
"returns",
"list",
"of",
"uint64",
"divided",
"by",
"given",
"delimiter",
".",
"If",
"some",
"value",
"is",
"not",
"64",
"-",
"bit",
"unsigned",
"integer",
"then",
"it",
"will",
"not",
"be",
"included",
"to",
"result",
"list",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L600-L603 |
24,668 | go-ini/ini | key.go | ValidTimesFormat | func (k *Key) ValidTimesFormat(format, delim string) []time.Time {
vals, _ := k.parseTimesFormat(format, k.Strings(delim), false, false)
return vals
} | go | func (k *Key) ValidTimesFormat(format, delim string) []time.Time {
vals, _ := k.parseTimesFormat(format, k.Strings(delim), false, false)
return vals
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"ValidTimesFormat",
"(",
"format",
",",
"delim",
"string",
")",
"[",
"]",
"time",
".",
"Time",
"{",
"vals",
",",
"_",
":=",
"k",
".",
"parseTimesFormat",
"(",
"format",
",",
"k",
".",
"Strings",
"(",
"delim",
")",... | // ValidTimesFormat parses with given format and returns list of time.Time divided by given delimiter. | [
"ValidTimesFormat",
"parses",
"with",
"given",
"format",
"and",
"returns",
"list",
"of",
"time",
".",
"Time",
"divided",
"by",
"given",
"delimiter",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L606-L609 |
24,669 | go-ini/ini | key.go | ValidTimes | func (k *Key) ValidTimes(delim string) []time.Time {
return k.ValidTimesFormat(time.RFC3339, delim)
} | go | func (k *Key) ValidTimes(delim string) []time.Time {
return k.ValidTimesFormat(time.RFC3339, delim)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"ValidTimes",
"(",
"delim",
"string",
")",
"[",
"]",
"time",
".",
"Time",
"{",
"return",
"k",
".",
"ValidTimesFormat",
"(",
"time",
".",
"RFC3339",
",",
"delim",
")",
"\n",
"}"
] | // ValidTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter. | [
"ValidTimes",
"parses",
"with",
"RFC3339",
"format",
"and",
"returns",
"list",
"of",
"time",
".",
"Time",
"divided",
"by",
"given",
"delimiter",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L612-L614 |
24,670 | go-ini/ini | key.go | StrictFloat64s | func (k *Key) StrictFloat64s(delim string) ([]float64, error) {
return k.parseFloat64s(k.Strings(delim), false, true)
} | go | func (k *Key) StrictFloat64s(delim string) ([]float64, error) {
return k.parseFloat64s(k.Strings(delim), false, true)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"StrictFloat64s",
"(",
"delim",
"string",
")",
"(",
"[",
"]",
"float64",
",",
"error",
")",
"{",
"return",
"k",
".",
"parseFloat64s",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"true",
")",
... | // StrictFloat64s returns list of float64 divided by given delimiter or error on first invalid input. | [
"StrictFloat64s",
"returns",
"list",
"of",
"float64",
"divided",
"by",
"given",
"delimiter",
"or",
"error",
"on",
"first",
"invalid",
"input",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L617-L619 |
24,671 | go-ini/ini | key.go | StrictInts | func (k *Key) StrictInts(delim string) ([]int, error) {
return k.parseInts(k.Strings(delim), false, true)
} | go | func (k *Key) StrictInts(delim string) ([]int, error) {
return k.parseInts(k.Strings(delim), false, true)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"StrictInts",
"(",
"delim",
"string",
")",
"(",
"[",
"]",
"int",
",",
"error",
")",
"{",
"return",
"k",
".",
"parseInts",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"true",
")",
"\n",
"}"
... | // StrictInts returns list of int divided by given delimiter or error on first invalid input. | [
"StrictInts",
"returns",
"list",
"of",
"int",
"divided",
"by",
"given",
"delimiter",
"or",
"error",
"on",
"first",
"invalid",
"input",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L622-L624 |
24,672 | go-ini/ini | key.go | StrictInt64s | func (k *Key) StrictInt64s(delim string) ([]int64, error) {
return k.parseInt64s(k.Strings(delim), false, true)
} | go | func (k *Key) StrictInt64s(delim string) ([]int64, error) {
return k.parseInt64s(k.Strings(delim), false, true)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"StrictInt64s",
"(",
"delim",
"string",
")",
"(",
"[",
"]",
"int64",
",",
"error",
")",
"{",
"return",
"k",
".",
"parseInt64s",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"true",
")",
"\n",
... | // StrictInt64s returns list of int64 divided by given delimiter or error on first invalid input. | [
"StrictInt64s",
"returns",
"list",
"of",
"int64",
"divided",
"by",
"given",
"delimiter",
"or",
"error",
"on",
"first",
"invalid",
"input",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L627-L629 |
24,673 | go-ini/ini | key.go | StrictUints | func (k *Key) StrictUints(delim string) ([]uint, error) {
return k.parseUints(k.Strings(delim), false, true)
} | go | func (k *Key) StrictUints(delim string) ([]uint, error) {
return k.parseUints(k.Strings(delim), false, true)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"StrictUints",
"(",
"delim",
"string",
")",
"(",
"[",
"]",
"uint",
",",
"error",
")",
"{",
"return",
"k",
".",
"parseUints",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"true",
")",
"\n",
"... | // StrictUints returns list of uint divided by given delimiter or error on first invalid input. | [
"StrictUints",
"returns",
"list",
"of",
"uint",
"divided",
"by",
"given",
"delimiter",
"or",
"error",
"on",
"first",
"invalid",
"input",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L632-L634 |
24,674 | go-ini/ini | key.go | StrictUint64s | func (k *Key) StrictUint64s(delim string) ([]uint64, error) {
return k.parseUint64s(k.Strings(delim), false, true)
} | go | func (k *Key) StrictUint64s(delim string) ([]uint64, error) {
return k.parseUint64s(k.Strings(delim), false, true)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"StrictUint64s",
"(",
"delim",
"string",
")",
"(",
"[",
"]",
"uint64",
",",
"error",
")",
"{",
"return",
"k",
".",
"parseUint64s",
"(",
"k",
".",
"Strings",
"(",
"delim",
")",
",",
"false",
",",
"true",
")",
"\n... | // StrictUint64s returns list of uint64 divided by given delimiter or error on first invalid input. | [
"StrictUint64s",
"returns",
"list",
"of",
"uint64",
"divided",
"by",
"given",
"delimiter",
"or",
"error",
"on",
"first",
"invalid",
"input",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L637-L639 |
24,675 | go-ini/ini | key.go | StrictTimesFormat | func (k *Key) StrictTimesFormat(format, delim string) ([]time.Time, error) {
return k.parseTimesFormat(format, k.Strings(delim), false, true)
} | go | func (k *Key) StrictTimesFormat(format, delim string) ([]time.Time, error) {
return k.parseTimesFormat(format, k.Strings(delim), false, true)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"StrictTimesFormat",
"(",
"format",
",",
"delim",
"string",
")",
"(",
"[",
"]",
"time",
".",
"Time",
",",
"error",
")",
"{",
"return",
"k",
".",
"parseTimesFormat",
"(",
"format",
",",
"k",
".",
"Strings",
"(",
"d... | // StrictTimesFormat parses with given format and returns list of time.Time divided by given delimiter
// or error on first invalid input. | [
"StrictTimesFormat",
"parses",
"with",
"given",
"format",
"and",
"returns",
"list",
"of",
"time",
".",
"Time",
"divided",
"by",
"given",
"delimiter",
"or",
"error",
"on",
"first",
"invalid",
"input",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L643-L645 |
24,676 | go-ini/ini | key.go | StrictTimes | func (k *Key) StrictTimes(delim string) ([]time.Time, error) {
return k.StrictTimesFormat(time.RFC3339, delim)
} | go | func (k *Key) StrictTimes(delim string) ([]time.Time, error) {
return k.StrictTimesFormat(time.RFC3339, delim)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"StrictTimes",
"(",
"delim",
"string",
")",
"(",
"[",
"]",
"time",
".",
"Time",
",",
"error",
")",
"{",
"return",
"k",
".",
"StrictTimesFormat",
"(",
"time",
".",
"RFC3339",
",",
"delim",
")",
"\n",
"}"
] | // StrictTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter
// or error on first invalid input. | [
"StrictTimes",
"parses",
"with",
"RFC3339",
"format",
"and",
"returns",
"list",
"of",
"time",
".",
"Time",
"divided",
"by",
"given",
"delimiter",
"or",
"error",
"on",
"first",
"invalid",
"input",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L649-L651 |
24,677 | go-ini/ini | key.go | parseFloat64s | func (k *Key) parseFloat64s(strs []string, addInvalid, returnOnInvalid bool) ([]float64, error) {
vals := make([]float64, 0, len(strs))
for _, str := range strs {
val, err := strconv.ParseFloat(str, 64)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
vals = append(vals... | go | func (k *Key) parseFloat64s(strs []string, addInvalid, returnOnInvalid bool) ([]float64, error) {
vals := make([]float64, 0, len(strs))
for _, str := range strs {
val, err := strconv.ParseFloat(str, 64)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
vals = append(vals... | [
"func",
"(",
"k",
"*",
"Key",
")",
"parseFloat64s",
"(",
"strs",
"[",
"]",
"string",
",",
"addInvalid",
",",
"returnOnInvalid",
"bool",
")",
"(",
"[",
"]",
"float64",
",",
"error",
")",
"{",
"vals",
":=",
"make",
"(",
"[",
"]",
"float64",
",",
"0",... | // parseFloat64s transforms strings to float64s. | [
"parseFloat64s",
"transforms",
"strings",
"to",
"float64s",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L654-L666 |
24,678 | go-ini/ini | key.go | parseInts | func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int, error) {
vals := make([]int, 0, len(strs))
for _, str := range strs {
valInt64, err := strconv.ParseInt(str, 0, 64)
val := int(valInt64)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
v... | go | func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int, error) {
vals := make([]int, 0, len(strs))
for _, str := range strs {
valInt64, err := strconv.ParseInt(str, 0, 64)
val := int(valInt64)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
v... | [
"func",
"(",
"k",
"*",
"Key",
")",
"parseInts",
"(",
"strs",
"[",
"]",
"string",
",",
"addInvalid",
",",
"returnOnInvalid",
"bool",
")",
"(",
"[",
"]",
"int",
",",
"error",
")",
"{",
"vals",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"0",
",",
"l... | // parseInts transforms strings to ints. | [
"parseInts",
"transforms",
"strings",
"to",
"ints",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L669-L682 |
24,679 | go-ini/ini | key.go | parseInt64s | func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]int64, error) {
vals := make([]int64, 0, len(strs))
for _, str := range strs {
val, err := strconv.ParseInt(str, 0, 64)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
vals = append(vals, val... | go | func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]int64, error) {
vals := make([]int64, 0, len(strs))
for _, str := range strs {
val, err := strconv.ParseInt(str, 0, 64)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
vals = append(vals, val... | [
"func",
"(",
"k",
"*",
"Key",
")",
"parseInt64s",
"(",
"strs",
"[",
"]",
"string",
",",
"addInvalid",
",",
"returnOnInvalid",
"bool",
")",
"(",
"[",
"]",
"int64",
",",
"error",
")",
"{",
"vals",
":=",
"make",
"(",
"[",
"]",
"int64",
",",
"0",
","... | // parseInt64s transforms strings to int64s. | [
"parseInt64s",
"transforms",
"strings",
"to",
"int64s",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L685-L697 |
24,680 | go-ini/ini | key.go | parseUints | func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uint, error) {
vals := make([]uint, 0, len(strs))
for _, str := range strs {
val, err := strconv.ParseUint(str, 0, 0)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
vals = append(vals, uint(v... | go | func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uint, error) {
vals := make([]uint, 0, len(strs))
for _, str := range strs {
val, err := strconv.ParseUint(str, 0, 0)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
vals = append(vals, uint(v... | [
"func",
"(",
"k",
"*",
"Key",
")",
"parseUints",
"(",
"strs",
"[",
"]",
"string",
",",
"addInvalid",
",",
"returnOnInvalid",
"bool",
")",
"(",
"[",
"]",
"uint",
",",
"error",
")",
"{",
"vals",
":=",
"make",
"(",
"[",
"]",
"uint",
",",
"0",
",",
... | // parseUints transforms strings to uints. | [
"parseUints",
"transforms",
"strings",
"to",
"uints",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L700-L712 |
24,681 | go-ini/ini | key.go | parseTimesFormat | func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) {
vals := make([]time.Time, 0, len(strs))
for _, str := range strs {
val, err := time.Parse(format, str)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
... | go | func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) {
vals := make([]time.Time, 0, len(strs))
for _, str := range strs {
val, err := time.Parse(format, str)
if err != nil && returnOnInvalid {
return nil, err
}
if err == nil || addInvalid {
... | [
"func",
"(",
"k",
"*",
"Key",
")",
"parseTimesFormat",
"(",
"format",
"string",
",",
"strs",
"[",
"]",
"string",
",",
"addInvalid",
",",
"returnOnInvalid",
"bool",
")",
"(",
"[",
"]",
"time",
".",
"Time",
",",
"error",
")",
"{",
"vals",
":=",
"make",... | // parseTimesFormat transforms strings to times in given format. | [
"parseTimesFormat",
"transforms",
"strings",
"to",
"times",
"in",
"given",
"format",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L730-L742 |
24,682 | go-ini/ini | key.go | SetValue | func (k *Key) SetValue(v string) {
if k.s.f.BlockMode {
k.s.f.lock.Lock()
defer k.s.f.lock.Unlock()
}
k.value = v
k.s.keysHash[k.name] = v
} | go | func (k *Key) SetValue(v string) {
if k.s.f.BlockMode {
k.s.f.lock.Lock()
defer k.s.f.lock.Unlock()
}
k.value = v
k.s.keysHash[k.name] = v
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"SetValue",
"(",
"v",
"string",
")",
"{",
"if",
"k",
".",
"s",
".",
"f",
".",
"BlockMode",
"{",
"k",
".",
"s",
".",
"f",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"k",
".",
"s",
".",
"f",
".",
... | // SetValue changes key value. | [
"SetValue",
"changes",
"key",
"value",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/key.go#L745-L753 |
24,683 | go-ini/ini | parser.go | hasSurroundedQuote | func hasSurroundedQuote(in string, quote byte) bool {
return len(in) >= 2 && in[0] == quote && in[len(in)-1] == quote &&
strings.IndexByte(in[1:], quote) == len(in)-2
} | go | func hasSurroundedQuote(in string, quote byte) bool {
return len(in) >= 2 && in[0] == quote && in[len(in)-1] == quote &&
strings.IndexByte(in[1:], quote) == len(in)-2
} | [
"func",
"hasSurroundedQuote",
"(",
"in",
"string",
",",
"quote",
"byte",
")",
"bool",
"{",
"return",
"len",
"(",
"in",
")",
">=",
"2",
"&&",
"in",
"[",
"0",
"]",
"==",
"quote",
"&&",
"in",
"[",
"len",
"(",
"in",
")",
"-",
"1",
"]",
"==",
"quote... | // hasSurroundedQuote check if and only if the first and last characters
// are quotes \" or \'.
// It returns false if any other parts also contain same kind of quotes. | [
"hasSurroundedQuote",
"check",
"if",
"and",
"only",
"if",
"the",
"first",
"and",
"last",
"characters",
"are",
"quotes",
"\\",
"or",
"\\",
".",
"It",
"returns",
"false",
"if",
"any",
"other",
"parts",
"also",
"contain",
"same",
"kind",
"of",
"quotes",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/parser.go#L198-L201 |
24,684 | go-ini/ini | struct.go | setWithProperType | func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error {
switch t.Kind() {
case reflect.String:
if len(key.String()) == 0 {
return nil
}
field.SetString(key.String())
case reflect.Bool:
boolVal, err := key.Bool()
if err != nil {
return wr... | go | func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error {
switch t.Kind() {
case reflect.String:
if len(key.String()) == 0 {
return nil
}
field.SetString(key.String())
case reflect.Bool:
boolVal, err := key.Bool()
if err != nil {
return wr... | [
"func",
"setWithProperType",
"(",
"t",
"reflect",
".",
"Type",
",",
"key",
"*",
"Key",
",",
"field",
"reflect",
".",
"Value",
",",
"delim",
"string",
",",
"allowShadow",
",",
"isStrict",
"bool",
")",
"error",
"{",
"switch",
"t",
".",
"Kind",
"(",
")",
... | // setWithProperType sets proper value to field based on its type,
// but it does not return error for failing parsing,
// because we want to use default value that is already assigned to strcut. | [
"setWithProperType",
"sets",
"proper",
"value",
"to",
"field",
"based",
"on",
"its",
"type",
"but",
"it",
"does",
"not",
"return",
"error",
"for",
"failing",
"parsing",
"because",
"we",
"want",
"to",
"use",
"default",
"value",
"that",
"is",
"already",
"assig... | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L153-L212 |
24,685 | go-ini/ini | struct.go | MapTo | func (s *Section) MapTo(v interface{}) error {
typ := reflect.TypeOf(v)
val := reflect.ValueOf(v)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
val = val.Elem()
} else {
return errors.New("cannot map to non-pointer struct")
}
return s.mapTo(val, false)
} | go | func (s *Section) MapTo(v interface{}) error {
typ := reflect.TypeOf(v)
val := reflect.ValueOf(v)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
val = val.Elem()
} else {
return errors.New("cannot map to non-pointer struct")
}
return s.mapTo(val, false)
} | [
"func",
"(",
"s",
"*",
"Section",
")",
"MapTo",
"(",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"typ",
":=",
"reflect",
".",
"TypeOf",
"(",
"v",
")",
"\n",
"val",
":=",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"\n",
"if",
"typ",
".",
"Kind... | // MapTo maps section to given struct. | [
"MapTo",
"maps",
"section",
"to",
"given",
"struct",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L273-L284 |
24,686 | go-ini/ini | struct.go | StrictMapTo | func (s *Section) StrictMapTo(v interface{}) error {
typ := reflect.TypeOf(v)
val := reflect.ValueOf(v)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
val = val.Elem()
} else {
return errors.New("cannot map to non-pointer struct")
}
return s.mapTo(val, true)
} | go | func (s *Section) StrictMapTo(v interface{}) error {
typ := reflect.TypeOf(v)
val := reflect.ValueOf(v)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
val = val.Elem()
} else {
return errors.New("cannot map to non-pointer struct")
}
return s.mapTo(val, true)
} | [
"func",
"(",
"s",
"*",
"Section",
")",
"StrictMapTo",
"(",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"typ",
":=",
"reflect",
".",
"TypeOf",
"(",
"v",
")",
"\n",
"val",
":=",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"\n",
"if",
"typ",
".",
... | // StrictMapTo maps section to given struct in strict mode,
// which returns all possible error including value parsing error. | [
"StrictMapTo",
"maps",
"section",
"to",
"given",
"struct",
"in",
"strict",
"mode",
"which",
"returns",
"all",
"possible",
"error",
"including",
"value",
"parsing",
"error",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L288-L299 |
24,687 | go-ini/ini | struct.go | MapToWithMapper | func MapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error {
cfg, err := Load(source, others...)
if err != nil {
return err
}
cfg.NameMapper = mapper
return cfg.MapTo(v)
} | go | func MapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error {
cfg, err := Load(source, others...)
if err != nil {
return err
}
cfg.NameMapper = mapper
return cfg.MapTo(v)
} | [
"func",
"MapToWithMapper",
"(",
"v",
"interface",
"{",
"}",
",",
"mapper",
"NameMapper",
",",
"source",
"interface",
"{",
"}",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"cfg",
",",
"err",
":=",
"Load",
"(",
"source",
",",
"others"... | // MapToWithMapper maps data sources to given struct with name mapper. | [
"MapToWithMapper",
"maps",
"data",
"sources",
"to",
"given",
"struct",
"with",
"name",
"mapper",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L313-L320 |
24,688 | go-ini/ini | struct.go | StrictMapToWithMapper | func StrictMapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error {
cfg, err := Load(source, others...)
if err != nil {
return err
}
cfg.NameMapper = mapper
return cfg.StrictMapTo(v)
} | go | func StrictMapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error {
cfg, err := Load(source, others...)
if err != nil {
return err
}
cfg.NameMapper = mapper
return cfg.StrictMapTo(v)
} | [
"func",
"StrictMapToWithMapper",
"(",
"v",
"interface",
"{",
"}",
",",
"mapper",
"NameMapper",
",",
"source",
"interface",
"{",
"}",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"cfg",
",",
"err",
":=",
"Load",
"(",
"source",
",",
"o... | // StrictMapToWithMapper maps data sources to given struct with name mapper in strict mode,
// which returns all possible error including value parsing error. | [
"StrictMapToWithMapper",
"maps",
"data",
"sources",
"to",
"given",
"struct",
"with",
"name",
"mapper",
"in",
"strict",
"mode",
"which",
"returns",
"all",
"possible",
"error",
"including",
"value",
"parsing",
"error",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L324-L331 |
24,689 | go-ini/ini | struct.go | MapTo | func MapTo(v, source interface{}, others ...interface{}) error {
return MapToWithMapper(v, nil, source, others...)
} | go | func MapTo(v, source interface{}, others ...interface{}) error {
return MapToWithMapper(v, nil, source, others...)
} | [
"func",
"MapTo",
"(",
"v",
",",
"source",
"interface",
"{",
"}",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"MapToWithMapper",
"(",
"v",
",",
"nil",
",",
"source",
",",
"others",
"...",
")",
"\n",
"}"
] | // MapTo maps data sources to given struct. | [
"MapTo",
"maps",
"data",
"sources",
"to",
"given",
"struct",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L334-L336 |
24,690 | go-ini/ini | struct.go | StrictMapTo | func StrictMapTo(v, source interface{}, others ...interface{}) error {
return StrictMapToWithMapper(v, nil, source, others...)
} | go | func StrictMapTo(v, source interface{}, others ...interface{}) error {
return StrictMapToWithMapper(v, nil, source, others...)
} | [
"func",
"StrictMapTo",
"(",
"v",
",",
"source",
"interface",
"{",
"}",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"StrictMapToWithMapper",
"(",
"v",
",",
"nil",
",",
"source",
",",
"others",
"...",
")",
"\n",
"}"
] | // StrictMapTo maps data sources to given struct in strict mode,
// which returns all possible error including value parsing error. | [
"StrictMapTo",
"maps",
"data",
"sources",
"to",
"given",
"struct",
"in",
"strict",
"mode",
"which",
"returns",
"all",
"possible",
"error",
"including",
"value",
"parsing",
"error",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L340-L342 |
24,691 | go-ini/ini | struct.go | reflectSliceWithProperType | func reflectSliceWithProperType(key *Key, field reflect.Value, delim string) error {
slice := field.Slice(0, field.Len())
if field.Len() == 0 {
return nil
}
var buf bytes.Buffer
sliceOf := field.Type().Elem().Kind()
for i := 0; i < field.Len(); i++ {
switch sliceOf {
case reflect.String:
buf.WriteString... | go | func reflectSliceWithProperType(key *Key, field reflect.Value, delim string) error {
slice := field.Slice(0, field.Len())
if field.Len() == 0 {
return nil
}
var buf bytes.Buffer
sliceOf := field.Type().Elem().Kind()
for i := 0; i < field.Len(); i++ {
switch sliceOf {
case reflect.String:
buf.WriteString... | [
"func",
"reflectSliceWithProperType",
"(",
"key",
"*",
"Key",
",",
"field",
"reflect",
".",
"Value",
",",
"delim",
"string",
")",
"error",
"{",
"slice",
":=",
"field",
".",
"Slice",
"(",
"0",
",",
"field",
".",
"Len",
"(",
")",
")",
"\n",
"if",
"fiel... | // reflectSliceWithProperType does the opposite thing as setSliceWithProperType. | [
"reflectSliceWithProperType",
"does",
"the",
"opposite",
"thing",
"as",
"setSliceWithProperType",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L345-L372 |
24,692 | go-ini/ini | struct.go | reflectWithProperType | func reflectWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string) error {
switch t.Kind() {
case reflect.String:
key.SetValue(field.String())
case reflect.Bool:
key.SetValue(fmt.Sprint(field.Bool()))
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
key.SetValu... | go | func reflectWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string) error {
switch t.Kind() {
case reflect.String:
key.SetValue(field.String())
case reflect.Bool:
key.SetValue(fmt.Sprint(field.Bool()))
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
key.SetValu... | [
"func",
"reflectWithProperType",
"(",
"t",
"reflect",
".",
"Type",
",",
"key",
"*",
"Key",
",",
"field",
"reflect",
".",
"Value",
",",
"delim",
"string",
")",
"error",
"{",
"switch",
"t",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"String",
... | // reflectWithProperType does the opposite thing as setWithProperType. | [
"reflectWithProperType",
"does",
"the",
"opposite",
"thing",
"as",
"setWithProperType",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L375-L395 |
24,693 | go-ini/ini | struct.go | ReflectFrom | func (s *Section) ReflectFrom(v interface{}) error {
typ := reflect.TypeOf(v)
val := reflect.ValueOf(v)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
val = val.Elem()
} else {
return errors.New("cannot reflect from non-pointer struct")
}
return s.reflectFrom(val)
} | go | func (s *Section) ReflectFrom(v interface{}) error {
typ := reflect.TypeOf(v)
val := reflect.ValueOf(v)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
val = val.Elem()
} else {
return errors.New("cannot reflect from non-pointer struct")
}
return s.reflectFrom(val)
} | [
"func",
"(",
"s",
"*",
"Section",
")",
"ReflectFrom",
"(",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"typ",
":=",
"reflect",
".",
"TypeOf",
"(",
"v",
")",
"\n",
"val",
":=",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"\n",
"if",
"typ",
".",
... | // ReflectFrom reflects secion from given struct. | [
"ReflectFrom",
"reflects",
"secion",
"from",
"given",
"struct",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L485-L496 |
24,694 | go-ini/ini | struct.go | ReflectFromWithMapper | func ReflectFromWithMapper(cfg *File, v interface{}, mapper NameMapper) error {
cfg.NameMapper = mapper
return cfg.ReflectFrom(v)
} | go | func ReflectFromWithMapper(cfg *File, v interface{}, mapper NameMapper) error {
cfg.NameMapper = mapper
return cfg.ReflectFrom(v)
} | [
"func",
"ReflectFromWithMapper",
"(",
"cfg",
"*",
"File",
",",
"v",
"interface",
"{",
"}",
",",
"mapper",
"NameMapper",
")",
"error",
"{",
"cfg",
".",
"NameMapper",
"=",
"mapper",
"\n",
"return",
"cfg",
".",
"ReflectFrom",
"(",
"v",
")",
"\n",
"}"
] | // ReflectFromWithMapper reflects data sources from given struct with name mapper. | [
"ReflectFromWithMapper",
"reflects",
"data",
"sources",
"from",
"given",
"struct",
"with",
"name",
"mapper",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/struct.go#L504-L507 |
24,695 | go-ini/ini | section.go | SetBody | func (s *Section) SetBody(body string) {
if !s.isRawSection {
return
}
s.rawBody = body
} | go | func (s *Section) SetBody(body string) {
if !s.isRawSection {
return
}
s.rawBody = body
} | [
"func",
"(",
"s",
"*",
"Section",
")",
"SetBody",
"(",
"body",
"string",
")",
"{",
"if",
"!",
"s",
".",
"isRawSection",
"{",
"return",
"\n",
"}",
"\n",
"s",
".",
"rawBody",
"=",
"body",
"\n",
"}"
] | // SetBody updates body content only if section is raw. | [
"SetBody",
"updates",
"body",
"content",
"only",
"if",
"section",
"is",
"raw",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/section.go#L58-L63 |
24,696 | go-ini/ini | section.go | NewKey | func (s *Section) NewKey(name, val string) (*Key, error) {
if len(name) == 0 {
return nil, errors.New("error creating new key: empty key name")
} else if s.f.options.Insensitive {
name = strings.ToLower(name)
}
if s.f.BlockMode {
s.f.lock.Lock()
defer s.f.lock.Unlock()
}
if inSlice(name, s.keyList) {
... | go | func (s *Section) NewKey(name, val string) (*Key, error) {
if len(name) == 0 {
return nil, errors.New("error creating new key: empty key name")
} else if s.f.options.Insensitive {
name = strings.ToLower(name)
}
if s.f.BlockMode {
s.f.lock.Lock()
defer s.f.lock.Unlock()
}
if inSlice(name, s.keyList) {
... | [
"func",
"(",
"s",
"*",
"Section",
")",
"NewKey",
"(",
"name",
",",
"val",
"string",
")",
"(",
"*",
"Key",
",",
"error",
")",
"{",
"if",
"len",
"(",
"name",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",... | // NewKey creates a new key to given section. | [
"NewKey",
"creates",
"a",
"new",
"key",
"to",
"given",
"section",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/section.go#L66-L94 |
24,697 | go-ini/ini | section.go | NewBooleanKey | func (s *Section) NewBooleanKey(name string) (*Key, error) {
key, err := s.NewKey(name, "true")
if err != nil {
return nil, err
}
key.isBooleanType = true
return key, nil
} | go | func (s *Section) NewBooleanKey(name string) (*Key, error) {
key, err := s.NewKey(name, "true")
if err != nil {
return nil, err
}
key.isBooleanType = true
return key, nil
} | [
"func",
"(",
"s",
"*",
"Section",
")",
"NewBooleanKey",
"(",
"name",
"string",
")",
"(",
"*",
"Key",
",",
"error",
")",
"{",
"key",
",",
"err",
":=",
"s",
".",
"NewKey",
"(",
"name",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // NewBooleanKey creates a new boolean type key to given section. | [
"NewBooleanKey",
"creates",
"a",
"new",
"boolean",
"type",
"key",
"to",
"given",
"section",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/section.go#L97-L105 |
24,698 | go-ini/ini | section.go | GetKey | func (s *Section) GetKey(name string) (*Key, error) {
if s.f.BlockMode {
s.f.lock.RLock()
}
if s.f.options.Insensitive {
name = strings.ToLower(name)
}
key := s.keys[name]
if s.f.BlockMode {
s.f.lock.RUnlock()
}
if key == nil {
// Check if it is a child-section.
sname := s.name
for {
if i := str... | go | func (s *Section) GetKey(name string) (*Key, error) {
if s.f.BlockMode {
s.f.lock.RLock()
}
if s.f.options.Insensitive {
name = strings.ToLower(name)
}
key := s.keys[name]
if s.f.BlockMode {
s.f.lock.RUnlock()
}
if key == nil {
// Check if it is a child-section.
sname := s.name
for {
if i := str... | [
"func",
"(",
"s",
"*",
"Section",
")",
"GetKey",
"(",
"name",
"string",
")",
"(",
"*",
"Key",
",",
"error",
")",
"{",
"if",
"s",
".",
"f",
".",
"BlockMode",
"{",
"s",
".",
"f",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"}",
"\n",
"if",
"s"... | // GetKey returns key in section by given name. | [
"GetKey",
"returns",
"key",
"in",
"section",
"by",
"given",
"name",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/section.go#L108-L137 |
24,699 | go-ini/ini | section.go | HasKey | func (s *Section) HasKey(name string) bool {
key, _ := s.GetKey(name)
return key != nil
} | go | func (s *Section) HasKey(name string) bool {
key, _ := s.GetKey(name)
return key != nil
} | [
"func",
"(",
"s",
"*",
"Section",
")",
"HasKey",
"(",
"name",
"string",
")",
"bool",
"{",
"key",
",",
"_",
":=",
"s",
".",
"GetKey",
"(",
"name",
")",
"\n",
"return",
"key",
"!=",
"nil",
"\n",
"}"
] | // HasKey returns true if section contains a key with given name. | [
"HasKey",
"returns",
"true",
"if",
"section",
"contains",
"a",
"key",
"with",
"given",
"name",
"."
] | 3be5ad479f69d4e08d7fe25edf79bf3346bd658e | https://github.com/go-ini/ini/blob/3be5ad479f69d4e08d7fe25edf79bf3346bd658e/section.go#L140-L143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.