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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
146,400
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/activations.go
NewActivation
func NewActivation(parent *Activations) *Activation { activation := &Activation{parent: parent} activation.Init() return activation }
go
func NewActivation(parent *Activations) *Activation { activation := &Activation{parent: parent} activation.Init() return activation }
[ "func", "NewActivation", "(", "parent", "*", "Activations", ")", "*", "Activation", "{", "activation", ":=", "&", "Activation", "{", "parent", ":", "parent", "}", "\n", "activation", ".", "Init", "(", ")", "\n\n", "return", "activation", "\n", "}" ]
// NewActivation creates a new Activation
[ "NewActivation", "creates", "a", "new", "Activation" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/activations.go#L138-L143
146,401
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/hostnames.go
NewHostname
func (hostnames *Hostnames) NewHostname() *Hostname { hostname := NewHostname(hostnames) hostnames.Hostnames.Items = append(hostnames.Hostnames.Items, hostname) return hostname }
go
func (hostnames *Hostnames) NewHostname() *Hostname { hostname := NewHostname(hostnames) hostnames.Hostnames.Items = append(hostnames.Hostnames.Items, hostname) return hostname }
[ "func", "(", "hostnames", "*", "Hostnames", ")", "NewHostname", "(", ")", "*", "Hostname", "{", "hostname", ":=", "NewHostname", "(", "hostnames", ")", "\n", "hostnames", ".", "Hostnames", ".", "Items", "=", "append", "(", "hostnames", ".", "Hostnames", "....
// NewHostname creates a new Hostname within a given Hostnames
[ "NewHostname", "creates", "a", "new", "Hostname", "within", "a", "given", "Hostnames" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/hostnames.go#L104-L108
146,402
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/hostnames.go
Save
func (hostnames *Hostnames) Save() error { req, err := client.NewJSONRequest( Config, "PUT", fmt.Sprintf( "/papi/v1/properties/%s/versions/%d/hostnames?contractId=%s&groupId=%s", hostnames.PropertyID, hostnames.PropertyVersion, hostnames.ContractID, hostnames.GroupID, ), hostnames.Hostnames.It...
go
func (hostnames *Hostnames) Save() error { req, err := client.NewJSONRequest( Config, "PUT", fmt.Sprintf( "/papi/v1/properties/%s/versions/%d/hostnames?contractId=%s&groupId=%s", hostnames.PropertyID, hostnames.PropertyVersion, hostnames.ContractID, hostnames.GroupID, ), hostnames.Hostnames.It...
[ "func", "(", "hostnames", "*", "Hostnames", ")", "Save", "(", ")", "error", "{", "req", ",", "err", ":=", "client", ".", "NewJSONRequest", "(", "Config", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "hostnames", ".", "PropertyID...
// Save updates a properties hostnames
[ "Save", "updates", "a", "properties", "hostnames" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/hostnames.go#L111-L142
146,403
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/hostnames.go
NewHostname
func NewHostname(parent *Hostnames) *Hostname { hostname := &Hostname{parent: parent, CnameType: CnameTypeEdgeHostname} hostname.Init() return hostname }
go
func NewHostname(parent *Hostnames) *Hostname { hostname := &Hostname{parent: parent, CnameType: CnameTypeEdgeHostname} hostname.Init() return hostname }
[ "func", "NewHostname", "(", "parent", "*", "Hostnames", ")", "*", "Hostname", "{", "hostname", ":=", "&", "Hostname", "{", "parent", ":", "parent", ",", "CnameType", ":", "CnameTypeEdgeHostname", "}", "\n", "hostname", ".", "Init", "(", ")", "\n\n", "retur...
// NewHostname creates a new Hostname
[ "NewHostname", "creates", "a", "new", "Hostname" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/hostnames.go#L155-L160
146,404
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/versions.go
AddVersion
func (versions *Versions) AddVersion(version *Version) { if version.PropertyVersion != 0 { for key, v := range versions.Versions.Items { if v.PropertyVersion == version.PropertyVersion { versions.Versions.Items[key] = version return } } } versions.Versions.Items = append(versions.Versions.Items, v...
go
func (versions *Versions) AddVersion(version *Version) { if version.PropertyVersion != 0 { for key, v := range versions.Versions.Items { if v.PropertyVersion == version.PropertyVersion { versions.Versions.Items[key] = version return } } } versions.Versions.Items = append(versions.Versions.Items, v...
[ "func", "(", "versions", "*", "Versions", ")", "AddVersion", "(", "version", "*", "Version", ")", "{", "if", "version", ".", "PropertyVersion", "!=", "0", "{", "for", "key", ",", "v", ":=", "range", "versions", ".", "Versions", ".", "Items", "{", "if",...
// AddVersion adds or replaces a version within the collection
[ "AddVersion", "adds", "or", "replaces", "a", "version", "within", "the", "collection" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/versions.go#L47-L58
146,405
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/versions.go
NewVersion
func (versions *Versions) NewVersion(createFromVersion *Version, useEtagStrict bool) *Version { if createFromVersion == nil { var err error createFromVersion, err = versions.GetLatestVersion("") if err != nil { return nil } } version := NewVersion(versions) version.CreateFromVersion = createFromVersion....
go
func (versions *Versions) NewVersion(createFromVersion *Version, useEtagStrict bool) *Version { if createFromVersion == nil { var err error createFromVersion, err = versions.GetLatestVersion("") if err != nil { return nil } } version := NewVersion(versions) version.CreateFromVersion = createFromVersion....
[ "func", "(", "versions", "*", "Versions", ")", "NewVersion", "(", "createFromVersion", "*", "Version", ",", "useEtagStrict", "bool", ")", "*", "Version", "{", "if", "createFromVersion", "==", "nil", "{", "var", "err", "error", "\n", "createFromVersion", ",", ...
// NewVersion creates a new version associated with the Versions collection
[ "NewVersion", "creates", "a", "new", "version", "associated", "with", "the", "Versions", "collection" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/versions.go#L137-L156
146,406
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/versions.go
NewVersion
func NewVersion(parent *Versions) *Version { version := &Version{parent: parent} version.Init() return version }
go
func NewVersion(parent *Versions) *Version { version := &Version{parent: parent} version.Init() return version }
[ "func", "NewVersion", "(", "parent", "*", "Versions", ")", "*", "Version", "{", "version", ":=", "&", "Version", "{", "parent", ":", "parent", "}", "\n", "version", ".", "Init", "(", ")", "\n\n", "return", "version", "\n", "}" ]
// NewVersion creates a new Version
[ "NewVersion", "creates", "a", "new", "Version" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/versions.go#L176-L181
146,407
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/versions.go
HasBeenActivated
func (version *Version) HasBeenActivated(activatedOn NetworkValue) (bool, error) { properties := NewProperties() property := NewProperty(properties) property.PropertyID = version.parent.PropertyID property.Group = NewGroup(NewGroups()) property.Group.GroupID = version.parent.GroupID property.Contract = NewContr...
go
func (version *Version) HasBeenActivated(activatedOn NetworkValue) (bool, error) { properties := NewProperties() property := NewProperty(properties) property.PropertyID = version.parent.PropertyID property.Group = NewGroup(NewGroups()) property.Group.GroupID = version.parent.GroupID property.Contract = NewContr...
[ "func", "(", "version", "*", "Version", ")", "HasBeenActivated", "(", "activatedOn", "NetworkValue", ")", "(", "bool", ",", "error", ")", "{", "properties", ":=", "NewProperties", "(", ")", "\n", "property", ":=", "NewProperty", "(", "properties", ")", "\n",...
// HasBeenActivated determines if a given version has been activated, optionally on a specific network
[ "HasBeenActivated", "determines", "if", "a", "given", "version", "has", "been", "activated", "optionally", "on", "a", "specific", "network" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/versions.go#L235-L258
146,408
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/edgehostnames.go
NewEdgeHostname
func (edgeHostnames *EdgeHostnames) NewEdgeHostname() *EdgeHostname { edgeHostname := NewEdgeHostname(edgeHostnames) edgeHostnames.EdgeHostnames.Items = append(edgeHostnames.EdgeHostnames.Items, edgeHostname) return edgeHostname }
go
func (edgeHostnames *EdgeHostnames) NewEdgeHostname() *EdgeHostname { edgeHostname := NewEdgeHostname(edgeHostnames) edgeHostnames.EdgeHostnames.Items = append(edgeHostnames.EdgeHostnames.Items, edgeHostname) return edgeHostname }
[ "func", "(", "edgeHostnames", "*", "EdgeHostnames", ")", "NewEdgeHostname", "(", ")", "*", "EdgeHostname", "{", "edgeHostname", ":=", "NewEdgeHostname", "(", "edgeHostnames", ")", "\n", "edgeHostnames", ".", "EdgeHostnames", ".", "Items", "=", "append", "(", "ed...
// NewEdgeHostname creates a new EdgeHostname within a given EdgeHostnames
[ "NewEdgeHostname", "creates", "a", "new", "EdgeHostname", "within", "a", "given", "EdgeHostnames" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/edgehostnames.go#L51-L55
146,409
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/edgehostnames.go
NewEdgeHostname
func NewEdgeHostname(edgeHostnames *EdgeHostnames) *EdgeHostname { edgeHostname := &EdgeHostname{parent: edgeHostnames} edgeHostname.Init() return edgeHostname }
go
func NewEdgeHostname(edgeHostnames *EdgeHostnames) *EdgeHostname { edgeHostname := &EdgeHostname{parent: edgeHostnames} edgeHostname.Init() return edgeHostname }
[ "func", "NewEdgeHostname", "(", "edgeHostnames", "*", "EdgeHostnames", ")", "*", "EdgeHostname", "{", "edgeHostname", ":=", "&", "EdgeHostname", "{", "parent", ":", "edgeHostnames", "}", "\n", "edgeHostname", ".", "Init", "(", ")", "\n", "return", "edgeHostname"...
// NewEdgeHostname creates a new EdgeHostname
[ "NewEdgeHostname", "creates", "a", "new", "EdgeHostname" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/edgehostnames.go#L161-L165
146,410
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/properties.go
AddProperty
func (properties *Properties) AddProperty(newProperty *Property) { if newProperty.PropertyID != "" { for key, property := range properties.Properties.Items { if property.PropertyID == newProperty.PropertyID { properties.Properties.Items[key] = newProperty return } } } newProperty.parent = properti...
go
func (properties *Properties) AddProperty(newProperty *Property) { if newProperty.PropertyID != "" { for key, property := range properties.Properties.Items { if property.PropertyID == newProperty.PropertyID { properties.Properties.Items[key] = newProperty return } } } newProperty.parent = properti...
[ "func", "(", "properties", "*", "Properties", ")", "AddProperty", "(", "newProperty", "*", "Property", ")", "{", "if", "newProperty", ".", "PropertyID", "!=", "\"", "\"", "{", "for", "key", ",", "property", ":=", "range", "properties", ".", "Properties", "...
// AddProperty adds a property to the collection, if the property already exists // in the collection it will be replaced.
[ "AddProperty", "adds", "a", "property", "to", "the", "collection", "if", "the", "property", "already", "exists", "in", "the", "collection", "it", "will", "be", "replaced", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/properties.go#L83-L96
146,411
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/properties.go
FindProperty
func (properties *Properties) FindProperty(id string) (*Property, error) { var property *Property var propertyFound bool for _, property = range properties.Properties.Items { if property.PropertyID == id { propertyFound = true break } } if !propertyFound { return nil, fmt.Errorf("Unable to find proper...
go
func (properties *Properties) FindProperty(id string) (*Property, error) { var property *Property var propertyFound bool for _, property = range properties.Properties.Items { if property.PropertyID == id { propertyFound = true break } } if !propertyFound { return nil, fmt.Errorf("Unable to find proper...
[ "func", "(", "properties", "*", "Properties", ")", "FindProperty", "(", "id", "string", ")", "(", "*", "Property", ",", "error", ")", "{", "var", "property", "*", "Property", "\n", "var", "propertyFound", "bool", "\n", "for", "_", ",", "property", "=", ...
// FindProperty finds a property by ID within the collection
[ "FindProperty", "finds", "a", "property", "by", "ID", "within", "the", "collection" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/properties.go#L99-L114
146,412
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/properties.go
NewProperty
func (properties *Properties) NewProperty(contract *Contract, group *Group) *Property { property := NewProperty(properties) properties.AddProperty(property) property.Contract = contract property.Group = group go property.Contract.GetContract() go property.Group.GetGroup() go (func(property *Property) { group...
go
func (properties *Properties) NewProperty(contract *Contract, group *Group) *Property { property := NewProperty(properties) properties.AddProperty(property) property.Contract = contract property.Group = group go property.Contract.GetContract() go property.Group.GetGroup() go (func(property *Property) { group...
[ "func", "(", "properties", "*", "Properties", ")", "NewProperty", "(", "contract", "*", "Contract", ",", "group", "*", "Group", ")", "*", "Property", "{", "property", ":=", "NewProperty", "(", "properties", ")", "\n\n", "properties", ".", "AddProperty", "(",...
// NewProperty creates a new property associated with the collection
[ "NewProperty", "creates", "a", "new", "property", "associated", "with", "the", "collection" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/properties.go#L117-L133
146,413
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/properties.go
NewProperty
func NewProperty(parent *Properties) *Property { property := &Property{parent: parent, Group: &Group{}, Contract: &Contract{}} property.Init() return property }
go
func NewProperty(parent *Properties) *Property { property := &Property{parent: parent, Group: &Group{}, Contract: &Contract{}} property.Init() return property }
[ "func", "NewProperty", "(", "parent", "*", "Properties", ")", "*", "Property", "{", "property", ":=", "&", "Property", "{", "parent", ":", "parent", ",", "Group", ":", "&", "Group", "{", "}", ",", "Contract", ":", "&", "Contract", "{", "}", "}", "\n"...
// NewProperty creates a new Property
[ "NewProperty", "creates", "a", "new", "Property" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/properties.go#L156-L160
146,414
akamai/AkamaiOPEN-edgegrid-golang
client-v1/errors.go
NewAPIError
func NewAPIError(response *http.Response) APIError { // TODO: handle this error body, _ := ioutil.ReadAll(response.Body) return NewAPIErrorFromBody(response, body) }
go
func NewAPIError(response *http.Response) APIError { // TODO: handle this error body, _ := ioutil.ReadAll(response.Body) return NewAPIErrorFromBody(response, body) }
[ "func", "NewAPIError", "(", "response", "*", "http", ".", "Response", ")", "APIError", "{", "// TODO: handle this error", "body", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "response", ".", "Body", ")", "\n\n", "return", "NewAPIErrorFromBody", "(", "respon...
// NewAPIError creates a new API error based on a Response, // or http.Response-like.
[ "NewAPIError", "creates", "a", "new", "API", "error", "based", "on", "a", "Response", "or", "http", ".", "Response", "-", "like", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/client-v1/errors.go#L55-L60
146,415
akamai/AkamaiOPEN-edgegrid-golang
client-v1/errors.go
NewAPIErrorFromBody
func NewAPIErrorFromBody(response *http.Response, body []byte) APIError { error := APIError{} if err := jsonhooks.Unmarshal(body, &error); err == nil { error.Status = response.StatusCode error.Title = response.Status } error.Response = response error.RawBody = string(body) return error }
go
func NewAPIErrorFromBody(response *http.Response, body []byte) APIError { error := APIError{} if err := jsonhooks.Unmarshal(body, &error); err == nil { error.Status = response.StatusCode error.Title = response.Status } error.Response = response error.RawBody = string(body) return error }
[ "func", "NewAPIErrorFromBody", "(", "response", "*", "http", ".", "Response", ",", "body", "[", "]", "byte", ")", "APIError", "{", "error", ":=", "APIError", "{", "}", "\n", "if", "err", ":=", "jsonhooks", ".", "Unmarshal", "(", "body", ",", "&", "erro...
// NewAPIErrorFromBody creates a new API error, allowing you to pass in a body // // This function is intended to be used after the body has already been read for // other purposes.
[ "NewAPIErrorFromBody", "creates", "a", "new", "API", "error", "allowing", "you", "to", "pass", "in", "a", "body", "This", "function", "is", "intended", "to", "be", "used", "after", "the", "body", "has", "already", "been", "read", "for", "other", "purposes", ...
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/client-v1/errors.go#L66-L77
146,416
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/customoverrides.go
PostUnmarshalJSON
func (overrides *CustomOverrides) PostUnmarshalJSON() error { overrides.Init() for key, override := range overrides.CustomOverrides.Items { overrides.CustomOverrides.Items[key].parent = overrides if err := override.PostUnmarshalJSON(); err != nil { return err } } overrides.Complete <- true return nil ...
go
func (overrides *CustomOverrides) PostUnmarshalJSON() error { overrides.Init() for key, override := range overrides.CustomOverrides.Items { overrides.CustomOverrides.Items[key].parent = overrides if err := override.PostUnmarshalJSON(); err != nil { return err } } overrides.Complete <- true return nil ...
[ "func", "(", "overrides", "*", "CustomOverrides", ")", "PostUnmarshalJSON", "(", ")", "error", "{", "overrides", ".", "Init", "(", ")", "\n\n", "for", "key", ",", "override", ":=", "range", "overrides", ".", "CustomOverrides", ".", "Items", "{", "overrides",...
// PostUnmarshalJSON is called after UnmarshalJSON to setup the // structs internal state. The CustomOverrides.Complete channel is utilized // to communicate full completion.
[ "PostUnmarshalJSON", "is", "called", "after", "UnmarshalJSON", "to", "setup", "the", "structs", "internal", "state", ".", "The", "CustomOverrides", ".", "Complete", "channel", "is", "utilized", "to", "communicate", "full", "completion", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/customoverrides.go#L30-L44
146,417
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/products.go
FindProduct
func (products *Products) FindProduct(id string) (*Product, error) { var product *Product var productFound bool for _, product = range products.Products.Items { if product.ProductID == id { productFound = true break } } if !productFound { return nil, fmt.Errorf("Unable to find product: \"%s\"", id) }...
go
func (products *Products) FindProduct(id string) (*Product, error) { var product *Product var productFound bool for _, product = range products.Products.Items { if product.ProductID == id { productFound = true break } } if !productFound { return nil, fmt.Errorf("Unable to find product: \"%s\"", id) }...
[ "func", "(", "products", "*", "Products", ")", "FindProduct", "(", "id", "string", ")", "(", "*", "Product", ",", "error", ")", "{", "var", "product", "*", "Product", "\n", "var", "productFound", "bool", "\n", "for", "_", ",", "product", "=", "range", ...
// FindProduct finds a specific product by ID
[ "FindProduct", "finds", "a", "specific", "product", "by", "ID" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/products.go#L78-L93
146,418
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/products.go
NewProduct
func NewProduct(parent *Products) *Product { product := &Product{parent: parent} product.Init() return product }
go
func NewProduct(parent *Products) *Product { product := &Product{parent: parent} product.Init() return product }
[ "func", "NewProduct", "(", "parent", "*", "Products", ")", "*", "Product", "{", "product", ":=", "&", "Product", "{", "parent", ":", "parent", "}", "\n", "product", ".", "Init", "(", ")", "\n\n", "return", "product", "\n", "}" ]
// NewProduct creates a new Product
[ "NewProduct", "creates", "a", "new", "Product" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/products.go#L104-L109
146,419
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/service.go
GetContracts
func GetContracts() (*Contracts, error) { contracts := NewContracts() if err := contracts.GetContracts(); err != nil { return nil, err } return contracts, nil }
go
func GetContracts() (*Contracts, error) { contracts := NewContracts() if err := contracts.GetContracts(); err != nil { return nil, err } return contracts, nil }
[ "func", "GetContracts", "(", ")", "(", "*", "Contracts", ",", "error", ")", "{", "contracts", ":=", "NewContracts", "(", ")", "\n", "if", "err", ":=", "contracts", ".", "GetContracts", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "er...
// GetContracts retrieves all contracts
[ "GetContracts", "retrieves", "all", "contracts" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/service.go#L22-L29
146,420
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/service.go
GetProducts
func GetProducts(contract *Contract) (*Products, error) { products := NewProducts() if err := products.GetProducts(contract); err != nil { return nil, err } return products, nil }
go
func GetProducts(contract *Contract) (*Products, error) { products := NewProducts() if err := products.GetProducts(contract); err != nil { return nil, err } return products, nil }
[ "func", "GetProducts", "(", "contract", "*", "Contract", ")", "(", "*", "Products", ",", "error", ")", "{", "products", ":=", "NewProducts", "(", ")", "\n", "if", "err", ":=", "products", ".", "GetProducts", "(", "contract", ")", ";", "err", "!=", "nil...
// GetProducts retrieves all products
[ "GetProducts", "retrieves", "all", "products" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/service.go#L32-L39
146,421
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/service.go
GetEdgeHostnames
func GetEdgeHostnames(contract *Contract, group *Group, options string) (*EdgeHostnames, error) { edgeHostnames := NewEdgeHostnames() if err := edgeHostnames.GetEdgeHostnames(contract, group, options); err != nil { return nil, err } return edgeHostnames, nil }
go
func GetEdgeHostnames(contract *Contract, group *Group, options string) (*EdgeHostnames, error) { edgeHostnames := NewEdgeHostnames() if err := edgeHostnames.GetEdgeHostnames(contract, group, options); err != nil { return nil, err } return edgeHostnames, nil }
[ "func", "GetEdgeHostnames", "(", "contract", "*", "Contract", ",", "group", "*", "Group", ",", "options", "string", ")", "(", "*", "EdgeHostnames", ",", "error", ")", "{", "edgeHostnames", ":=", "NewEdgeHostnames", "(", ")", "\n", "if", "err", ":=", "edgeH...
// GetEdgeHostnames retrieves all edge hostnames
[ "GetEdgeHostnames", "retrieves", "all", "edge", "hostnames" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/service.go#L42-L49
146,422
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/service.go
GetVersions
func GetVersions(property *Property) (*Versions, error) { versions := NewVersions() if err := versions.GetVersions(property); err != nil { return nil, err } return versions, nil }
go
func GetVersions(property *Property) (*Versions, error) { versions := NewVersions() if err := versions.GetVersions(property); err != nil { return nil, err } return versions, nil }
[ "func", "GetVersions", "(", "property", "*", "Property", ")", "(", "*", "Versions", ",", "error", ")", "{", "versions", ":=", "NewVersions", "(", ")", "\n", "if", "err", ":=", "versions", ".", "GetVersions", "(", "property", ")", ";", "err", "!=", "nil...
// GetVersions retrieves all versions for a given property
[ "GetVersions", "retrieves", "all", "versions", "for", "a", "given", "property" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/service.go#L74-L81
146,423
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/service.go
GetAvailableCriteria
func GetAvailableCriteria(property *Property) (*AvailableCriteria, error) { availableCriteria := NewAvailableCriteria() if err := availableCriteria.GetAvailableCriteria(property); err != nil { return nil, err } return availableCriteria, nil }
go
func GetAvailableCriteria(property *Property) (*AvailableCriteria, error) { availableCriteria := NewAvailableCriteria() if err := availableCriteria.GetAvailableCriteria(property); err != nil { return nil, err } return availableCriteria, nil }
[ "func", "GetAvailableCriteria", "(", "property", "*", "Property", ")", "(", "*", "AvailableCriteria", ",", "error", ")", "{", "availableCriteria", ":=", "NewAvailableCriteria", "(", ")", "\n", "if", "err", ":=", "availableCriteria", ".", "GetAvailableCriteria", "(...
// GetAvailableCriteria retrieves all available criteria for a property
[ "GetAvailableCriteria", "retrieves", "all", "available", "criteria", "for", "a", "property" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/service.go#L94-L101
146,424
akamai/AkamaiOPEN-edgegrid-golang
configdns-v1/zone.go
NewZone
func NewZone(hostname string) *Zone { zone := &Zone{Token: "new"} zone.Zone.Soa = NewSoaRecord() zone.Zone.Name = hostname return zone }
go
func NewZone(hostname string) *Zone { zone := &Zone{Token: "new"} zone.Zone.Soa = NewSoaRecord() zone.Zone.Name = hostname return zone }
[ "func", "NewZone", "(", "hostname", "string", ")", "*", "Zone", "{", "zone", ":=", "&", "Zone", "{", "Token", ":", "\"", "\"", "}", "\n", "zone", ".", "Zone", ".", "Soa", "=", "NewSoaRecord", "(", ")", "\n", "zone", ".", "Zone", ".", "Name", "=",...
// NewZone creates a new Zone
[ "NewZone", "creates", "a", "new", "Zone" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/configdns-v1/zone.go#L55-L60
146,425
akamai/AkamaiOPEN-edgegrid-golang
configdns-v1/zone.go
GetZone
func GetZone(hostname string) (*Zone, error) { zone := NewZone(hostname) req, err := client.NewRequest( Config, "GET", "/config-dns/v1/zones/"+hostname, nil, ) if err != nil { return nil, err } res, err := client.Do(Config, req) if err != nil { return nil, err } if client.IsError(res) && res.Stat...
go
func GetZone(hostname string) (*Zone, error) { zone := NewZone(hostname) req, err := client.NewRequest( Config, "GET", "/config-dns/v1/zones/"+hostname, nil, ) if err != nil { return nil, err } res, err := client.Do(Config, req) if err != nil { return nil, err } if client.IsError(res) && res.Stat...
[ "func", "GetZone", "(", "hostname", "string", ")", "(", "*", "Zone", ",", "error", ")", "{", "zone", ":=", "NewZone", "(", "hostname", ")", "\n", "req", ",", "err", ":=", "client", ".", "NewRequest", "(", "Config", ",", "\"", "\"", ",", "\"", "\"",...
// GetZone retrieves a DNS Zone for a given hostname
[ "GetZone", "retrieves", "a", "DNS", "Zone", "for", "a", "given", "hostname" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/configdns-v1/zone.go#L63-L92
146,426
akamai/AkamaiOPEN-edgegrid-golang
configdns-v1/zone.go
Save
func (zone *Zone) Save() error { // This lock will restrict the concurrency of API calls // to 1 save request at a time. This is needed for the Soa.Serial value which // is required to be incremented for every subsequent update to a zone // so we have to save just one request at a time to ensure this is always // ...
go
func (zone *Zone) Save() error { // This lock will restrict the concurrency of API calls // to 1 save request at a time. This is needed for the Soa.Serial value which // is required to be incremented for every subsequent update to a zone // so we have to save just one request at a time to ensure this is always // ...
[ "func", "(", "zone", "*", "Zone", ")", "Save", "(", ")", "error", "{", "// This lock will restrict the concurrency of API calls", "// to 1 save request at a time. This is needed for the Soa.Serial value which", "// is required to be incremented for every subsequent update to a zone", "//...
// Save updates the Zone
[ "Save", "updates", "the", "Zone" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/configdns-v1/zone.go#L95-L157
146,427
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/available.go
NewAvailableBehavior
func NewAvailableBehavior(parent *AvailableBehaviors) *AvailableBehavior { availableBehavior := &AvailableBehavior{parent: parent} availableBehavior.Init() return availableBehavior }
go
func NewAvailableBehavior(parent *AvailableBehaviors) *AvailableBehavior { availableBehavior := &AvailableBehavior{parent: parent} availableBehavior.Init() return availableBehavior }
[ "func", "NewAvailableBehavior", "(", "parent", "*", "AvailableBehaviors", ")", "*", "AvailableBehavior", "{", "availableBehavior", ":=", "&", "AvailableBehavior", "{", "parent", ":", "parent", "}", "\n", "availableBehavior", ".", "Init", "(", ")", "\n\n", "return"...
// NewAvailableBehavior creates a new AvailableBehavior
[ "NewAvailableBehavior", "creates", "a", "new", "AvailableBehavior" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/available.go#L153-L158
146,428
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/available.go
GetSchema
func (behavior *AvailableBehavior) GetSchema() (*gojsonschema.Schema, error) { req, err := client.NewRequest( Config, "GET", behavior.SchemaLink, nil, ) if err != nil { return nil, err } res, err := client.Do(Config, req) if err != nil { return nil, err } schemaBytes, _ := ioutil.ReadAll(res.Body)...
go
func (behavior *AvailableBehavior) GetSchema() (*gojsonschema.Schema, error) { req, err := client.NewRequest( Config, "GET", behavior.SchemaLink, nil, ) if err != nil { return nil, err } res, err := client.Do(Config, req) if err != nil { return nil, err } schemaBytes, _ := ioutil.ReadAll(res.Body)...
[ "func", "(", "behavior", "*", "AvailableBehavior", ")", "GetSchema", "(", ")", "(", "*", "gojsonschema", ".", "Schema", ",", "error", ")", "{", "req", ",", "err", ":=", "client", ".", "NewRequest", "(", "Config", ",", "\"", "\"", ",", "behavior", ".", ...
// GetSchema retrieves the JSON schema for an available behavior
[ "GetSchema", "retrieves", "the", "JSON", "schema", "for", "an", "available", "behavior" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/available.go#L161-L183
146,429
akamai/AkamaiOPEN-edgegrid-golang
jsonhooks-v1/jsonhooks.go
ImplementsPreJSONMarshaler
func ImplementsPreJSONMarshaler(v interface{}) bool { value := reflect.ValueOf(v) if !value.IsValid() { return false } _, ok := value.Interface().(PreJSONMarshaler) return ok }
go
func ImplementsPreJSONMarshaler(v interface{}) bool { value := reflect.ValueOf(v) if !value.IsValid() { return false } _, ok := value.Interface().(PreJSONMarshaler) return ok }
[ "func", "ImplementsPreJSONMarshaler", "(", "v", "interface", "{", "}", ")", "bool", "{", "value", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n", "if", "!", "value", ".", "IsValid", "(", ")", "{", "return", "false", "\n", "}", "\n\n", "_", ",",...
// ImplementsPreJSONMarshaler checks for support for the PreMarshalJSON pre-hook
[ "ImplementsPreJSONMarshaler", "checks", "for", "support", "for", "the", "PreMarshalJSON", "pre", "-", "hook" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/jsonhooks-v1/jsonhooks.go#L45-L53
146,430
akamai/AkamaiOPEN-edgegrid-golang
jsonhooks-v1/jsonhooks.go
ImplementsPostJSONUnmarshaler
func ImplementsPostJSONUnmarshaler(v interface{}) bool { value := reflect.ValueOf(v) if value.Kind() == reflect.Ptr && value.IsNil() { return false } _, ok := value.Interface().(PostJSONUnmarshaler) return ok }
go
func ImplementsPostJSONUnmarshaler(v interface{}) bool { value := reflect.ValueOf(v) if value.Kind() == reflect.Ptr && value.IsNil() { return false } _, ok := value.Interface().(PostJSONUnmarshaler) return ok }
[ "func", "ImplementsPostJSONUnmarshaler", "(", "v", "interface", "{", "}", ")", "bool", "{", "value", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n", "if", "value", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "&&", "value", ".", "IsNil", ...
// ImplementsPostJSONUnmarshaler checks for support for the PostUnmarshalJSON post-hook
[ "ImplementsPostJSONUnmarshaler", "checks", "for", "support", "for", "the", "PostUnmarshalJSON", "post", "-", "hook" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/jsonhooks-v1/jsonhooks.go#L61-L69
146,431
akamai/AkamaiOPEN-edgegrid-golang
client-v1/client.go
NewRequest
func NewRequest(config edgegrid.Config, method, path string, body io.Reader) (*http.Request, error) { var ( baseURL *url.URL err error ) if strings.HasPrefix(config.Host, "https://") { baseURL, err = url.Parse(config.Host) } else { baseURL, err = url.Parse("https://" + config.Host) } if err != nil {...
go
func NewRequest(config edgegrid.Config, method, path string, body io.Reader) (*http.Request, error) { var ( baseURL *url.URL err error ) if strings.HasPrefix(config.Host, "https://") { baseURL, err = url.Parse(config.Host) } else { baseURL, err = url.Parse("https://" + config.Host) } if err != nil {...
[ "func", "NewRequest", "(", "config", "edgegrid", ".", "Config", ",", "method", ",", "path", "string", ",", "body", "io", ".", "Reader", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "var", "(", "baseURL", "*", "url", ".", "URL", "\...
// NewRequest creates an HTTP request that can be sent to Akamai APIs. A relative URL can be provided in path, which will be resolved to the // Host specified in Config. If body is specified, it will be sent as the request body.
[ "NewRequest", "creates", "an", "HTTP", "request", "that", "can", "be", "sent", "to", "Akamai", "APIs", ".", "A", "relative", "URL", "can", "be", "provided", "in", "path", "which", "will", "be", "resolved", "to", "the", "Host", "specified", "in", "Config", ...
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/client-v1/client.go#L31-L62
146,432
akamai/AkamaiOPEN-edgegrid-golang
client-v1/client.go
NewMultiPartFormDataRequest
func NewMultiPartFormDataRequest(config edgegrid.Config, uriPath, filePath string, otherFormParams map[string]string) (*http.Request, error) { file, err := os.Open(filePath) if err != nil { return nil, err } defer file.Close() body := &bytes.Buffer{} writer := multipart.NewWriter(body) // TODO: make this fiel...
go
func NewMultiPartFormDataRequest(config edgegrid.Config, uriPath, filePath string, otherFormParams map[string]string) (*http.Request, error) { file, err := os.Open(filePath) if err != nil { return nil, err } defer file.Close() body := &bytes.Buffer{} writer := multipart.NewWriter(body) // TODO: make this fiel...
[ "func", "NewMultiPartFormDataRequest", "(", "config", "edgegrid", ".", "Config", ",", "uriPath", ",", "filePath", "string", ",", "otherFormParams", "map", "[", "string", "]", "string", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "file", ...
// NewMultiPartFormDataRequest creates an HTTP request that uploads a file to the Akamai API
[ "NewMultiPartFormDataRequest", "creates", "an", "HTTP", "request", "that", "uploads", "a", "file", "to", "the", "Akamai", "API" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/client-v1/client.go#L93-L120
146,433
akamai/AkamaiOPEN-edgegrid-golang
client-v1/client.go
Do
func Do(config edgegrid.Config, req *http.Request) (*http.Response, error) { Client.CheckRedirect = func(req *http.Request, via []*http.Request) error { req = edgegrid.AddRequestHeader(config, req) return nil } req = edgegrid.AddRequestHeader(config, req) res, err := Client.Do(req) if err != nil { return ni...
go
func Do(config edgegrid.Config, req *http.Request) (*http.Response, error) { Client.CheckRedirect = func(req *http.Request, via []*http.Request) error { req = edgegrid.AddRequestHeader(config, req) return nil } req = edgegrid.AddRequestHeader(config, req) res, err := Client.Do(req) if err != nil { return ni...
[ "func", "Do", "(", "config", "edgegrid", ".", "Config", ",", "req", "*", "http", ".", "Request", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "Client", ".", "CheckRedirect", "=", "func", "(", "req", "*", "http", ".", "Request", "...
// Do performs a given HTTP Request, signed with the Akamai OPEN Edgegrid // Authorization header. An edgegrid.Response or an error is returned.
[ "Do", "performs", "a", "given", "HTTP", "Request", "signed", "with", "the", "Akamai", "OPEN", "Edgegrid", "Authorization", "header", ".", "An", "edgegrid", ".", "Response", "or", "an", "error", "is", "returned", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/client-v1/client.go#L124-L137
146,434
akamai/AkamaiOPEN-edgegrid-golang
client-v1/client.go
BodyJSON
func BodyJSON(r *http.Response, data interface{}) error { if data == nil { return errors.New("You must pass in an interface{}") } body, err := ioutil.ReadAll(r.Body) if err != nil { return err } err = jsonhooks.Unmarshal(body, data) return err }
go
func BodyJSON(r *http.Response, data interface{}) error { if data == nil { return errors.New("You must pass in an interface{}") } body, err := ioutil.ReadAll(r.Body) if err != nil { return err } err = jsonhooks.Unmarshal(body, data) return err }
[ "func", "BodyJSON", "(", "r", "*", "http", ".", "Response", ",", "data", "interface", "{", "}", ")", "error", "{", "if", "data", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "body", ",", "err", ":=", ...
// BodyJSON unmarshals the Response.Body into a given data structure
[ "BodyJSON", "unmarshals", "the", "Response", ".", "Body", "into", "a", "given", "data", "structure" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/client-v1/client.go#L140-L152
146,435
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/groups.go
AddGroup
func (groups *Groups) AddGroup(newGroup *Group) { if newGroup.GroupID != "" { for key, group := range groups.Groups.Items { if group.GroupID == newGroup.GroupID { groups.Groups.Items[key] = newGroup return } } } newGroup.parent = groups groups.Groups.Items = append(groups.Groups.Items, newGroup)...
go
func (groups *Groups) AddGroup(newGroup *Group) { if newGroup.GroupID != "" { for key, group := range groups.Groups.Items { if group.GroupID == newGroup.GroupID { groups.Groups.Items[key] = newGroup return } } } newGroup.parent = groups groups.Groups.Items = append(groups.Groups.Items, newGroup)...
[ "func", "(", "groups", "*", "Groups", ")", "AddGroup", "(", "newGroup", "*", "Group", ")", "{", "if", "newGroup", ".", "GroupID", "!=", "\"", "\"", "{", "for", "key", ",", "group", ":=", "range", "groups", ".", "Groups", ".", "Items", "{", "if", "g...
// AddGroup adds a group to a Groups collection
[ "AddGroup", "adds", "a", "group", "to", "a", "Groups", "collection" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/groups.go#L74-L87
146,436
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/groups.go
FindGroup
func (groups *Groups) FindGroup(id string) (*Group, error) { var group *Group var groupFound bool if id == "" { goto err } for _, group = range groups.Groups.Items { if group.GroupID == id { groupFound = true break } } err: if !groupFound { return nil, fmt.Errorf("Unable to find group: \"%s\"", ...
go
func (groups *Groups) FindGroup(id string) (*Group, error) { var group *Group var groupFound bool if id == "" { goto err } for _, group = range groups.Groups.Items { if group.GroupID == id { groupFound = true break } } err: if !groupFound { return nil, fmt.Errorf("Unable to find group: \"%s\"", ...
[ "func", "(", "groups", "*", "Groups", ")", "FindGroup", "(", "id", "string", ")", "(", "*", "Group", ",", "error", ")", "{", "var", "group", "*", "Group", "\n", "var", "groupFound", "bool", "\n\n", "if", "id", "==", "\"", "\"", "{", "goto", "err", ...
// FindGroup finds a specific group by ID
[ "FindGroup", "finds", "a", "specific", "group", "by", "ID" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/groups.go#L90-L111
146,437
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/groups.go
NewGroup
func NewGroup(parent *Groups) *Group { group := &Group{ parent: parent, } group.Init() return group }
go
func NewGroup(parent *Groups) *Group { group := &Group{ parent: parent, } group.Init() return group }
[ "func", "NewGroup", "(", "parent", "*", "Groups", ")", "*", "Group", "{", "group", ":=", "&", "Group", "{", "parent", ":", "parent", ",", "}", "\n", "group", ".", "Init", "(", ")", "\n", "return", "group", "\n", "}" ]
// NewGroup creates a new Group
[ "NewGroup", "creates", "a", "new", "Group" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/groups.go#L124-L130
146,438
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/groups.go
GetGroup
func (group *Group) GetGroup() { groups, err := GetGroups() if err != nil { return } for _, g := range groups.Groups.Items { if g.GroupID == group.GroupID { group.parent = groups group.ContractIDs = g.ContractIDs group.GroupName = g.GroupName group.ParentGroupID = g.ParentGroupID group.Complete ...
go
func (group *Group) GetGroup() { groups, err := GetGroups() if err != nil { return } for _, g := range groups.Groups.Items { if g.GroupID == group.GroupID { group.parent = groups group.ContractIDs = g.ContractIDs group.GroupName = g.GroupName group.ParentGroupID = g.ParentGroupID group.Complete ...
[ "func", "(", "group", "*", "Group", ")", "GetGroup", "(", ")", "{", "groups", ",", "err", ":=", "GetGroups", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "for", "_", ",", "g", ":=", "range", "groups", ".", "Groups",...
// GetGroup populates a Group
[ "GetGroup", "populates", "a", "Group" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/groups.go#L133-L151
146,439
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/groups.go
GetProperties
func (group *Group) GetProperties(contract *Contract) (*Properties, error) { return GetProperties(contract, group) }
go
func (group *Group) GetProperties(contract *Contract) (*Properties, error) { return GetProperties(contract, group) }
[ "func", "(", "group", "*", "Group", ")", "GetProperties", "(", "contract", "*", "Contract", ")", "(", "*", "Properties", ",", "error", ")", "{", "return", "GetProperties", "(", "contract", ",", "group", ")", "\n", "}" ]
// GetProperties retrieves all properties associated with a given group and contract
[ "GetProperties", "retrieves", "all", "properties", "associated", "with", "a", "given", "group", "and", "contract" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/groups.go#L154-L156
146,440
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/groups.go
GetCpCodes
func (group *Group) GetCpCodes(contract *Contract) (*CpCodes, error) { return GetCpCodes(contract, group) }
go
func (group *Group) GetCpCodes(contract *Contract) (*CpCodes, error) { return GetCpCodes(contract, group) }
[ "func", "(", "group", "*", "Group", ")", "GetCpCodes", "(", "contract", "*", "Contract", ")", "(", "*", "CpCodes", ",", "error", ")", "{", "return", "GetCpCodes", "(", "contract", ",", "group", ")", "\n", "}" ]
// GetCpCodes retrieves all CP codes associated with a given group and contract
[ "GetCpCodes", "retrieves", "all", "CP", "codes", "associated", "with", "a", "given", "group", "and", "contract" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/groups.go#L159-L161
146,441
giantswarm/mayu
client/client.go
New
func New(scheme, host string, port uint16) (*Client, error) { client := &Client{ Scheme: scheme, Host: host, Port: port, } return client, nil }
go
func New(scheme, host string, port uint16) (*Client, error) { client := &Client{ Scheme: scheme, Host: host, Port: port, } return client, nil }
[ "func", "New", "(", "scheme", ",", "host", "string", ",", "port", "uint16", ")", "(", "*", "Client", ",", "error", ")", "{", "client", ":=", "&", "Client", "{", "Scheme", ":", "scheme", ",", "Host", ":", "host", ",", "Port", ":", "port", ",", "}"...
// New creates a new configured client to interact with mayu over its network // API.
[ "New", "creates", "a", "new", "configured", "client", "to", "interact", "with", "mayu", "over", "its", "network", "API", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/client/client.go#L33-L41
146,442
giantswarm/mayu
client/client.go
SetProviderId
func (c *Client) SetProviderId(serial, value string) error { data, err := json.Marshal(hostmgr.Host{ ProviderId: value, }) if err != nil { return microerror.Mask(err) } resp, err := httputil.Put(fmt.Sprintf("%s://%s:%d/admin/host/%s/set_provider_id", c.Scheme, c.Host, c.Port, serial), contentType, bytes.NewBu...
go
func (c *Client) SetProviderId(serial, value string) error { data, err := json.Marshal(hostmgr.Host{ ProviderId: value, }) if err != nil { return microerror.Mask(err) } resp, err := httputil.Put(fmt.Sprintf("%s://%s:%d/admin/host/%s/set_provider_id", c.Scheme, c.Host, c.Port, serial), contentType, bytes.NewBu...
[ "func", "(", "c", "*", "Client", ")", "SetProviderId", "(", "serial", ",", "value", "string", ")", "error", "{", "data", ",", "err", ":=", "json", ".", "Marshal", "(", "hostmgr", ".", "Host", "{", "ProviderId", ":", "value", ",", "}", ")", "\n", "i...
// SetProviderId sets the provider ID given by value for a node given by serial.
[ "SetProviderId", "sets", "the", "provider", "ID", "given", "by", "value", "for", "a", "node", "given", "by", "serial", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/client/client.go#L59-L78
146,443
giantswarm/mayu
client/client.go
List
func (c *Client) List() ([]hostmgr.Host, error) { list := []hostmgr.Host{} resp, err := http.Get(fmt.Sprintf("%s://%s:%d/admin/hosts", c.Scheme, c.Host, c.Port)) if err != nil { return list, microerror.Mask(err) } defer resp.Body.Close() if resp.StatusCode > 399 { return nil, microerror.Mask(fmt.Errorf("inv...
go
func (c *Client) List() ([]hostmgr.Host, error) { list := []hostmgr.Host{} resp, err := http.Get(fmt.Sprintf("%s://%s:%d/admin/hosts", c.Scheme, c.Host, c.Port)) if err != nil { return list, microerror.Mask(err) } defer resp.Body.Close() if resp.StatusCode > 399 { return nil, microerror.Mask(fmt.Errorf("inv...
[ "func", "(", "c", "*", "Client", ")", "List", "(", ")", "(", "[", "]", "hostmgr", ".", "Host", ",", "error", ")", "{", "list", ":=", "[", "]", "hostmgr", ".", "Host", "{", "}", "\n\n", "resp", ",", "err", ":=", "http", ".", "Get", "(", "fmt",...
// List fetches a list of node information within the current cluster.
[ "List", "fetches", "a", "list", "of", "node", "information", "within", "the", "current", "cluster", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/client/client.go#L174-L197
146,444
giantswarm/mayu
client/client.go
Status
func (c *Client) Status(serial string) (hostmgr.Host, error) { var host hostmgr.Host resp, err := http.Get(fmt.Sprintf("%s://%s:%d/admin/hosts", c.Scheme, c.Host, c.Port)) if err != nil { return host, microerror.Mask(err) } defer resp.Body.Close() if resp.StatusCode > 399 { return host, microerror.Mask(fmt.E...
go
func (c *Client) Status(serial string) (hostmgr.Host, error) { var host hostmgr.Host resp, err := http.Get(fmt.Sprintf("%s://%s:%d/admin/hosts", c.Scheme, c.Host, c.Port)) if err != nil { return host, microerror.Mask(err) } defer resp.Body.Close() if resp.StatusCode > 399 { return host, microerror.Mask(fmt.E...
[ "func", "(", "c", "*", "Client", ")", "Status", "(", "serial", "string", ")", "(", "hostmgr", ".", "Host", ",", "error", ")", "{", "var", "host", "hostmgr", ".", "Host", "\n\n", "resp", ",", "err", ":=", "http", ".", "Get", "(", "fmt", ".", "Spri...
// Status fetches status information for a node given by serial.
[ "Status", "fetches", "status", "information", "for", "a", "node", "given", "by", "serial", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/client/client.go#L200-L230
146,445
giantswarm/mayu
pxemgr/iputil.go
ipLessThanOrEqual
func ipLessThanOrEqual(ip net.IP, upperBound net.IP) bool { if ip[3] < upperBound[3] { return true } if ip[2] < upperBound[2] { return true } if ip[1] < upperBound[1] { return true } if ip[0] <= upperBound[0] { return true } return false }
go
func ipLessThanOrEqual(ip net.IP, upperBound net.IP) bool { if ip[3] < upperBound[3] { return true } if ip[2] < upperBound[2] { return true } if ip[1] < upperBound[1] { return true } if ip[0] <= upperBound[0] { return true } return false }
[ "func", "ipLessThanOrEqual", "(", "ip", "net", ".", "IP", ",", "upperBound", "net", ".", "IP", ")", "bool", "{", "if", "ip", "[", "3", "]", "<", "upperBound", "[", "3", "]", "{", "return", "true", "\n", "}", "\n", "if", "ip", "[", "2", "]", "<"...
// ip less or equal
[ "ip", "less", "or", "equal" ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/pxemgr/iputil.go#L18-L33
146,446
giantswarm/mayu
fs/fake.go
NewFakeFilesystemWithFiles
func NewFakeFilesystemWithFiles(fs []FakeFile) FakeFilesystem { fileMap := make(map[string]FakeFile) for _, f := range fs { fileMap[f.Name] = f } return FakeFilesystem{files: fileMap} }
go
func NewFakeFilesystemWithFiles(fs []FakeFile) FakeFilesystem { fileMap := make(map[string]FakeFile) for _, f := range fs { fileMap[f.Name] = f } return FakeFilesystem{files: fileMap} }
[ "func", "NewFakeFilesystemWithFiles", "(", "fs", "[", "]", "FakeFile", ")", "FakeFilesystem", "{", "fileMap", ":=", "make", "(", "map", "[", "string", "]", "FakeFile", ")", "\n", "for", "_", ",", "f", ":=", "range", "fs", "{", "fileMap", "[", "f", ".",...
// NewFakeFilesystemWithFiles creates a new FakeFilesystem // instance bundled with a list of FakeFile instances that // can be passed.
[ "NewFakeFilesystemWithFiles", "creates", "a", "new", "FakeFilesystem", "instance", "bundled", "with", "a", "list", "of", "FakeFile", "instances", "that", "can", "be", "passed", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/fs/fake.go#L25-L32
146,447
giantswarm/mayu
fs/fake.go
NewFakeFile
func NewFakeFile(name, content string) FakeFile { return FakeFile{ Name: name, Mode: os.FileMode(0777), ModTime: time.Now(), Buffer: bytes.NewReader([]byte(content)), } }
go
func NewFakeFile(name, content string) FakeFile { return FakeFile{ Name: name, Mode: os.FileMode(0777), ModTime: time.Now(), Buffer: bytes.NewReader([]byte(content)), } }
[ "func", "NewFakeFile", "(", "name", ",", "content", "string", ")", "FakeFile", "{", "return", "FakeFile", "{", "Name", ":", "name", ",", "Mode", ":", "os", ".", "FileMode", "(", "0777", ")", ",", "ModTime", ":", "time", ".", "Now", "(", ")", ",", "...
// NewFakeFile creates a new FakeFile instances based on a file name // and it's contents from strings. The content of the new instance will // be stored in an internal bytes.Reader instance. The default file mode // will be 0777 and the last modification time the moment when the // function is called.
[ "NewFakeFile", "creates", "a", "new", "FakeFile", "instances", "based", "on", "a", "file", "name", "and", "it", "s", "contents", "from", "strings", ".", "The", "content", "of", "the", "new", "instance", "will", "be", "stored", "in", "an", "internal", "byte...
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/fs/fake.go#L75-L82
146,448
giantswarm/mayu
fs/fake.go
Read
func (f FakeFile) Read(p []byte) (n int, err error) { return f.Buffer.Read(p) }
go
func (f FakeFile) Read(p []byte) (n int, err error) { return f.Buffer.Read(p) }
[ "func", "(", "f", "FakeFile", ")", "Read", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "f", ".", "Buffer", ".", "Read", "(", "p", ")", "\n", "}" ]
// Read wraps io.Reader's functionality around the internal // bytes.Reader instance.
[ "Read", "wraps", "io", ".", "Reader", "s", "functionality", "around", "the", "internal", "bytes", ".", "Reader", "instance", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/fs/fake.go#L91-L93
146,449
giantswarm/mayu
fs/fake.go
ReadAt
func (f FakeFile) ReadAt(p []byte, off int64) (n int, err error) { return f.Buffer.ReadAt(p, off) }
go
func (f FakeFile) ReadAt(p []byte, off int64) (n int, err error) { return f.Buffer.ReadAt(p, off) }
[ "func", "(", "f", "FakeFile", ")", "ReadAt", "(", "p", "[", "]", "byte", ",", "off", "int64", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "f", ".", "Buffer", ".", "ReadAt", "(", "p", ",", "off", ")", "\n", "}" ]
// ReadAt wraps io.ReaderAt's functionality around the internalt // bytes.Reader instance.
[ "ReadAt", "wraps", "io", ".", "ReaderAt", "s", "functionality", "around", "the", "internalt", "bytes", ".", "Reader", "instance", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/fs/fake.go#L97-L99
146,450
giantswarm/mayu
fs/fake.go
Seek
func (f FakeFile) Seek(offset int64, whence int) (int64, error) { return f.Buffer.Seek(offset, whence) }
go
func (f FakeFile) Seek(offset int64, whence int) (int64, error) { return f.Buffer.Seek(offset, whence) }
[ "func", "(", "f", "FakeFile", ")", "Seek", "(", "offset", "int64", ",", "whence", "int", ")", "(", "int64", ",", "error", ")", "{", "return", "f", ".", "Buffer", ".", "Seek", "(", "offset", ",", "whence", ")", "\n", "}" ]
// Seek wraps io.Seeker's functionality around the internalt // bytes.Reader instance.
[ "Seek", "wraps", "io", ".", "Seeker", "s", "functionality", "around", "the", "internalt", "bytes", ".", "Reader", "instance", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/fs/fake.go#L103-L105
146,451
giantswarm/mayu
fs/fake.go
Stat
func (f FakeFile) Stat() (os.FileInfo, error) { return FakeFileInfo{File: f}, nil }
go
func (f FakeFile) Stat() (os.FileInfo, error) { return FakeFileInfo{File: f}, nil }
[ "func", "(", "f", "FakeFile", ")", "Stat", "(", ")", "(", "os", ".", "FileInfo", ",", "error", ")", "{", "return", "FakeFileInfo", "{", "File", ":", "f", "}", ",", "nil", "\n", "}" ]
// Stat returns the FakeFileInfo structure describing the FakeFile // instance.
[ "Stat", "returns", "the", "FakeFileInfo", "structure", "describing", "the", "FakeFile", "instance", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/fs/fake.go#L109-L111
146,452
giantswarm/mayu
flag.go
ValidateHTTPCertificateUsage
func (g MayuFlags) ValidateHTTPCertificateUsage() (bool, error) { if g.noTLS { return true, nil } if !g.noTLS && g.tlsCertFile != "" && g.tlsKeyFile != "" { return true, nil } return false, ErrNotAllCertFilesProvided }
go
func (g MayuFlags) ValidateHTTPCertificateUsage() (bool, error) { if g.noTLS { return true, nil } if !g.noTLS && g.tlsCertFile != "" && g.tlsKeyFile != "" { return true, nil } return false, ErrNotAllCertFilesProvided }
[ "func", "(", "g", "MayuFlags", ")", "ValidateHTTPCertificateUsage", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "g", ".", "noTLS", "{", "return", "true", ",", "nil", "\n", "}", "\n\n", "if", "!", "g", ".", "noTLS", "&&", "g", ".", "tlsCert...
// ValidateHTTPCertificateUsage checks if the fields HTTPSCertFile and HTTPSKeyFile // of the configuration struct are set whenever the NoTLS is set to false. // This makes sure that users are configuring the needed certificate files when // using TLS encrypted connections.
[ "ValidateHTTPCertificateUsage", "checks", "if", "the", "fields", "HTTPSCertFile", "and", "HTTPSKeyFile", "of", "the", "configuration", "struct", "are", "set", "whenever", "the", "NoTLS", "is", "set", "to", "false", ".", "This", "makes", "sure", "that", "users", ...
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/flag.go#L96-L106
146,453
giantswarm/mayu
flag.go
ValidateHTTPCertificateFileExistance
func (g MayuFlags) ValidateHTTPCertificateFileExistance() (bool, error) { if g.noTLS { return true, nil } if _, err := g.filesystem.Stat(g.tlsCertFile); err != nil { return false, ErrHTTPSCertFileNotRedable } if _, err := g.filesystem.Stat(g.tlsKeyFile); err != nil { return false, ErrHTTPSKeyFileNotReadabl...
go
func (g MayuFlags) ValidateHTTPCertificateFileExistance() (bool, error) { if g.noTLS { return true, nil } if _, err := g.filesystem.Stat(g.tlsCertFile); err != nil { return false, ErrHTTPSCertFileNotRedable } if _, err := g.filesystem.Stat(g.tlsKeyFile); err != nil { return false, ErrHTTPSKeyFileNotReadabl...
[ "func", "(", "g", "MayuFlags", ")", "ValidateHTTPCertificateFileExistance", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "g", ".", "noTLS", "{", "return", "true", ",", "nil", "\n", "}", "\n\n", "if", "_", ",", "err", ":=", "g", ".", "filesyst...
// ValidateHTTPCertificateFileExistance checks if the filenames configured // in the fields HTTPSCertFile and HTTPSKeyFile can be stat'ed to make sure // they actually exist.
[ "ValidateHTTPCertificateFileExistance", "checks", "if", "the", "filenames", "configured", "in", "the", "fields", "HTTPSCertFile", "and", "HTTPSKeyFile", "can", "be", "stat", "ed", "to", "make", "sure", "they", "actually", "exist", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/flag.go#L111-L125
146,454
giantswarm/mayu
hostmgr/host.go
Commit
func (h *Host) Commit(msg string) error { h.save() return h.maybeGitCommit(h.Serial + ": " + msg) }
go
func (h *Host) Commit(msg string) error { h.save() return h.maybeGitCommit(h.Serial + ": " + msg) }
[ "func", "(", "h", "*", "Host", ")", "Commit", "(", "msg", "string", ")", "error", "{", "h", ".", "save", "(", ")", "\n", "return", "h", ".", "maybeGitCommit", "(", "h", ".", "Serial", "+", "\"", "\"", "+", "msg", ")", "\n", "}" ]
// Commit stores the given msg in git version control.
[ "Commit", "stores", "the", "given", "msg", "in", "git", "version", "control", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/hostmgr/host.go#L51-L54
146,455
giantswarm/mayu
hostmgr/host.go
HostFromDir
func HostFromDir(hostdir string) (*Host, error) { confPath := path.Join(hostdir, hostConfFile) h := &Host{} err := loadJson(h, confPath) if err != nil { return nil, microerror.Mask(err) } h.hostDir, err = os.Open(hostdir) if err != nil { return nil, microerror.Mask(err) } fi, err := os.Stat(confPath) i...
go
func HostFromDir(hostdir string) (*Host, error) { confPath := path.Join(hostdir, hostConfFile) h := &Host{} err := loadJson(h, confPath) if err != nil { return nil, microerror.Mask(err) } h.hostDir, err = os.Open(hostdir) if err != nil { return nil, microerror.Mask(err) } fi, err := os.Stat(confPath) i...
[ "func", "HostFromDir", "(", "hostdir", "string", ")", "(", "*", "Host", ",", "error", ")", "{", "confPath", ":=", "path", ".", "Join", "(", "hostdir", ",", "hostConfFile", ")", "\n\n", "h", ":=", "&", "Host", "{", "}", "\n", "err", ":=", "loadJson", ...
// HostFromDir takes a path to a host directory within the cluster directory // and loads the found configuration. Then the corresponding Host is returned.
[ "HostFromDir", "takes", "a", "path", "to", "a", "host", "directory", "within", "the", "cluster", "directory", "and", "loads", "the", "found", "configuration", ".", "Then", "the", "corresponding", "Host", "is", "returned", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/hostmgr/host.go#L67-L88
146,456
giantswarm/mayu
pxemgr/ignition.go
hasUnrecognizedKeys
func hasUnrecognizedKeys(inCfg interface{}, refType reflect.Type) (warnings bool) { if refType.Kind() == reflect.Ptr { refType = refType.Elem() } switch inCfg.(type) { case map[interface{}]interface{}: ks := inCfg.(map[interface{}]interface{}) keys: for key := range ks { for i := 0; i < refType.NumField()...
go
func hasUnrecognizedKeys(inCfg interface{}, refType reflect.Type) (warnings bool) { if refType.Kind() == reflect.Ptr { refType = refType.Elem() } switch inCfg.(type) { case map[interface{}]interface{}: ks := inCfg.(map[interface{}]interface{}) keys: for key := range ks { for i := 0; i < refType.NumField()...
[ "func", "hasUnrecognizedKeys", "(", "inCfg", "interface", "{", "}", ",", "refType", "reflect", ".", "Type", ")", "(", "warnings", "bool", ")", "{", "if", "refType", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "refType", "=", "refType", "."...
// hasUnrecognizedKeys finds unrecognized keys and warns about them on stderr. // returns false when no unrecognized keys were found, true otherwise.
[ "hasUnrecognizedKeys", "finds", "unrecognized", "keys", "and", "warns", "about", "them", "on", "stderr", ".", "returns", "false", "when", "no", "unrecognized", "keys", "were", "found", "true", "otherwise", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/pxemgr/ignition.go#L142-L175
146,457
giantswarm/mayu
hostmgr/cluster.go
NewCluster
func NewCluster(baseDir string, gitStore bool, logger micrologger.Logger) (*Cluster, error) { if !fileExists(baseDir) { err := os.Mkdir(baseDir, 0755) if err != nil { return nil, microerror.Mask(err) } } if gitStore && !isGitRepo(baseDir) { err := gitInit(baseDir) if err != nil { return nil, microer...
go
func NewCluster(baseDir string, gitStore bool, logger micrologger.Logger) (*Cluster, error) { if !fileExists(baseDir) { err := os.Mkdir(baseDir, 0755) if err != nil { return nil, microerror.Mask(err) } } if gitStore && !isGitRepo(baseDir) { err := gitInit(baseDir) if err != nil { return nil, microer...
[ "func", "NewCluster", "(", "baseDir", "string", ",", "gitStore", "bool", ",", "logger", "micrologger", ".", "Logger", ")", "(", "*", "Cluster", ",", "error", ")", "{", "if", "!", "fileExists", "(", "baseDir", ")", "{", "err", ":=", "os", ".", "Mkdir", ...
// NewCluster creates a new cluster based on the cluster directory. gitStore // defines whether cluster changes should be tracked using version control or // not.
[ "NewCluster", "creates", "a", "new", "cluster", "based", "on", "the", "cluster", "directory", ".", "gitStore", "defines", "whether", "cluster", "changes", "should", "be", "tracked", "using", "version", "control", "or", "not", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/hostmgr/cluster.go#L78-L108
146,458
giantswarm/mayu
hostmgr/cluster.go
CreateNewHost
func (c *Cluster) CreateNewHost(serial string) (*Host, error) { serial = strings.ToLower(serial) hostDir := path.Join(c.baseDir, strings.ToLower(serial)) newHost, err := createHost(serial, hostDir) if err != nil { return nil, microerror.Mask(err) } if predef, exists := c.predefinedVals[serial]; exists { c.lo...
go
func (c *Cluster) CreateNewHost(serial string) (*Host, error) { serial = strings.ToLower(serial) hostDir := path.Join(c.baseDir, strings.ToLower(serial)) newHost, err := createHost(serial, hostDir) if err != nil { return nil, microerror.Mask(err) } if predef, exists := c.predefinedVals[serial]; exists { c.lo...
[ "func", "(", "c", "*", "Cluster", ")", "CreateNewHost", "(", "serial", "string", ")", "(", "*", "Host", ",", "error", ")", "{", "serial", "=", "strings", ".", "ToLower", "(", "serial", ")", "\n", "hostDir", ":=", "path", ".", "Join", "(", "c", ".",...
// CreateNewHost creates a new host with the given serial.
[ "CreateNewHost", "creates", "a", "new", "host", "with", "the", "given", "serial", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/hostmgr/cluster.go#L111-L153
146,459
giantswarm/mayu
hostmgr/cluster.go
Update
func (c *Cluster) Update() error { c.mu.Lock() defer c.mu.Unlock() if err := c.cacheHosts(); err != nil { return microerror.Mask(err) } err := c.reindex() if err != nil { return microerror.Mask(err) } return nil }
go
func (c *Cluster) Update() error { c.mu.Lock() defer c.mu.Unlock() if err := c.cacheHosts(); err != nil { return microerror.Mask(err) } err := c.reindex() if err != nil { return microerror.Mask(err) } return nil }
[ "func", "(", "c", "*", "Cluster", ")", "Update", "(", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "err", ":=", "c", ".", "cacheHosts", "(", ")", ";", "err", "...
// Update refreshs the internal host cache based on information within the // cluster directory.
[ "Update", "refreshs", "the", "internal", "host", "cache", "based", "on", "information", "within", "the", "cluster", "directory", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/hostmgr/cluster.go#L168-L180
146,460
giantswarm/mayu
hostmgr/cluster.go
HostWithMacAddress
func (c *Cluster) HostWithMacAddress(macAddr string) (*Host, bool) { if err := c.Update(); err != nil { c.logger.Log("level", "error", "message", "error getting the mac address using the internal cache", "stack", err) return nil, false } c.mu.Lock() defer c.mu.Unlock() if cached, exists := c.hostByMacAddr[str...
go
func (c *Cluster) HostWithMacAddress(macAddr string) (*Host, bool) { if err := c.Update(); err != nil { c.logger.Log("level", "error", "message", "error getting the mac address using the internal cache", "stack", err) return nil, false } c.mu.Lock() defer c.mu.Unlock() if cached, exists := c.hostByMacAddr[str...
[ "func", "(", "c", "*", "Cluster", ")", "HostWithMacAddress", "(", "macAddr", "string", ")", "(", "*", "Host", ",", "bool", ")", "{", "if", "err", ":=", "c", ".", "Update", "(", ")", ";", "err", "!=", "nil", "{", "c", ".", "logger", ".", "Log", ...
// HostWithMacAddress returns the host object given by macAddr based on the // internal cache. In case the host could not be found, host is nil and false // is returned as second return value.
[ "HostWithMacAddress", "returns", "the", "host", "object", "given", "by", "macAddr", "based", "on", "the", "internal", "cache", ".", "In", "case", "the", "host", "could", "not", "be", "found", "host", "is", "nil", "and", "false", "is", "returned", "as", "se...
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/hostmgr/cluster.go#L185-L198
146,461
giantswarm/mayu
hostmgr/cluster.go
HostWithInternalAddr
func (c *Cluster) HostWithInternalAddr(ipAddr net.IP) (*Host, bool) { if err := c.Update(); err != nil { c.logger.Log("level", "error", "message", "error getting the ip address using the internal cache", "stack", err) return nil, false } c.mu.Lock() defer c.mu.Unlock() if cached, exists := c.hostByInternalAdd...
go
func (c *Cluster) HostWithInternalAddr(ipAddr net.IP) (*Host, bool) { if err := c.Update(); err != nil { c.logger.Log("level", "error", "message", "error getting the ip address using the internal cache", "stack", err) return nil, false } c.mu.Lock() defer c.mu.Unlock() if cached, exists := c.hostByInternalAdd...
[ "func", "(", "c", "*", "Cluster", ")", "HostWithInternalAddr", "(", "ipAddr", "net", ".", "IP", ")", "(", "*", "Host", ",", "bool", ")", "{", "if", "err", ":=", "c", ".", "Update", "(", ")", ";", "err", "!=", "nil", "{", "c", ".", "logger", "."...
// HostWithInternalAddr returns the host object given by ipAddr based on the // internal cache. In case the host could not be found, host is nil and false // is returned as second return value.
[ "HostWithInternalAddr", "returns", "the", "host", "object", "given", "by", "ipAddr", "based", "on", "the", "internal", "cache", ".", "In", "case", "the", "host", "could", "not", "be", "found", "host", "is", "nil", "and", "false", "is", "returned", "as", "s...
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/hostmgr/cluster.go#L203-L216
146,462
giantswarm/mayu
hostmgr/cluster.go
HostWithSerial
func (c *Cluster) HostWithSerial(serial string) (*Host, bool) { if err := c.Update(); err != nil { c.logger.Log("level", "error", "message", "error getting the serial number using the internal cache", "stack", err) return nil, false } c.mu.Lock() defer c.mu.Unlock() if cached, exists := c.hostsCache[strings.T...
go
func (c *Cluster) HostWithSerial(serial string) (*Host, bool) { if err := c.Update(); err != nil { c.logger.Log("level", "error", "message", "error getting the serial number using the internal cache", "stack", err) return nil, false } c.mu.Lock() defer c.mu.Unlock() if cached, exists := c.hostsCache[strings.T...
[ "func", "(", "c", "*", "Cluster", ")", "HostWithSerial", "(", "serial", "string", ")", "(", "*", "Host", ",", "bool", ")", "{", "if", "err", ":=", "c", ".", "Update", "(", ")", ";", "err", "!=", "nil", "{", "c", ".", "logger", ".", "Log", "(", ...
// HostWithSerial returns the host object given by serial based on the internal // cache. In case the host could not be found, host is nil and false is // returned as second return value.
[ "HostWithSerial", "returns", "the", "host", "object", "given", "by", "serial", "based", "on", "the", "internal", "cache", ".", "In", "case", "the", "host", "could", "not", "be", "found", "host", "is", "nil", "and", "false", "is", "returned", "as", "second"...
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/hostmgr/cluster.go#L221-L234
146,463
giantswarm/mayu
hostmgr/cluster.go
GetAllHosts
func (c *Cluster) GetAllHosts() []*Host { hosts := make([]*Host, 0, len(c.hostsCache)) if err := c.Update(); err != nil { c.logger.Log("level", "error", "message", "error getting the list of hosts based on the internal cache: %#v", "stack", err) return hosts } for _, cachedHost := range c.hostsCache { hosts...
go
func (c *Cluster) GetAllHosts() []*Host { hosts := make([]*Host, 0, len(c.hostsCache)) if err := c.Update(); err != nil { c.logger.Log("level", "error", "message", "error getting the list of hosts based on the internal cache: %#v", "stack", err) return hosts } for _, cachedHost := range c.hostsCache { hosts...
[ "func", "(", "c", "*", "Cluster", ")", "GetAllHosts", "(", ")", "[", "]", "*", "Host", "{", "hosts", ":=", "make", "(", "[", "]", "*", "Host", ",", "0", ",", "len", "(", "c", ".", "hostsCache", ")", ")", "\n\n", "if", "err", ":=", "c", ".", ...
// GetAllHosts returns a list of all hosts based on the internal cache.
[ "GetAllHosts", "returns", "a", "list", "of", "all", "hosts", "based", "on", "the", "internal", "cache", "." ]
00428982411d0e1679e86e25287827b3a308a9e4
https://github.com/giantswarm/mayu/blob/00428982411d0e1679e86e25287827b3a308a9e4/hostmgr/cluster.go#L261-L273
146,464
fatih/color
color.go
New
func New(value ...Attribute) *Color { c := &Color{params: make([]Attribute, 0)} c.Add(value...) return c }
go
func New(value ...Attribute) *Color { c := &Color{params: make([]Attribute, 0)} c.Add(value...) return c }
[ "func", "New", "(", "value", "...", "Attribute", ")", "*", "Color", "{", "c", ":=", "&", "Color", "{", "params", ":", "make", "(", "[", "]", "Attribute", ",", "0", ")", "}", "\n", "c", ".", "Add", "(", "value", "...", ")", "\n", "return", "c", ...
// New returns a newly created color object.
[ "New", "returns", "a", "newly", "created", "color", "object", "." ]
3f9d52f7176a6927daacff70a3e8d1dc2025c53e
https://github.com/fatih/color/blob/3f9d52f7176a6927daacff70a3e8d1dc2025c53e/color.go#L110-L114
146,465
fatih/color
color.go
Set
func (c *Color) Set() *Color { if c.isNoColorSet() { return c } fmt.Fprintf(Output, c.format()) return c }
go
func (c *Color) Set() *Color { if c.isNoColorSet() { return c } fmt.Fprintf(Output, c.format()) return c }
[ "func", "(", "c", "*", "Color", ")", "Set", "(", ")", "*", "Color", "{", "if", "c", ".", "isNoColorSet", "(", ")", "{", "return", "c", "\n", "}", "\n\n", "fmt", ".", "Fprintf", "(", "Output", ",", "c", ".", "format", "(", ")", ")", "\n", "ret...
// Set sets the SGR sequence.
[ "Set", "sets", "the", "SGR", "sequence", "." ]
3f9d52f7176a6927daacff70a3e8d1dc2025c53e
https://github.com/fatih/color/blob/3f9d52f7176a6927daacff70a3e8d1dc2025c53e/color.go#L135-L142
146,466
fatih/color
color.go
Sprint
func (c *Color) Sprint(a ...interface{}) string { return c.wrap(fmt.Sprint(a...)) }
go
func (c *Color) Sprint(a ...interface{}) string { return c.wrap(fmt.Sprint(a...)) }
[ "func", "(", "c", "*", "Color", ")", "Sprint", "(", "a", "...", "interface", "{", "}", ")", "string", "{", "return", "c", ".", "wrap", "(", "fmt", ".", "Sprint", "(", "a", "...", ")", ")", "\n", "}" ]
// Sprint is just like Print, but returns a string instead of printing it.
[ "Sprint", "is", "just", "like", "Print", "but", "returns", "a", "string", "instead", "of", "printing", "it", "." ]
3f9d52f7176a6927daacff70a3e8d1dc2025c53e
https://github.com/fatih/color/blob/3f9d52f7176a6927daacff70a3e8d1dc2025c53e/color.go#L255-L257
146,467
fatih/color
color.go
Sprintln
func (c *Color) Sprintln(a ...interface{}) string { return c.wrap(fmt.Sprintln(a...)) }
go
func (c *Color) Sprintln(a ...interface{}) string { return c.wrap(fmt.Sprintln(a...)) }
[ "func", "(", "c", "*", "Color", ")", "Sprintln", "(", "a", "...", "interface", "{", "}", ")", "string", "{", "return", "c", ".", "wrap", "(", "fmt", ".", "Sprintln", "(", "a", "...", ")", ")", "\n", "}" ]
// Sprintln is just like Println, but returns a string instead of printing it.
[ "Sprintln", "is", "just", "like", "Println", "but", "returns", "a", "string", "instead", "of", "printing", "it", "." ]
3f9d52f7176a6927daacff70a3e8d1dc2025c53e
https://github.com/fatih/color/blob/3f9d52f7176a6927daacff70a3e8d1dc2025c53e/color.go#L260-L262
146,468
fatih/color
color.go
Sprintf
func (c *Color) Sprintf(format string, a ...interface{}) string { return c.wrap(fmt.Sprintf(format, a...)) }
go
func (c *Color) Sprintf(format string, a ...interface{}) string { return c.wrap(fmt.Sprintf(format, a...)) }
[ "func", "(", "c", "*", "Color", ")", "Sprintf", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "string", "{", "return", "c", ".", "wrap", "(", "fmt", ".", "Sprintf", "(", "format", ",", "a", "...", ")", ")", "\n", "}" ]
// Sprintf is just like Printf, but returns a string instead of printing it.
[ "Sprintf", "is", "just", "like", "Printf", "but", "returns", "a", "string", "instead", "of", "printing", "it", "." ]
3f9d52f7176a6927daacff70a3e8d1dc2025c53e
https://github.com/fatih/color/blob/3f9d52f7176a6927daacff70a3e8d1dc2025c53e/color.go#L265-L267
146,469
fatih/color
color.go
wrap
func (c *Color) wrap(s string) string { if c.isNoColorSet() { return s } return c.format() + s + c.unformat() }
go
func (c *Color) wrap(s string) string { if c.isNoColorSet() { return s } return c.format() + s + c.unformat() }
[ "func", "(", "c", "*", "Color", ")", "wrap", "(", "s", "string", ")", "string", "{", "if", "c", ".", "isNoColorSet", "(", ")", "{", "return", "s", "\n", "}", "\n\n", "return", "c", ".", "format", "(", ")", "+", "s", "+", "c", ".", "unformat", ...
// wrap wraps the s string with the colors attributes. The string is ready to // be printed.
[ "wrap", "wraps", "the", "s", "string", "with", "the", "colors", "attributes", ".", "The", "string", "is", "ready", "to", "be", "printed", "." ]
3f9d52f7176a6927daacff70a3e8d1dc2025c53e
https://github.com/fatih/color/blob/3f9d52f7176a6927daacff70a3e8d1dc2025c53e/color.go#L360-L366
146,470
fatih/color
color.go
Equals
func (c *Color) Equals(c2 *Color) bool { if len(c.params) != len(c2.params) { return false } for _, attr := range c.params { if !c2.attrExists(attr) { return false } } return true }
go
func (c *Color) Equals(c2 *Color) bool { if len(c.params) != len(c2.params) { return false } for _, attr := range c.params { if !c2.attrExists(attr) { return false } } return true }
[ "func", "(", "c", "*", "Color", ")", "Equals", "(", "c2", "*", "Color", ")", "bool", "{", "if", "len", "(", "c", ".", "params", ")", "!=", "len", "(", "c2", ".", "params", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "_", ",", "attr...
// Equals returns a boolean value indicating whether two colors are equal.
[ "Equals", "returns", "a", "boolean", "value", "indicating", "whether", "two", "colors", "are", "equal", "." ]
3f9d52f7176a6927daacff70a3e8d1dc2025c53e
https://github.com/fatih/color/blob/3f9d52f7176a6927daacff70a3e8d1dc2025c53e/color.go#L400-L412
146,471
BurntSushi/toml
decode.go
PrimitiveDecode
func PrimitiveDecode(primValue Primitive, v interface{}) error { md := MetaData{decoded: make(map[string]bool)} return md.unify(primValue.undecoded, rvalue(v)) }
go
func PrimitiveDecode(primValue Primitive, v interface{}) error { md := MetaData{decoded: make(map[string]bool)} return md.unify(primValue.undecoded, rvalue(v)) }
[ "func", "PrimitiveDecode", "(", "primValue", "Primitive", ",", "v", "interface", "{", "}", ")", "error", "{", "md", ":=", "MetaData", "{", "decoded", ":", "make", "(", "map", "[", "string", "]", "bool", ")", "}", "\n", "return", "md", ".", "unify", "...
// DEPRECATED! // // Use MetaData.PrimitiveDecode instead.
[ "DEPRECATED!", "Use", "MetaData", ".", "PrimitiveDecode", "instead", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/decode.go#L49-L52
146,472
BurntSushi/toml
decode.go
DecodeFile
func DecodeFile(fpath string, v interface{}) (MetaData, error) { bs, err := ioutil.ReadFile(fpath) if err != nil { return MetaData{}, err } return Decode(string(bs), v) }
go
func DecodeFile(fpath string, v interface{}) (MetaData, error) { bs, err := ioutil.ReadFile(fpath) if err != nil { return MetaData{}, err } return Decode(string(bs), v) }
[ "func", "DecodeFile", "(", "fpath", "string", ",", "v", "interface", "{", "}", ")", "(", "MetaData", ",", "error", ")", "{", "bs", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "fpath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "MetaD...
// DecodeFile is just like Decode, except it will automatically read the // contents of the file at `fpath` and decode it for you.
[ "DecodeFile", "is", "just", "like", "Decode", "except", "it", "will", "automatically", "read", "the", "contents", "of", "the", "file", "at", "fpath", "and", "decode", "it", "for", "you", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/decode.go#L128-L134
146,473
BurntSushi/toml
decode.go
DecodeReader
func DecodeReader(r io.Reader, v interface{}) (MetaData, error) { bs, err := ioutil.ReadAll(r) if err != nil { return MetaData{}, err } return Decode(string(bs), v) }
go
func DecodeReader(r io.Reader, v interface{}) (MetaData, error) { bs, err := ioutil.ReadAll(r) if err != nil { return MetaData{}, err } return Decode(string(bs), v) }
[ "func", "DecodeReader", "(", "r", "io", ".", "Reader", ",", "v", "interface", "{", "}", ")", "(", "MetaData", ",", "error", ")", "{", "bs", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// DecodeReader is just like Decode, except it will consume all bytes // from the reader and decode it for you.
[ "DecodeReader", "is", "just", "like", "Decode", "except", "it", "will", "consume", "all", "bytes", "from", "the", "reader", "and", "decode", "it", "for", "you", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/decode.go#L138-L144
146,474
BurntSushi/toml
decode.go
unify
func (md *MetaData) unify(data interface{}, rv reflect.Value) error { // Special case. Look for a `Primitive` value. if rv.Type() == reflect.TypeOf((*Primitive)(nil)).Elem() { // Save the undecoded data and the key context into the primitive // value. context := make(Key, len(md.context)) copy(context, md.co...
go
func (md *MetaData) unify(data interface{}, rv reflect.Value) error { // Special case. Look for a `Primitive` value. if rv.Type() == reflect.TypeOf((*Primitive)(nil)).Elem() { // Save the undecoded data and the key context into the primitive // value. context := make(Key, len(md.context)) copy(context, md.co...
[ "func", "(", "md", "*", "MetaData", ")", "unify", "(", "data", "interface", "{", "}", ",", "rv", "reflect", ".", "Value", ")", "error", "{", "// Special case. Look for a `Primitive` value.", "if", "rv", ".", "Type", "(", ")", "==", "reflect", ".", "TypeOf"...
// unify performs a sort of type unification based on the structure of `rv`, // which is the client representation. // // Any type mismatch produces an error. Finding a type that we don't know // how to handle produces an unsupported type error.
[ "unify", "performs", "a", "sort", "of", "type", "unification", "based", "on", "the", "structure", "of", "rv", "which", "is", "the", "client", "representation", ".", "Any", "type", "mismatch", "produces", "an", "error", ".", "Finding", "a", "type", "that", ...
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/decode.go#L151-L232
146,475
BurntSushi/toml
parse.go
numUnderscoresOK
func numUnderscoresOK(s string) bool { accept := false for _, r := range s { if r == '_' { if !accept { return false } accept = false continue } accept = true } return accept }
go
func numUnderscoresOK(s string) bool { accept := false for _, r := range s { if r == '_' { if !accept { return false } accept = false continue } accept = true } return accept }
[ "func", "numUnderscoresOK", "(", "s", "string", ")", "bool", "{", "accept", ":=", "false", "\n", "for", "_", ",", "r", ":=", "range", "s", "{", "if", "r", "==", "'_'", "{", "if", "!", "accept", "{", "return", "false", "\n", "}", "\n", "accept", "...
// numUnderscoresOK checks whether each underscore in s is surrounded by // characters that are not underscores.
[ "numUnderscoresOK", "checks", "whether", "each", "underscore", "in", "s", "is", "surrounded", "by", "characters", "that", "are", "not", "underscores", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/parse.go#L314-L327
146,476
BurntSushi/toml
parse.go
numPeriodsOK
func numPeriodsOK(s string) bool { period := false for _, r := range s { if period && !isDigit(r) { return false } period = r == '.' } return !period }
go
func numPeriodsOK(s string) bool { period := false for _, r := range s { if period && !isDigit(r) { return false } period = r == '.' } return !period }
[ "func", "numPeriodsOK", "(", "s", "string", ")", "bool", "{", "period", ":=", "false", "\n", "for", "_", ",", "r", ":=", "range", "s", "{", "if", "period", "&&", "!", "isDigit", "(", "r", ")", "{", "return", "false", "\n", "}", "\n", "period", "=...
// numPeriodsOK checks whether every period in s is followed by a digit.
[ "numPeriodsOK", "checks", "whether", "every", "period", "in", "s", "is", "followed", "by", "a", "digit", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/parse.go#L330-L339
146,477
BurntSushi/toml
parse.go
establishContext
func (p *parser) establishContext(key Key, array bool) { var ok bool // Always start at the top level and drill down for our context. hashContext := p.mapping keyContext := make(Key, 0) // We only need implicit hashes for key[0:-1] for _, k := range key[0 : len(key)-1] { _, ok = hashContext[k] keyContext = ...
go
func (p *parser) establishContext(key Key, array bool) { var ok bool // Always start at the top level and drill down for our context. hashContext := p.mapping keyContext := make(Key, 0) // We only need implicit hashes for key[0:-1] for _, k := range key[0 : len(key)-1] { _, ok = hashContext[k] keyContext = ...
[ "func", "(", "p", "*", "parser", ")", "establishContext", "(", "key", "Key", ",", "array", "bool", ")", "{", "var", "ok", "bool", "\n\n", "// Always start at the top level and drill down for our context.", "hashContext", ":=", "p", ".", "mapping", "\n", "keyContex...
// establishContext sets the current context of the parser, // where the context is either a hash or an array of hashes. Which one is // set depends on the value of the `array` parameter. // // Establishing the context also makes sure that the key isn't a duplicate, and // will create implicit hashes automatically.
[ "establishContext", "sets", "the", "current", "context", "of", "the", "parser", "where", "the", "context", "is", "either", "a", "hash", "or", "an", "array", "of", "hashes", ".", "Which", "one", "is", "set", "depends", "on", "the", "value", "of", "the", "...
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/parse.go#L347-L401
146,478
BurntSushi/toml
parse.go
setValue
func (p *parser) setValue(key string, value interface{}) { var tmpHash interface{} var ok bool hash := p.mapping keyContext := make(Key, 0) for _, k := range p.context { keyContext = append(keyContext, k) if tmpHash, ok = hash[k]; !ok { p.bug("Context for key '%s' has not been established.", keyContext) ...
go
func (p *parser) setValue(key string, value interface{}) { var tmpHash interface{} var ok bool hash := p.mapping keyContext := make(Key, 0) for _, k := range p.context { keyContext = append(keyContext, k) if tmpHash, ok = hash[k]; !ok { p.bug("Context for key '%s' has not been established.", keyContext) ...
[ "func", "(", "p", "*", "parser", ")", "setValue", "(", "key", "string", ",", "value", "interface", "{", "}", ")", "{", "var", "tmpHash", "interface", "{", "}", "\n", "var", "ok", "bool", "\n\n", "hash", ":=", "p", ".", "mapping", "\n", "keyContext", ...
// setValue sets the given key to the given value in the current context. // It will make sure that the key hasn't already been defined, account for // implicit key groups.
[ "setValue", "sets", "the", "given", "key", "to", "the", "given", "value", "in", "the", "current", "context", ".", "It", "will", "make", "sure", "that", "the", "key", "hasn", "t", "already", "been", "defined", "account", "for", "implicit", "key", "groups", ...
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/parse.go#L406-L453
146,479
BurntSushi/toml
parse.go
addImplicit
func (p *parser) addImplicit(key Key) { p.implicits[key.String()] = true }
go
func (p *parser) addImplicit(key Key) { p.implicits[key.String()] = true }
[ "func", "(", "p", "*", "parser", ")", "addImplicit", "(", "key", "Key", ")", "{", "p", ".", "implicits", "[", "key", ".", "String", "(", ")", "]", "=", "true", "\n", "}" ]
// addImplicit sets the given Key as having been created implicitly.
[ "addImplicit", "sets", "the", "given", "Key", "as", "having", "been", "created", "implicitly", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/parse.go#L472-L474
146,480
BurntSushi/toml
parse.go
removeImplicit
func (p *parser) removeImplicit(key Key) { p.implicits[key.String()] = false }
go
func (p *parser) removeImplicit(key Key) { p.implicits[key.String()] = false }
[ "func", "(", "p", "*", "parser", ")", "removeImplicit", "(", "key", "Key", ")", "{", "p", ".", "implicits", "[", "key", ".", "String", "(", ")", "]", "=", "false", "\n", "}" ]
// removeImplicit stops tagging the given key as having been implicitly // created.
[ "removeImplicit", "stops", "tagging", "the", "given", "key", "as", "having", "been", "implicitly", "created", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/parse.go#L478-L480
146,481
BurntSushi/toml
parse.go
isImplicit
func (p *parser) isImplicit(key Key) bool { return p.implicits[key.String()] }
go
func (p *parser) isImplicit(key Key) bool { return p.implicits[key.String()] }
[ "func", "(", "p", "*", "parser", ")", "isImplicit", "(", "key", "Key", ")", "bool", "{", "return", "p", ".", "implicits", "[", "key", ".", "String", "(", ")", "]", "\n", "}" ]
// isImplicit returns true if the key group pointed to by the key was created // implicitly.
[ "isImplicit", "returns", "true", "if", "the", "key", "group", "pointed", "to", "by", "the", "key", "was", "created", "implicitly", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/parse.go#L484-L486
146,482
BurntSushi/toml
parse.go
current
func (p *parser) current() string { if len(p.currentKey) == 0 { return p.context.String() } if len(p.context) == 0 { return p.currentKey } return fmt.Sprintf("%s.%s", p.context, p.currentKey) }
go
func (p *parser) current() string { if len(p.currentKey) == 0 { return p.context.String() } if len(p.context) == 0 { return p.currentKey } return fmt.Sprintf("%s.%s", p.context, p.currentKey) }
[ "func", "(", "p", "*", "parser", ")", "current", "(", ")", "string", "{", "if", "len", "(", "p", ".", "currentKey", ")", "==", "0", "{", "return", "p", ".", "context", ".", "String", "(", ")", "\n", "}", "\n", "if", "len", "(", "p", ".", "con...
// current returns the full key name of the current context.
[ "current", "returns", "the", "full", "key", "name", "of", "the", "current", "context", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/parse.go#L489-L497
146,483
BurntSushi/toml
type_check.go
typeOfArray
func (p *parser) typeOfArray(types []tomlType) tomlType { // Empty arrays are cool. if len(types) == 0 { return tomlArray } theType := types[0] for _, t := range types[1:] { if !typeEqual(theType, t) { p.panicf("Array contains values of type '%s' and '%s', but "+ "arrays must be homogeneous.", theType,...
go
func (p *parser) typeOfArray(types []tomlType) tomlType { // Empty arrays are cool. if len(types) == 0 { return tomlArray } theType := types[0] for _, t := range types[1:] { if !typeEqual(theType, t) { p.panicf("Array contains values of type '%s' and '%s', but "+ "arrays must be homogeneous.", theType,...
[ "func", "(", "p", "*", "parser", ")", "typeOfArray", "(", "types", "[", "]", "tomlType", ")", "tomlType", "{", "// Empty arrays are cool.", "if", "len", "(", "types", ")", "==", "0", "{", "return", "tomlArray", "\n", "}", "\n\n", "theType", ":=", "types"...
// typeOfArray returns a tomlType for an array given a list of types of its // values. // // In the current spec, if an array is homogeneous, then its type is always // "Array". If the array is not homogeneous, an error is generated.
[ "typeOfArray", "returns", "a", "tomlType", "for", "an", "array", "given", "a", "list", "of", "types", "of", "its", "values", ".", "In", "the", "current", "spec", "if", "an", "array", "is", "homogeneous", "then", "its", "type", "is", "always", "Array", "....
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/type_check.go#L77-L91
146,484
BurntSushi/toml
decode_meta.go
Type
func (md *MetaData) Type(key ...string) string { fullkey := strings.Join(key, ".") if typ, ok := md.types[fullkey]; ok { return typ.typeString() } return "" }
go
func (md *MetaData) Type(key ...string) string { fullkey := strings.Join(key, ".") if typ, ok := md.types[fullkey]; ok { return typ.typeString() } return "" }
[ "func", "(", "md", "*", "MetaData", ")", "Type", "(", "key", "...", "string", ")", "string", "{", "fullkey", ":=", "strings", ".", "Join", "(", "key", ",", "\"", "\"", ")", "\n", "if", "typ", ",", "ok", ":=", "md", ".", "types", "[", "fullkey", ...
// Type returns a string representation of the type of the key specified. // // Type will return the empty string if given an empty key or a key that // does not exist. Keys are case sensitive.
[ "Type", "returns", "a", "string", "representation", "of", "the", "type", "of", "the", "key", "specified", ".", "Type", "will", "return", "the", "empty", "string", "if", "given", "an", "empty", "key", "or", "a", "key", "that", "does", "not", "exist", ".",...
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/decode_meta.go#L46-L52
146,485
BurntSushi/toml
decode_meta.go
Undecoded
func (md *MetaData) Undecoded() []Key { undecoded := make([]Key, 0, len(md.keys)) for _, key := range md.keys { if !md.decoded[key.String()] { undecoded = append(undecoded, key) } } return undecoded }
go
func (md *MetaData) Undecoded() []Key { undecoded := make([]Key, 0, len(md.keys)) for _, key := range md.keys { if !md.decoded[key.String()] { undecoded = append(undecoded, key) } } return undecoded }
[ "func", "(", "md", "*", "MetaData", ")", "Undecoded", "(", ")", "[", "]", "Key", "{", "undecoded", ":=", "make", "(", "[", "]", "Key", ",", "0", ",", "len", "(", "md", ".", "keys", ")", ")", "\n", "for", "_", ",", "key", ":=", "range", "md", ...
// Undecoded returns all keys that have not been decoded in the order in which // they appear in the original TOML document. // // This includes keys that haven't been decoded because of a Primitive value. // Once the Primitive value is decoded, the keys will be considered decoded. // // Also note that decoding into an...
[ "Undecoded", "returns", "all", "keys", "that", "have", "not", "been", "decoded", "in", "the", "order", "in", "which", "they", "appear", "in", "the", "original", "TOML", "document", ".", "This", "includes", "keys", "that", "haven", "t", "been", "decoded", "...
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/decode_meta.go#L113-L121
146,486
BurntSushi/toml
lex.go
backup
func (lx *lexer) backup() { if lx.atEOF { lx.atEOF = false return } if lx.nprev < 1 { panic("backed up too far") } w := lx.prevWidths[0] lx.prevWidths[0] = lx.prevWidths[1] lx.prevWidths[1] = lx.prevWidths[2] lx.nprev-- lx.pos -= w if lx.pos < len(lx.input) && lx.input[lx.pos] == '\n' { lx.line-- } }
go
func (lx *lexer) backup() { if lx.atEOF { lx.atEOF = false return } if lx.nprev < 1 { panic("backed up too far") } w := lx.prevWidths[0] lx.prevWidths[0] = lx.prevWidths[1] lx.prevWidths[1] = lx.prevWidths[2] lx.nprev-- lx.pos -= w if lx.pos < len(lx.input) && lx.input[lx.pos] == '\n' { lx.line-- } }
[ "func", "(", "lx", "*", "lexer", ")", "backup", "(", ")", "{", "if", "lx", ".", "atEOF", "{", "lx", ".", "atEOF", "=", "false", "\n", "return", "\n", "}", "\n", "if", "lx", ".", "nprev", "<", "1", "{", "panic", "(", "\"", "\"", ")", "\n", "...
// backup steps back one rune. Can be called only twice between calls to next.
[ "backup", "steps", "back", "one", "rune", ".", "Can", "be", "called", "only", "twice", "between", "calls", "to", "next", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L167-L183
146,487
BurntSushi/toml
lex.go
accept
func (lx *lexer) accept(valid rune) bool { if lx.next() == valid { return true } lx.backup() return false }
go
func (lx *lexer) accept(valid rune) bool { if lx.next() == valid { return true } lx.backup() return false }
[ "func", "(", "lx", "*", "lexer", ")", "accept", "(", "valid", "rune", ")", "bool", "{", "if", "lx", ".", "next", "(", ")", "==", "valid", "{", "return", "true", "\n", "}", "\n", "lx", ".", "backup", "(", ")", "\n", "return", "false", "\n", "}" ...
// accept consumes the next rune if it's equal to `valid`.
[ "accept", "consumes", "the", "next", "rune", "if", "it", "s", "equal", "to", "valid", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L186-L192
146,488
BurntSushi/toml
lex.go
skip
func (lx *lexer) skip(pred func(rune) bool) { for { r := lx.next() if pred(r) { continue } lx.backup() lx.ignore() return } }
go
func (lx *lexer) skip(pred func(rune) bool) { for { r := lx.next() if pred(r) { continue } lx.backup() lx.ignore() return } }
[ "func", "(", "lx", "*", "lexer", ")", "skip", "(", "pred", "func", "(", "rune", ")", "bool", ")", "{", "for", "{", "r", ":=", "lx", ".", "next", "(", ")", "\n", "if", "pred", "(", "r", ")", "{", "continue", "\n", "}", "\n", "lx", ".", "back...
// skip ignores all input that matches the given predicate.
[ "skip", "ignores", "all", "input", "that", "matches", "the", "given", "predicate", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L202-L212
146,489
BurntSushi/toml
lex.go
lexTop
func lexTop(lx *lexer) stateFn { r := lx.next() if isWhitespace(r) || isNL(r) { return lexSkip(lx, lexTop) } switch r { case commentStart: lx.push(lexTop) return lexCommentStart case tableStart: return lexTableStart case eof: if lx.pos > lx.start { return lx.errorf("unexpected EOF") } lx.emit(it...
go
func lexTop(lx *lexer) stateFn { r := lx.next() if isWhitespace(r) || isNL(r) { return lexSkip(lx, lexTop) } switch r { case commentStart: lx.push(lexTop) return lexCommentStart case tableStart: return lexTableStart case eof: if lx.pos > lx.start { return lx.errorf("unexpected EOF") } lx.emit(it...
[ "func", "lexTop", "(", "lx", "*", "lexer", ")", "stateFn", "{", "r", ":=", "lx", ".", "next", "(", ")", "\n", "if", "isWhitespace", "(", "r", ")", "||", "isNL", "(", "r", ")", "{", "return", "lexSkip", "(", "lx", ",", "lexTop", ")", "\n", "}", ...
// lexTop consumes elements at the top level of TOML data.
[ "lexTop", "consumes", "elements", "at", "the", "top", "level", "of", "TOML", "data", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L227-L251
146,490
BurntSushi/toml
lex.go
lexBareTableName
func lexBareTableName(lx *lexer) stateFn { r := lx.next() if isBareKeyChar(r) { return lexBareTableName } lx.backup() lx.emit(itemText) return lexTableNameEnd }
go
func lexBareTableName(lx *lexer) stateFn { r := lx.next() if isBareKeyChar(r) { return lexBareTableName } lx.backup() lx.emit(itemText) return lexTableNameEnd }
[ "func", "lexBareTableName", "(", "lx", "*", "lexer", ")", "stateFn", "{", "r", ":=", "lx", ".", "next", "(", ")", "\n", "if", "isBareKeyChar", "(", "r", ")", "{", "return", "lexBareTableName", "\n", "}", "\n", "lx", ".", "backup", "(", ")", "\n", "...
// lexBareTableName lexes the name of a table. It assumes that at least one // valid character for the table has already been read.
[ "lexBareTableName", "lexes", "the", "name", "of", "a", "table", ".", "It", "assumes", "that", "at", "least", "one", "valid", "character", "for", "the", "table", "has", "already", "been", "read", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L327-L335
146,491
BurntSushi/toml
lex.go
lexTableNameEnd
func lexTableNameEnd(lx *lexer) stateFn { lx.skip(isWhitespace) switch r := lx.next(); { case isWhitespace(r): return lexTableNameEnd case r == tableSep: lx.ignore() return lexTableNameStart case r == tableEnd: return lx.pop() default: return lx.errorf("expected '.' or ']' to end table name, "+ "but ...
go
func lexTableNameEnd(lx *lexer) stateFn { lx.skip(isWhitespace) switch r := lx.next(); { case isWhitespace(r): return lexTableNameEnd case r == tableSep: lx.ignore() return lexTableNameStart case r == tableEnd: return lx.pop() default: return lx.errorf("expected '.' or ']' to end table name, "+ "but ...
[ "func", "lexTableNameEnd", "(", "lx", "*", "lexer", ")", "stateFn", "{", "lx", ".", "skip", "(", "isWhitespace", ")", "\n", "switch", "r", ":=", "lx", ".", "next", "(", ")", ";", "{", "case", "isWhitespace", "(", "r", ")", ":", "return", "lexTableNam...
// lexTableNameEnd reads the end of a piece of a table name, optionally // consuming whitespace.
[ "lexTableNameEnd", "reads", "the", "end", "of", "a", "piece", "of", "a", "table", "name", "optionally", "consuming", "whitespace", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L339-L353
146,492
BurntSushi/toml
lex.go
lexKeyStart
func lexKeyStart(lx *lexer) stateFn { r := lx.peek() switch { case r == keySep: return lx.errorf("unexpected key separator %q", keySep) case isWhitespace(r) || isNL(r): lx.next() return lexSkip(lx, lexKeyStart) case r == stringStart || r == rawStringStart: lx.ignore() lx.emit(itemKeyStart) lx.push(lexK...
go
func lexKeyStart(lx *lexer) stateFn { r := lx.peek() switch { case r == keySep: return lx.errorf("unexpected key separator %q", keySep) case isWhitespace(r) || isNL(r): lx.next() return lexSkip(lx, lexKeyStart) case r == stringStart || r == rawStringStart: lx.ignore() lx.emit(itemKeyStart) lx.push(lexK...
[ "func", "lexKeyStart", "(", "lx", "*", "lexer", ")", "stateFn", "{", "r", ":=", "lx", ".", "peek", "(", ")", "\n", "switch", "{", "case", "r", "==", "keySep", ":", "return", "lx", ".", "errorf", "(", "\"", "\"", ",", "keySep", ")", "\n", "case", ...
// lexKeyStart consumes a key name up until the first non-whitespace character. // lexKeyStart will ignore whitespace.
[ "lexKeyStart", "consumes", "a", "key", "name", "up", "until", "the", "first", "non", "-", "whitespace", "character", ".", "lexKeyStart", "will", "ignore", "whitespace", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L357-L375
146,493
BurntSushi/toml
lex.go
lexArrayValue
func lexArrayValue(lx *lexer) stateFn { r := lx.next() switch { case isWhitespace(r) || isNL(r): return lexSkip(lx, lexArrayValue) case r == commentStart: lx.push(lexArrayValue) return lexCommentStart case r == comma: return lx.errorf("unexpected comma") case r == arrayEnd: // NOTE(caleb): The spec isn'...
go
func lexArrayValue(lx *lexer) stateFn { r := lx.next() switch { case isWhitespace(r) || isNL(r): return lexSkip(lx, lexArrayValue) case r == commentStart: lx.push(lexArrayValue) return lexCommentStart case r == comma: return lx.errorf("unexpected comma") case r == arrayEnd: // NOTE(caleb): The spec isn'...
[ "func", "lexArrayValue", "(", "lx", "*", "lexer", ")", "stateFn", "{", "r", ":=", "lx", ".", "next", "(", ")", "\n", "switch", "{", "case", "isWhitespace", "(", "r", ")", "||", "isNL", "(", "r", ")", ":", "return", "lexSkip", "(", "lx", ",", "lex...
// lexArrayValue consumes one value in an array. It assumes that '[' or ',' // have already been consumed. All whitespace and newlines are ignored.
[ "lexArrayValue", "consumes", "one", "value", "in", "an", "array", ".", "It", "assumes", "that", "[", "or", "have", "already", "been", "consumed", ".", "All", "whitespace", "and", "newlines", "are", "ignored", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L471-L490
146,494
BurntSushi/toml
lex.go
lexInlineTableEnd
func lexInlineTableEnd(lx *lexer) stateFn { lx.ignore() lx.emit(itemInlineTableEnd) return lx.pop() }
go
func lexInlineTableEnd(lx *lexer) stateFn { lx.ignore() lx.emit(itemInlineTableEnd) return lx.pop() }
[ "func", "lexInlineTableEnd", "(", "lx", "*", "lexer", ")", "stateFn", "{", "lx", ".", "ignore", "(", ")", "\n", "lx", ".", "emit", "(", "itemInlineTableEnd", ")", "\n", "return", "lx", ".", "pop", "(", ")", "\n", "}" ]
// lexInlineTableEnd finishes the lexing of an inline table. // It assumes that a '}' has just been consumed.
[ "lexInlineTableEnd", "finishes", "the", "lexing", "of", "an", "inline", "table", ".", "It", "assumes", "that", "a", "}", "has", "just", "been", "consumed", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L570-L574
146,495
BurntSushi/toml
lex.go
lexMultilineString
func lexMultilineString(lx *lexer) stateFn { switch lx.next() { case eof: return lx.errorf("unexpected EOF") case '\\': return lexMultilineStringEscape case stringEnd: if lx.accept(stringEnd) { if lx.accept(stringEnd) { lx.backup() lx.backup() lx.backup() lx.emit(itemMultilineString) lx...
go
func lexMultilineString(lx *lexer) stateFn { switch lx.next() { case eof: return lx.errorf("unexpected EOF") case '\\': return lexMultilineStringEscape case stringEnd: if lx.accept(stringEnd) { if lx.accept(stringEnd) { lx.backup() lx.backup() lx.backup() lx.emit(itemMultilineString) lx...
[ "func", "lexMultilineString", "(", "lx", "*", "lexer", ")", "stateFn", "{", "switch", "lx", ".", "next", "(", ")", "{", "case", "eof", ":", "return", "lx", ".", "errorf", "(", "\"", "\"", ")", "\n", "case", "'\\\\'", ":", "return", "lexMultilineStringE...
// lexMultilineString consumes the inner contents of a string. It assumes that // the beginning '"""' has already been consumed and ignored.
[ "lexMultilineString", "consumes", "the", "inner", "contents", "of", "a", "string", ".", "It", "assumes", "that", "the", "beginning", "has", "already", "been", "consumed", "and", "ignored", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L600-L623
146,496
BurntSushi/toml
lex.go
lexRawString
func lexRawString(lx *lexer) stateFn { r := lx.next() switch { case r == eof: return lx.errorf("unexpected EOF") case isNL(r): return lx.errorf("strings cannot contain newlines") case r == rawStringEnd: lx.backup() lx.emit(itemRawString) lx.next() lx.ignore() return lx.pop() } return lexRawString }
go
func lexRawString(lx *lexer) stateFn { r := lx.next() switch { case r == eof: return lx.errorf("unexpected EOF") case isNL(r): return lx.errorf("strings cannot contain newlines") case r == rawStringEnd: lx.backup() lx.emit(itemRawString) lx.next() lx.ignore() return lx.pop() } return lexRawString }
[ "func", "lexRawString", "(", "lx", "*", "lexer", ")", "stateFn", "{", "r", ":=", "lx", ".", "next", "(", ")", "\n", "switch", "{", "case", "r", "==", "eof", ":", "return", "lx", ".", "errorf", "(", "\"", "\"", ")", "\n", "case", "isNL", "(", "r...
// lexRawString consumes a raw string. Nothing can be escaped in such a string. // It assumes that the beginning "'" has already been consumed and ignored.
[ "lexRawString", "consumes", "a", "raw", "string", ".", "Nothing", "can", "be", "escaped", "in", "such", "a", "string", ".", "It", "assumes", "that", "the", "beginning", "has", "already", "been", "consumed", "and", "ignored", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L627-L642
146,497
BurntSushi/toml
lex.go
lexMultilineRawString
func lexMultilineRawString(lx *lexer) stateFn { switch lx.next() { case eof: return lx.errorf("unexpected EOF") case rawStringEnd: if lx.accept(rawStringEnd) { if lx.accept(rawStringEnd) { lx.backup() lx.backup() lx.backup() lx.emit(itemRawMultilineString) lx.next() lx.next() lx.ne...
go
func lexMultilineRawString(lx *lexer) stateFn { switch lx.next() { case eof: return lx.errorf("unexpected EOF") case rawStringEnd: if lx.accept(rawStringEnd) { if lx.accept(rawStringEnd) { lx.backup() lx.backup() lx.backup() lx.emit(itemRawMultilineString) lx.next() lx.next() lx.ne...
[ "func", "lexMultilineRawString", "(", "lx", "*", "lexer", ")", "stateFn", "{", "switch", "lx", ".", "next", "(", ")", "{", "case", "eof", ":", "return", "lx", ".", "errorf", "(", "\"", "\"", ")", "\n", "case", "rawStringEnd", ":", "if", "lx", ".", ...
// lexMultilineRawString consumes a raw string. Nothing can be escaped in such // a string. It assumes that the beginning "'''" has already been consumed and // ignored.
[ "lexMultilineRawString", "consumes", "a", "raw", "string", ".", "Nothing", "can", "be", "escaped", "in", "such", "a", "string", ".", "It", "assumes", "that", "the", "beginning", "has", "already", "been", "consumed", "and", "ignored", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L647-L668
146,498
BurntSushi/toml
lex.go
lexMultilineStringEscape
func lexMultilineStringEscape(lx *lexer) stateFn { // Handle the special case first: if isNL(lx.next()) { return lexMultilineString } lx.backup() lx.push(lexMultilineString) return lexStringEscape(lx) }
go
func lexMultilineStringEscape(lx *lexer) stateFn { // Handle the special case first: if isNL(lx.next()) { return lexMultilineString } lx.backup() lx.push(lexMultilineString) return lexStringEscape(lx) }
[ "func", "lexMultilineStringEscape", "(", "lx", "*", "lexer", ")", "stateFn", "{", "// Handle the special case first:", "if", "isNL", "(", "lx", ".", "next", "(", ")", ")", "{", "return", "lexMultilineString", "\n", "}", "\n", "lx", ".", "backup", "(", ")", ...
// lexMultilineStringEscape consumes an escaped character. It assumes that the // preceding '\\' has already been consumed.
[ "lexMultilineStringEscape", "consumes", "an", "escaped", "character", ".", "It", "assumes", "that", "the", "preceding", "\\\\", "has", "already", "been", "consumed", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L672-L680
146,499
BurntSushi/toml
lex.go
lexNumberOrDate
func lexNumberOrDate(lx *lexer) stateFn { r := lx.next() if isDigit(r) { return lexNumberOrDate } switch r { case '-': return lexDatetime case '_': return lexNumber case '.', 'e', 'E': return lexFloat } lx.backup() lx.emit(itemInteger) return lx.pop() }
go
func lexNumberOrDate(lx *lexer) stateFn { r := lx.next() if isDigit(r) { return lexNumberOrDate } switch r { case '-': return lexDatetime case '_': return lexNumber case '.', 'e', 'E': return lexFloat } lx.backup() lx.emit(itemInteger) return lx.pop() }
[ "func", "lexNumberOrDate", "(", "lx", "*", "lexer", ")", "stateFn", "{", "r", ":=", "lx", ".", "next", "(", ")", "\n", "if", "isDigit", "(", "r", ")", "{", "return", "lexNumberOrDate", "\n", "}", "\n", "switch", "r", "{", "case", "'-'", ":", "retur...
// lexNumberOrDate consumes either an integer, float or datetime.
[ "lexNumberOrDate", "consumes", "either", "an", "integer", "float", "or", "datetime", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L751-L768