id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
148,100
cloud-ca/go-cloudca
client.go
GetResources
func (c CcaClient) GetResources(serviceCode string, environmentName string) (services.ServiceResources, error) { //TODO: change to check service type of service code return cloudca.NewResources(c.apiClient, serviceCode, environmentName), nil }
go
func (c CcaClient) GetResources(serviceCode string, environmentName string) (services.ServiceResources, error) { //TODO: change to check service type of service code return cloudca.NewResources(c.apiClient, serviceCode, environmentName), nil }
[ "func", "(", "c", "CcaClient", ")", "GetResources", "(", "serviceCode", "string", ",", "environmentName", "string", ")", "(", "services", ".", "ServiceResources", ",", "error", ")", "{", "//TODO: change to check service type of service code", "return", "cloudca", ".",...
//Get the Resources for a specific serviceCode and environmentName //For now it assumes that the serviceCode belongs to a cloud.ca service type
[ "Get", "the", "Resources", "for", "a", "specific", "serviceCode", "and", "environmentName", "For", "now", "it", "assumes", "that", "the", "serviceCode", "belongs", "to", "a", "cloud", ".", "ca", "service", "type" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/client.go#L54-L57
148,101
cloud-ca/go-cloudca
configuration/service_connection.go
ListWithOptions
func (serviceConnectionApi *ServiceConnectionApi) ListWithOptions(options map[string]string) ([]ServiceConnection, error) { data, err := serviceConnectionApi.configurationService.List(options) if err != nil { return nil, err } return parseServiceConnectionList(data), nil }
go
func (serviceConnectionApi *ServiceConnectionApi) ListWithOptions(options map[string]string) ([]ServiceConnection, error) { data, err := serviceConnectionApi.configurationService.List(options) if err != nil { return nil, err } return parseServiceConnectionList(data), nil }
[ "func", "(", "serviceConnectionApi", "*", "ServiceConnectionApi", ")", "ListWithOptions", "(", "options", "map", "[", "string", "]", "string", ")", "(", "[", "]", "ServiceConnection", ",", "error", ")", "{", "data", ",", "err", ":=", "serviceConnectionApi", "....
//List all service connections. Can use options to do sorting and paging.
[ "List", "all", "service", "connections", ".", "Can", "use", "options", "to", "do", "sorting", "and", "paging", "." ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/configuration/service_connection.go#L56-L62
148,102
venicegeo/geojson-go
geojson/geojson.go
Parse
func Parse(bytes []byte) (result interface{}, err error) { defer func() { if r := recover(); r != nil { if parseErr, ok := r.(error); ok { err = parseErr } else { err = fmt.Errorf("unexpected panic: %v", r) } } }() return parsePanicUnsafe(bytes) }
go
func Parse(bytes []byte) (result interface{}, err error) { defer func() { if r := recover(); r != nil { if parseErr, ok := r.(error); ok { err = parseErr } else { err = fmt.Errorf("unexpected panic: %v", r) } } }() return parsePanicUnsafe(bytes) }
[ "func", "Parse", "(", "bytes", "[", "]", "byte", ")", "(", "result", "interface", "{", "}", ",", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "r", ":=", "recover", "(", ")", ";", "r", "!=", "nil", "{", "if", "parseErr", ",", ...
// Parse parses a GeoJSON string into a GeoJSON object pointer
[ "Parse", "parses", "a", "GeoJSON", "string", "into", "a", "GeoJSON", "object", "pointer" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geojson.go#L32-L43
148,103
venicegeo/geojson-go
geojson/geojson.go
ParseFile
func ParseFile(filename string) (interface{}, error) { var ( bytes []byte err error ) if bytes, err = ioutil.ReadFile(filename); err != nil { return nil, err } return Parse(bytes) }
go
func ParseFile(filename string) (interface{}, error) { var ( bytes []byte err error ) if bytes, err = ioutil.ReadFile(filename); err != nil { return nil, err } return Parse(bytes) }
[ "func", "ParseFile", "(", "filename", "string", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "var", "(", "bytes", "[", "]", "byte", "\n", "err", "error", "\n", ")", "\n", "if", "bytes", ",", "err", "=", "ioutil", ".", "ReadFile", "(", ...
// ParseFile parses a file containing a GeoJSON string into a GeoJSON object pointer
[ "ParseFile", "parses", "a", "file", "containing", "a", "GeoJSON", "string", "into", "a", "GeoJSON", "object", "pointer" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geojson.go#L77-L86
148,104
venicegeo/geojson-go
geojson/geojson.go
FromMap
func FromMap(input map[string]interface{}) interface{} { var ( typeIfc interface{} ok bool ) if typeIfc, ok = input["type"]; ok { switch typeIfc.(string) { case FEATURE: return FeatureFromMap(input) case FEATURECOLLECTION: return FeatureCollectionFromMap(input) default: return newGeometry(...
go
func FromMap(input map[string]interface{}) interface{} { var ( typeIfc interface{} ok bool ) if typeIfc, ok = input["type"]; ok { switch typeIfc.(string) { case FEATURE: return FeatureFromMap(input) case FEATURECOLLECTION: return FeatureCollectionFromMap(input) default: return newGeometry(...
[ "func", "FromMap", "(", "input", "map", "[", "string", "]", "interface", "{", "}", ")", "interface", "{", "}", "{", "var", "(", "typeIfc", "interface", "{", "}", "\n", "ok", "bool", "\n", ")", "\n\n", "if", "typeIfc", ",", "ok", "=", "input", "[", ...
// FromMap parses a map containing a GeoJSON object // into a GeoJSON object pointer
[ "FromMap", "parses", "a", "map", "containing", "a", "GeoJSON", "object", "into", "a", "GeoJSON", "object", "pointer" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geojson.go#L90-L108
148,105
venicegeo/geojson-go
geojson/geojson.go
WriteFile
func WriteFile(input interface{}, filename string) error { var ( bytes []byte err error ) if bytes, err = Write(input); err != nil { return err } return ioutil.WriteFile(filename, bytes, 0666) }
go
func WriteFile(input interface{}, filename string) error { var ( bytes []byte err error ) if bytes, err = Write(input); err != nil { return err } return ioutil.WriteFile(filename, bytes, 0666) }
[ "func", "WriteFile", "(", "input", "interface", "{", "}", ",", "filename", "string", ")", "error", "{", "var", "(", "bytes", "[", "]", "byte", "\n", "err", "error", "\n", ")", "\n", "if", "bytes", ",", "err", "=", "Write", "(", "input", ")", ";", ...
// WriteFile writes a GeoJSON object to the file specified
[ "WriteFile", "writes", "a", "GeoJSON", "object", "to", "the", "file", "specified" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geojson.go#L116-L125
148,106
cloud-ca/go-cloudca
services/cloudca/network_acl_rule.go
Get
func (networkAclRuleApi *NetworkAclRuleApi) Get(id string) (*NetworkAclRule, error) { data, err := networkAclRuleApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseNetworkAclRule(data), nil }
go
func (networkAclRuleApi *NetworkAclRuleApi) Get(id string) (*NetworkAclRule, error) { data, err := networkAclRuleApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseNetworkAclRule(data), nil }
[ "func", "(", "networkAclRuleApi", "*", "NetworkAclRuleApi", ")", "Get", "(", "id", "string", ")", "(", "*", "NetworkAclRule", ",", "error", ")", "{", "data", ",", "err", ":=", "networkAclRuleApi", ".", "entityService", ".", "Get", "(", "id", ",", "map", ...
//Get network acl rule with the specified id for the current environment
[ "Get", "network", "acl", "rule", "with", "the", "specified", "id", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/network_acl_rule.go#L58-L64
148,107
cloud-ca/go-cloudca
services/cloudca/network_acl_rule.go
ListByNetworkAclId
func (networkAclRuleApi *NetworkAclRuleApi) ListByNetworkAclId(networkAclId string) ([]NetworkAclRule, error) { return networkAclRuleApi.ListWithOptions(map[string]string{"network_acl_id": networkAclId}) }
go
func (networkAclRuleApi *NetworkAclRuleApi) ListByNetworkAclId(networkAclId string) ([]NetworkAclRule, error) { return networkAclRuleApi.ListWithOptions(map[string]string{"network_acl_id": networkAclId}) }
[ "func", "(", "networkAclRuleApi", "*", "NetworkAclRuleApi", ")", "ListByNetworkAclId", "(", "networkAclId", "string", ")", "(", "[", "]", "NetworkAclRule", ",", "error", ")", "{", "return", "networkAclRuleApi", ".", "ListWithOptions", "(", "map", "[", "string", ...
//List all network acl rules for the NetworkAcl
[ "List", "all", "network", "acl", "rules", "for", "the", "NetworkAcl" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/network_acl_rule.go#L79-L81
148,108
cloud-ca/go-cloudca
configuration/user.go
Get
func (userApi *UserApi) Get(id string) (*User, error) { data, err := userApi.configurationService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseUser(data), nil }
go
func (userApi *UserApi) Get(id string) (*User, error) { data, err := userApi.configurationService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseUser(data), nil }
[ "func", "(", "userApi", "*", "UserApi", ")", "Get", "(", "id", "string", ")", "(", "*", "User", ",", "error", ")", "{", "data", ",", "err", ":=", "userApi", ".", "configurationService", ".", "Get", "(", "id", ",", "map", "[", "string", "]", "string...
//Get user with the specified id
[ "Get", "user", "with", "the", "specified", "id" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/configuration/user.go#L44-L50
148,109
cloud-ca/go-cloudca
configuration/user.go
ListWithOptions
func (userApi *UserApi) ListWithOptions(options map[string]string) ([]User, error) { data, err := userApi.configurationService.List(options) if err != nil { return nil, err } return parseUserList(data), nil }
go
func (userApi *UserApi) ListWithOptions(options map[string]string) ([]User, error) { data, err := userApi.configurationService.List(options) if err != nil { return nil, err } return parseUserList(data), nil }
[ "func", "(", "userApi", "*", "UserApi", ")", "ListWithOptions", "(", "options", "map", "[", "string", "]", "string", ")", "(", "[", "]", "User", ",", "error", ")", "{", "data", ",", "err", ":=", "userApi", ".", "configurationService", ".", "List", "(",...
//List all instances for the current user. Can use options to do sorting and paging.
[ "List", "all", "instances", "for", "the", "current", "user", ".", "Can", "use", "options", "to", "do", "sorting", "and", "paging", "." ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/configuration/user.go#L58-L64
148,110
venicegeo/geojson-go
geojson/geometry.go
PointFromBytes
func PointFromBytes(bytes []byte) (*Point, error) { var result Point err := json.Unmarshal(bytes, &result) return &result, err }
go
func PointFromBytes(bytes []byte) (*Point, error) { var result Point err := json.Unmarshal(bytes, &result) return &result, err }
[ "func", "PointFromBytes", "(", "bytes", "[", "]", "byte", ")", "(", "*", "Point", ",", "error", ")", "{", "var", "result", "Point", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",", "&", "result", ")", "\n", "return", "&", "result", "...
// PointFromBytes constructs a point from a GeoJSON byte array // and returns its pointer
[ "PointFromBytes", "constructs", "a", "point", "from", "a", "GeoJSON", "byte", "array", "and", "returns", "its", "pointer" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L53-L57
148,111
venicegeo/geojson-go
geojson/geometry.go
NewPoint
func NewPoint(coordinates []float64) *Point { if len(coordinates) > 1 { return &Point{Type: POINT, Coordinates: coordinates} } return nil }
go
func NewPoint(coordinates []float64) *Point { if len(coordinates) > 1 { return &Point{Type: POINT, Coordinates: coordinates} } return nil }
[ "func", "NewPoint", "(", "coordinates", "[", "]", "float64", ")", "*", "Point", "{", "if", "len", "(", "coordinates", ")", ">", "1", "{", "return", "&", "Point", "{", "Type", ":", "POINT", ",", "Coordinates", ":", "coordinates", "}", "\n", "}", "\n",...
// NewPoint is the normal factory method for a Point
[ "NewPoint", "is", "the", "normal", "factory", "method", "for", "a", "Point" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L90-L95
148,112
venicegeo/geojson-go
geojson/geometry.go
WKT
func (point Point) WKT() string { var result string switch len(point.Coordinates) { case 2: result = fmt.Sprintf("POINT (%v)", array1ToWKTCoordinates(point.Coordinates)) case 3: result = fmt.Sprintf("POINT Z (%v)", array1ToWKTCoordinates(point.Coordinates)) case 4: result = fmt.Sprintf("POINT ZM (%v)", array...
go
func (point Point) WKT() string { var result string switch len(point.Coordinates) { case 2: result = fmt.Sprintf("POINT (%v)", array1ToWKTCoordinates(point.Coordinates)) case 3: result = fmt.Sprintf("POINT Z (%v)", array1ToWKTCoordinates(point.Coordinates)) case 4: result = fmt.Sprintf("POINT ZM (%v)", array...
[ "func", "(", "point", "Point", ")", "WKT", "(", ")", "string", "{", "var", "result", "string", "\n", "switch", "len", "(", "point", ".", "Coordinates", ")", "{", "case", "2", ":", "result", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "array1T...
// WKT returns the Well Known Text representation of the point
[ "WKT", "returns", "the", "Well", "Known", "Text", "representation", "of", "the", "point" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L98-L111
148,113
venicegeo/geojson-go
geojson/geometry.go
LineStringFromBytes
func LineStringFromBytes(bytes []byte) (*LineString, error) { var result LineString err := json.Unmarshal(bytes, &result) return &result, err }
go
func LineStringFromBytes(bytes []byte) (*LineString, error) { var result LineString err := json.Unmarshal(bytes, &result) return &result, err }
[ "func", "LineStringFromBytes", "(", "bytes", "[", "]", "byte", ")", "(", "*", "LineString", ",", "error", ")", "{", "var", "result", "LineString", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",", "&", "result", ")", "\n", "return", "&", ...
// LineStringFromBytes constructs a LineString from a GeoJSON byte array // and returns its pointer
[ "LineStringFromBytes", "constructs", "a", "LineString", "from", "a", "GeoJSON", "byte", "array", "and", "returns", "its", "pointer" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L122-L126
148,114
venicegeo/geojson-go
geojson/geometry.go
WKT
func (ls LineString) WKT() string { var result string switch len(ls.Coordinates) { case 0: result = "LINESTRING EMPTY" default: result = fmt.Sprintf("LINESTRING (%v)", array2ToWKTCoordinates(ls.Coordinates)) } return result }
go
func (ls LineString) WKT() string { var result string switch len(ls.Coordinates) { case 0: result = "LINESTRING EMPTY" default: result = fmt.Sprintf("LINESTRING (%v)", array2ToWKTCoordinates(ls.Coordinates)) } return result }
[ "func", "(", "ls", "LineString", ")", "WKT", "(", ")", "string", "{", "var", "result", "string", "\n", "switch", "len", "(", "ls", ".", "Coordinates", ")", "{", "case", "0", ":", "result", "=", "\"", "\"", "\n", "default", ":", "result", "=", "fmt"...
// WKT returns the Well Known Text representation of the linestring
[ "WKT", "returns", "the", "Well", "Known", "Text", "representation", "of", "the", "linestring" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L164-L173
148,115
venicegeo/geojson-go
geojson/geometry.go
PolygonFromBytes
func PolygonFromBytes(bytes []byte) (*Polygon, error) { var result Polygon err := json.Unmarshal(bytes, &result) return &result, err }
go
func PolygonFromBytes(bytes []byte) (*Polygon, error) { var result Polygon err := json.Unmarshal(bytes, &result) return &result, err }
[ "func", "PolygonFromBytes", "(", "bytes", "[", "]", "byte", ")", "(", "*", "Polygon", ",", "error", ")", "{", "var", "result", "Polygon", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",", "&", "result", ")", "\n", "return", "&", "result...
// PolygonFromBytes constructs a Polygon from a GeoJSON byte array // and returns its pointer
[ "PolygonFromBytes", "constructs", "a", "Polygon", "from", "a", "GeoJSON", "byte", "array", "and", "returns", "its", "pointer" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L184-L188
148,116
venicegeo/geojson-go
geojson/geometry.go
WKT
func (polygon Polygon) WKT() string { var result string switch len(polygon.Coordinates) { case 0: result = "POLYGON EMPTY" default: result = fmt.Sprintf("POLYGON (%v)", array3ToWKTCoordinates(polygon.Coordinates)) } return result }
go
func (polygon Polygon) WKT() string { var result string switch len(polygon.Coordinates) { case 0: result = "POLYGON EMPTY" default: result = fmt.Sprintf("POLYGON (%v)", array3ToWKTCoordinates(polygon.Coordinates)) } return result }
[ "func", "(", "polygon", "Polygon", ")", "WKT", "(", ")", "string", "{", "var", "result", "string", "\n", "switch", "len", "(", "polygon", ".", "Coordinates", ")", "{", "case", "0", ":", "result", "=", "\"", "\"", "\n", "default", ":", "result", "=", ...
// WKT returns the Well Known Text representation of the polygon
[ "WKT", "returns", "the", "Well", "Known", "Text", "representation", "of", "the", "polygon" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L226-L235
148,117
venicegeo/geojson-go
geojson/geometry.go
MultiPointFromBytes
func MultiPointFromBytes(bytes []byte) (*MultiPoint, error) { var result MultiPoint err := json.Unmarshal(bytes, &result) return &result, err }
go
func MultiPointFromBytes(bytes []byte) (*MultiPoint, error) { var result MultiPoint err := json.Unmarshal(bytes, &result) return &result, err }
[ "func", "MultiPointFromBytes", "(", "bytes", "[", "]", "byte", ")", "(", "*", "MultiPoint", ",", "error", ")", "{", "var", "result", "MultiPoint", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",", "&", "result", ")", "\n", "return", "&", ...
// MultiPointFromBytes constructs a MultiPoint from a GeoJSON byte array // and returns its pointer
[ "MultiPointFromBytes", "constructs", "a", "MultiPoint", "from", "a", "GeoJSON", "byte", "array", "and", "returns", "its", "pointer" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L246-L250
148,118
venicegeo/geojson-go
geojson/geometry.go
WKT
func (mp MultiPoint) WKT() string { var result string switch len(mp.Coordinates) { case 0: result = "MULTIPOINT EMPTY" default: result = fmt.Sprintf("MULTIPOINT (%v)", array2ToWKTCoordinates(mp.Coordinates)) } return result }
go
func (mp MultiPoint) WKT() string { var result string switch len(mp.Coordinates) { case 0: result = "MULTIPOINT EMPTY" default: result = fmt.Sprintf("MULTIPOINT (%v)", array2ToWKTCoordinates(mp.Coordinates)) } return result }
[ "func", "(", "mp", "MultiPoint", ")", "WKT", "(", ")", "string", "{", "var", "result", "string", "\n", "switch", "len", "(", "mp", ".", "Coordinates", ")", "{", "case", "0", ":", "result", "=", "\"", "\"", "\n", "default", ":", "result", "=", "fmt"...
// WKT returns the Well Known Text representation of the multipoint
[ "WKT", "returns", "the", "Well", "Known", "Text", "representation", "of", "the", "multipoint" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L288-L297
148,119
venicegeo/geojson-go
geojson/geometry.go
MultiLineStringFromBytes
func MultiLineStringFromBytes(bytes []byte) (*MultiLineString, error) { var result MultiLineString err := json.Unmarshal(bytes, &result) return &result, err }
go
func MultiLineStringFromBytes(bytes []byte) (*MultiLineString, error) { var result MultiLineString err := json.Unmarshal(bytes, &result) return &result, err }
[ "func", "MultiLineStringFromBytes", "(", "bytes", "[", "]", "byte", ")", "(", "*", "MultiLineString", ",", "error", ")", "{", "var", "result", "MultiLineString", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",", "&", "result", ")", "\n", "r...
// MultiLineStringFromBytes constructs a MultiLineString from a GeoJSON byte array // and returns its pointer
[ "MultiLineStringFromBytes", "constructs", "a", "MultiLineString", "from", "a", "GeoJSON", "byte", "array", "and", "returns", "its", "pointer" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L308-L312
148,120
venicegeo/geojson-go
geojson/geometry.go
WKT
func (mls MultiLineString) WKT() string { var result string switch len(mls.Coordinates) { case 0: result = "MULTILINESTRING EMPTY" default: result = fmt.Sprintf("MULTILINESTRING (%v)", array3ToWKTCoordinates(mls.Coordinates)) } return result }
go
func (mls MultiLineString) WKT() string { var result string switch len(mls.Coordinates) { case 0: result = "MULTILINESTRING EMPTY" default: result = fmt.Sprintf("MULTILINESTRING (%v)", array3ToWKTCoordinates(mls.Coordinates)) } return result }
[ "func", "(", "mls", "MultiLineString", ")", "WKT", "(", ")", "string", "{", "var", "result", "string", "\n", "switch", "len", "(", "mls", ".", "Coordinates", ")", "{", "case", "0", ":", "result", "=", "\"", "\"", "\n", "default", ":", "result", "=", ...
// WKT returns the Well Known Text representation of the multilinestring
[ "WKT", "returns", "the", "Well", "Known", "Text", "representation", "of", "the", "multilinestring" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L350-L359
148,121
venicegeo/geojson-go
geojson/geometry.go
MultiPolygonFromBytes
func MultiPolygonFromBytes(bytes []byte) (*MultiPolygon, error) { var result MultiPolygon err := json.Unmarshal(bytes, &result) return &result, err }
go
func MultiPolygonFromBytes(bytes []byte) (*MultiPolygon, error) { var result MultiPolygon err := json.Unmarshal(bytes, &result) return &result, err }
[ "func", "MultiPolygonFromBytes", "(", "bytes", "[", "]", "byte", ")", "(", "*", "MultiPolygon", ",", "error", ")", "{", "var", "result", "MultiPolygon", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",", "&", "result", ")", "\n", "return", ...
// MultiPolygonFromBytes constructs a MultiPolygon from a GeoJSON byte array // and returns its pointer
[ "MultiPolygonFromBytes", "constructs", "a", "MultiPolygon", "from", "a", "GeoJSON", "byte", "array", "and", "returns", "its", "pointer" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L370-L374
148,122
venicegeo/geojson-go
geojson/geometry.go
WKT
func (mp MultiPolygon) WKT() string { var result string switch len(mp.Coordinates) { case 0: result = "MULTIPOLYGON EMPTY" default: result = fmt.Sprintf("MULTIPOLYGON (%v)", array4ToWKTCoordinates(mp.Coordinates)) } return result }
go
func (mp MultiPolygon) WKT() string { var result string switch len(mp.Coordinates) { case 0: result = "MULTIPOLYGON EMPTY" default: result = fmt.Sprintf("MULTIPOLYGON (%v)", array4ToWKTCoordinates(mp.Coordinates)) } return result }
[ "func", "(", "mp", "MultiPolygon", ")", "WKT", "(", ")", "string", "{", "var", "result", "string", "\n", "switch", "len", "(", "mp", ".", "Coordinates", ")", "{", "case", "0", ":", "result", "=", "\"", "\"", "\n", "default", ":", "result", "=", "fm...
// WKT returns the Well Known Text representation of the multipolygon
[ "WKT", "returns", "the", "Well", "Known", "Text", "representation", "of", "the", "multipolygon" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L412-L421
148,123
venicegeo/geojson-go
geojson/geometry.go
GeometryCollectionFromBytes
func GeometryCollectionFromBytes(bytes []byte) (*GeometryCollection, error) { var result GeometryCollection err := json.Unmarshal(bytes, &result) var geometries []interface{} for _, curr := range result.Geometries { gmap := curr.(map[string]interface{}) geometry := newGeometry(gmap) geometries = append(geomet...
go
func GeometryCollectionFromBytes(bytes []byte) (*GeometryCollection, error) { var result GeometryCollection err := json.Unmarshal(bytes, &result) var geometries []interface{} for _, curr := range result.Geometries { gmap := curr.(map[string]interface{}) geometry := newGeometry(gmap) geometries = append(geomet...
[ "func", "GeometryCollectionFromBytes", "(", "bytes", "[", "]", "byte", ")", "(", "*", "GeometryCollection", ",", "error", ")", "{", "var", "result", "GeometryCollection", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",", "&", "result", ")", "...
// GeometryCollectionFromBytes constructs a GeometryCollection from a GeoJSON byte array
[ "GeometryCollectionFromBytes", "constructs", "a", "GeometryCollection", "from", "a", "GeoJSON", "byte", "array" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L431-L442
148,124
venicegeo/geojson-go
geojson/geometry.go
NewGeometryCollection
func NewGeometryCollection(geometries []interface{}) *GeometryCollection { if geometries == nil { geometries = make([]interface{}, 0) } return &GeometryCollection{Type: GEOMETRYCOLLECTION, Geometries: geometries} }
go
func NewGeometryCollection(geometries []interface{}) *GeometryCollection { if geometries == nil { geometries = make([]interface{}, 0) } return &GeometryCollection{Type: GEOMETRYCOLLECTION, Geometries: geometries} }
[ "func", "NewGeometryCollection", "(", "geometries", "[", "]", "interface", "{", "}", ")", "*", "GeometryCollection", "{", "if", "geometries", "==", "nil", "{", "geometries", "=", "make", "(", "[", "]", "interface", "{", "}", ",", "0", ")", "\n", "}", "...
// NewGeometryCollection is the normal factory method for a GeometryCollection
[ "NewGeometryCollection", "is", "the", "normal", "factory", "method", "for", "a", "GeometryCollection" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L487-L492
148,125
venicegeo/geojson-go
geojson/geometry.go
interfaceToArray
func interfaceToArray(input interface{}) interface{} { var ( result interface{} coords []float64 coords2 [][]float64 coords3 [][][]float64 coords4 [][][][]float64 ) switch it := input.(type) { case []float64, [][]float64, [][][]float64, [][][][]float64: result = it case []interface{}: for inx := 0;...
go
func interfaceToArray(input interface{}) interface{} { var ( result interface{} coords []float64 coords2 [][]float64 coords3 [][][]float64 coords4 [][][][]float64 ) switch it := input.(type) { case []float64, [][]float64, [][][]float64, [][][][]float64: result = it case []interface{}: for inx := 0;...
[ "func", "interfaceToArray", "(", "input", "interface", "{", "}", ")", "interface", "{", "}", "{", "var", "(", "result", "interface", "{", "}", "\n", "coords", "[", "]", "float64", "\n", "coords2", "[", "]", "[", "]", "float64", "\n", "coords3", "[", ...
// This quasi-recursive function determines drills into the // multidimensional array of interfaces to build a proper // coordinate array of the right dimension
[ "This", "quasi", "-", "recursive", "function", "determines", "drills", "into", "the", "multidimensional", "array", "of", "interfaces", "to", "build", "a", "proper", "coordinate", "array", "of", "the", "right", "dimension" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L497-L530
148,126
venicegeo/geojson-go
geojson/geometry.go
newGeometry
func newGeometry(input interface{}) interface{} { var ( result interface{} coordinates interface{} ) switch it := input.(type) { case map[string]interface{}: if _, ok := it[COORDINATES]; ok { coordinates = interfaceToArray(it[COORDINATES]) } iType := it[TYPE].(string) switch iType { case POINT...
go
func newGeometry(input interface{}) interface{} { var ( result interface{} coordinates interface{} ) switch it := input.(type) { case map[string]interface{}: if _, ok := it[COORDINATES]; ok { coordinates = interfaceToArray(it[COORDINATES]) } iType := it[TYPE].(string) switch iType { case POINT...
[ "func", "newGeometry", "(", "input", "interface", "{", "}", ")", "interface", "{", "}", "{", "var", "(", "result", "interface", "{", "}", "\n", "coordinates", "interface", "{", "}", "\n", ")", "\n", "switch", "it", ":=", "input", ".", "(", "type", ")...
// newGeometry constructs a Geometry from an interface that represents a // GeoJSON Geometry Object
[ "newGeometry", "constructs", "a", "Geometry", "from", "an", "interface", "that", "represents", "a", "GeoJSON", "Geometry", "Object" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L534-L569
148,127
venicegeo/geojson-go
geojson/geometry.go
ToGeometryArray
func ToGeometryArray(gjObject interface{}) []interface{} { var result []interface{} switch typedGJ := gjObject.(type) { case *FeatureCollection: // re-enter with dereferenced pointer result = ToGeometryArray(*typedGJ) case FeatureCollection: for _, current := range typedGJ.Features { result = append(result...
go
func ToGeometryArray(gjObject interface{}) []interface{} { var result []interface{} switch typedGJ := gjObject.(type) { case *FeatureCollection: // re-enter with dereferenced pointer result = ToGeometryArray(*typedGJ) case FeatureCollection: for _, current := range typedGJ.Features { result = append(result...
[ "func", "ToGeometryArray", "(", "gjObject", "interface", "{", "}", ")", "[", "]", "interface", "{", "}", "{", "var", "result", "[", "]", "interface", "{", "}", "\n", "switch", "typedGJ", ":=", "gjObject", ".", "(", "type", ")", "{", "case", "*", "Fea...
// ToGeometryArray takes a GeoJSON object and returns an array of // its constituent geometry objects
[ "ToGeometryArray", "takes", "a", "GeoJSON", "object", "and", "returns", "an", "array", "of", "its", "constituent", "geometry", "objects" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L608-L631
148,128
venicegeo/geojson-go
geojson/geometry.go
WKT
func WKT(input string) interface{} { parts := strings.SplitN(input, " ", 2) name := parts[0] predicate := parseWKTPredicate(parts[1]) switch name { case "POINT": if coords, ok := predicate.([]float64); ok { return NewPoint(coords) } return NewPoint(nil) case "POLYGON": if coords, ok := predicate.([][]...
go
func WKT(input string) interface{} { parts := strings.SplitN(input, " ", 2) name := parts[0] predicate := parseWKTPredicate(parts[1]) switch name { case "POINT": if coords, ok := predicate.([]float64); ok { return NewPoint(coords) } return NewPoint(nil) case "POLYGON": if coords, ok := predicate.([][]...
[ "func", "WKT", "(", "input", "string", ")", "interface", "{", "}", "{", "parts", ":=", "strings", ".", "SplitN", "(", "input", ",", "\"", "\"", ",", "2", ")", "\n", "name", ":=", "parts", "[", "0", "]", "\n", "predicate", ":=", "parseWKTPredicate", ...
// WKT returns a GeoJSON object based on the Well-Known Text input
[ "WKT", "returns", "a", "GeoJSON", "object", "based", "on", "the", "Well", "-", "Known", "Text", "input" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/geometry.go#L634-L665
148,129
cloud-ca/go-cloudca
services/cloudca/instance.go
Get
func (instanceApi *InstanceApi) Get(id string) (*Instance, error) { data, err := instanceApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseInstance(data), nil }
go
func (instanceApi *InstanceApi) Get(id string) (*Instance, error) { data, err := instanceApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseInstance(data), nil }
[ "func", "(", "instanceApi", "*", "InstanceApi", ")", "Get", "(", "id", "string", ")", "(", "*", "Instance", ",", "error", ")", "{", "data", ",", "err", ":=", "instanceApi", ".", "entityService", ".", "Get", "(", "id", ",", "map", "[", "string", "]", ...
//Get instance with the specified id for the current environment
[ "Get", "instance", "with", "the", "specified", "id", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/instance.go#L126-L132
148,130
cloud-ca/go-cloudca
services/cloudca/instance.go
Create
func (instanceApi *InstanceApi) Create(instance Instance) (*Instance, error) { send, merr := json.Marshal(instance) if merr != nil { return nil, merr } body, err := instanceApi.entityService.Create(send, map[string]string{}) if err != nil { return nil, err } return parseInstance(body), nil }
go
func (instanceApi *InstanceApi) Create(instance Instance) (*Instance, error) { send, merr := json.Marshal(instance) if merr != nil { return nil, merr } body, err := instanceApi.entityService.Create(send, map[string]string{}) if err != nil { return nil, err } return parseInstance(body), nil }
[ "func", "(", "instanceApi", "*", "InstanceApi", ")", "Create", "(", "instance", "Instance", ")", "(", "*", "Instance", ",", "error", ")", "{", "send", ",", "merr", ":=", "json", ".", "Marshal", "(", "instance", ")", "\n", "if", "merr", "!=", "nil", "...
//Create an instance in the current environment
[ "Create", "an", "instance", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/instance.go#L149-L159
148,131
cloud-ca/go-cloudca
services/cloudca/instance.go
Purge
func (instanceApi *InstanceApi) Purge(id string) (bool, error) { _, err := instanceApi.entityService.Execute(id, INSTANCE_PURGE_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
go
func (instanceApi *InstanceApi) Purge(id string) (bool, error) { _, err := instanceApi.entityService.Execute(id, INSTANCE_PURGE_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
[ "func", "(", "instanceApi", "*", "InstanceApi", ")", "Purge", "(", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "instanceApi", ".", "entityService", ".", "Execute", "(", "id", ",", "INSTANCE_PURGE_OPERATION", ",", "[",...
//Purge an instance with the specified id in the current environment //The instance must be in the Destroyed state. To destroy and purge an instance, see the Destroy method
[ "Purge", "an", "instance", "with", "the", "specified", "id", "in", "the", "current", "environment", "The", "instance", "must", "be", "in", "the", "Destroyed", "state", ".", "To", "destroy", "and", "purge", "an", "instance", "see", "the", "Destroy", "method" ...
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/instance.go#L187-L190
148,132
cloud-ca/go-cloudca
services/cloudca/instance.go
Exists
func (instanceApi *InstanceApi) Exists(id string) (bool, error) { _, err := instanceApi.Get(id) if err != nil { if ccaError, ok := err.(api.CcaErrorResponse); ok && ccaError.StatusCode == 404 { return false, nil } return false, err } return true, nil }
go
func (instanceApi *InstanceApi) Exists(id string) (bool, error) { _, err := instanceApi.Get(id) if err != nil { if ccaError, ok := err.(api.CcaErrorResponse); ok && ccaError.StatusCode == 404 { return false, nil } return false, err } return true, nil }
[ "func", "(", "instanceApi", "*", "InstanceApi", ")", "Exists", "(", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "instanceApi", ".", "Get", "(", "id", ")", "\n", "if", "err", "!=", "nil", "{", "if", "ccaError", ...
//Check if instance with specified id exists in the current environment
[ "Check", "if", "instance", "with", "specified", "id", "exists", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/instance.go#L200-L209
148,133
cloud-ca/go-cloudca
services/cloudca/instance.go
Start
func (instanceApi *InstanceApi) Start(id string) (bool, error) { _, err := instanceApi.entityService.Execute(id, INSTANCE_START_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
go
func (instanceApi *InstanceApi) Start(id string) (bool, error) { _, err := instanceApi.entityService.Execute(id, INSTANCE_START_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
[ "func", "(", "instanceApi", "*", "InstanceApi", ")", "Start", "(", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "instanceApi", ".", "entityService", ".", "Execute", "(", "id", ",", "INSTANCE_START_OPERATION", ",", "[",...
//Start a stopped instance with specified id exists in the current environment
[ "Start", "a", "stopped", "instance", "with", "specified", "id", "exists", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/instance.go#L212-L215
148,134
cloud-ca/go-cloudca
services/cloudca/instance.go
Stop
func (instanceApi *InstanceApi) Stop(id string) (bool, error) { _, err := instanceApi.entityService.Execute(id, INSTANCE_STOP_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
go
func (instanceApi *InstanceApi) Stop(id string) (bool, error) { _, err := instanceApi.entityService.Execute(id, INSTANCE_STOP_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
[ "func", "(", "instanceApi", "*", "InstanceApi", ")", "Stop", "(", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "instanceApi", ".", "entityService", ".", "Execute", "(", "id", ",", "INSTANCE_STOP_OPERATION", ",", "[", ...
//Stop a running instance with specified id exists in the current environment
[ "Stop", "a", "running", "instance", "with", "specified", "id", "exists", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/instance.go#L218-L221
148,135
cloud-ca/go-cloudca
services/cloudca/instance.go
Reboot
func (instanceApi *InstanceApi) Reboot(id string) (bool, error) { _, err := instanceApi.entityService.Execute(id, INSTANCE_REBOOT_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
go
func (instanceApi *InstanceApi) Reboot(id string) (bool, error) { _, err := instanceApi.entityService.Execute(id, INSTANCE_REBOOT_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
[ "func", "(", "instanceApi", "*", "InstanceApi", ")", "Reboot", "(", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "instanceApi", ".", "entityService", ".", "Execute", "(", "id", ",", "INSTANCE_REBOOT_OPERATION", ",", "[...
//Reboot a running instance with specified id exists in the current environment
[ "Reboot", "a", "running", "instance", "with", "specified", "id", "exists", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/instance.go#L237-L240
148,136
cloud-ca/go-cloudca
services/cloudca/instance.go
ResetPassword
func (instanceApi *InstanceApi) ResetPassword(id string) (string, error) { body, err := instanceApi.entityService.Execute(id, INSTANCE_RESET_PASSWORD_OPERATION, []byte{}, map[string]string{}) if err != nil { return "", err } instance := parseInstance(body) return instance.Password, nil }
go
func (instanceApi *InstanceApi) ResetPassword(id string) (string, error) { body, err := instanceApi.entityService.Execute(id, INSTANCE_RESET_PASSWORD_OPERATION, []byte{}, map[string]string{}) if err != nil { return "", err } instance := parseInstance(body) return instance.Password, nil }
[ "func", "(", "instanceApi", "*", "InstanceApi", ")", "ResetPassword", "(", "id", "string", ")", "(", "string", ",", "error", ")", "{", "body", ",", "err", ":=", "instanceApi", ".", "entityService", ".", "Execute", "(", "id", ",", "INSTANCE_RESET_PASSWORD_OPE...
//Reset the password of the instance with the specified id exists in the current environment
[ "Reset", "the", "password", "of", "the", "instance", "with", "the", "specified", "id", "exists", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/instance.go#L254-L261
148,137
cloud-ca/go-cloudca
services/cloudca/instance.go
CreateRecoveryPoint
func (instanceApi *InstanceApi) CreateRecoveryPoint(id string, recoveryPoint RecoveryPoint) (bool, error) { send, merr := json.Marshal(Instance{ RecoveryPoint: recoveryPoint, }) if merr != nil { return false, merr } _, err := instanceApi.entityService.Execute(id, INSTANCE_CREATE_RECOVERY_POINT_OPERATION, send,...
go
func (instanceApi *InstanceApi) CreateRecoveryPoint(id string, recoveryPoint RecoveryPoint) (bool, error) { send, merr := json.Marshal(Instance{ RecoveryPoint: recoveryPoint, }) if merr != nil { return false, merr } _, err := instanceApi.entityService.Execute(id, INSTANCE_CREATE_RECOVERY_POINT_OPERATION, send,...
[ "func", "(", "instanceApi", "*", "InstanceApi", ")", "CreateRecoveryPoint", "(", "id", "string", ",", "recoveryPoint", "RecoveryPoint", ")", "(", "bool", ",", "error", ")", "{", "send", ",", "merr", ":=", "json", ".", "Marshal", "(", "Instance", "{", "Reco...
//Create a recovery point of the instance with the specified id exists in the current environment
[ "Create", "a", "recovery", "point", "of", "the", "instance", "with", "the", "specified", "id", "exists", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/instance.go#L275-L284
148,138
cloud-ca/go-cloudca
services/cloudca/vpc.go
Get
func (vpcApi *VpcApi) Get(id string) (*Vpc, error) { data, err := vpcApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseVpc(data), nil }
go
func (vpcApi *VpcApi) Get(id string) (*Vpc, error) { data, err := vpcApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseVpc(data), nil }
[ "func", "(", "vpcApi", "*", "VpcApi", ")", "Get", "(", "id", "string", ")", "(", "*", "Vpc", ",", "error", ")", "{", "data", ",", "err", ":=", "vpcApi", ".", "entityService", ".", "Get", "(", "id", ",", "map", "[", "string", "]", "string", "{", ...
//Get vpc with the specified id for the current environment
[ "Get", "vpc", "with", "the", "specified", "id", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/vpc.go#L61-L67
148,139
cloud-ca/go-cloudca
services/cloudca/vpc.go
ListWithOptions
func (vpcApi *VpcApi) ListWithOptions(options map[string]string) ([]Vpc, error) { data, err := vpcApi.entityService.List(options) if err != nil { return nil, err } return parseVpcList(data), nil }
go
func (vpcApi *VpcApi) ListWithOptions(options map[string]string) ([]Vpc, error) { data, err := vpcApi.entityService.List(options) if err != nil { return nil, err } return parseVpcList(data), nil }
[ "func", "(", "vpcApi", "*", "VpcApi", ")", "ListWithOptions", "(", "options", "map", "[", "string", "]", "string", ")", "(", "[", "]", "Vpc", ",", "error", ")", "{", "data", ",", "err", ":=", "vpcApi", ".", "entityService", ".", "List", "(", "options...
//List all vpcs for the current environment. Can use options to do sorting and paging.
[ "List", "all", "vpcs", "for", "the", "current", "environment", ".", "Can", "use", "options", "to", "do", "sorting", "and", "paging", "." ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/vpc.go#L75-L81
148,140
cloud-ca/go-cloudca
services/cloudca/vpc.go
Create
func (vpcApi *VpcApi) Create(vpc Vpc) (*Vpc, error) { send, merr := json.Marshal(vpc) if merr != nil { return nil, merr } body, err := vpcApi.entityService.Create(send, map[string]string{}) if err != nil { return nil, err } return parseVpc(body), nil }
go
func (vpcApi *VpcApi) Create(vpc Vpc) (*Vpc, error) { send, merr := json.Marshal(vpc) if merr != nil { return nil, merr } body, err := vpcApi.entityService.Create(send, map[string]string{}) if err != nil { return nil, err } return parseVpc(body), nil }
[ "func", "(", "vpcApi", "*", "VpcApi", ")", "Create", "(", "vpc", "Vpc", ")", "(", "*", "Vpc", ",", "error", ")", "{", "send", ",", "merr", ":=", "json", ".", "Marshal", "(", "vpc", ")", "\n", "if", "merr", "!=", "nil", "{", "return", "nil", ","...
//Create an vpc in the current environment
[ "Create", "an", "vpc", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/vpc.go#L84-L94
148,141
cloud-ca/go-cloudca
services/cloudca/vpc.go
Destroy
func (vpcApi *VpcApi) Destroy(id string) (bool, error) { _, err := vpcApi.entityService.Delete(id, []byte{}, map[string]string{}) return err == nil, err }
go
func (vpcApi *VpcApi) Destroy(id string) (bool, error) { _, err := vpcApi.entityService.Delete(id, []byte{}, map[string]string{}) return err == nil, err }
[ "func", "(", "vpcApi", "*", "VpcApi", ")", "Destroy", "(", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "vpcApi", ".", "entityService", ".", "Delete", "(", "id", ",", "[", "]", "byte", "{", "}", ",", "map", "...
//Destroy a vpc with specified id in the current environment
[ "Destroy", "a", "vpc", "with", "specified", "id", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/vpc.go#L110-L113
148,142
cloud-ca/go-cloudca
services/cloudca/vpc.go
RestartRouter
func (vpcApi *VpcApi) RestartRouter(id string) (bool, error) { _, err := vpcApi.entityService.Execute(id, VPC_RESTART_ROUTER_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
go
func (vpcApi *VpcApi) RestartRouter(id string) (bool, error) { _, err := vpcApi.entityService.Execute(id, VPC_RESTART_ROUTER_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
[ "func", "(", "vpcApi", "*", "VpcApi", ")", "RestartRouter", "(", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "vpcApi", ".", "entityService", ".", "Execute", "(", "id", ",", "VPC_RESTART_ROUTER_OPERATION", ",", "[", ...
//Restart the router of the vpc with the specified id exists in the current environment
[ "Restart", "the", "router", "of", "the", "vpc", "with", "the", "specified", "id", "exists", "in", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/vpc.go#L116-L119
148,143
cloud-ca/go-cloudca
services/cloudca/remote_access_vpn.go
NewRemoteAccessVpnService
func NewRemoteAccessVpnService(apiClient api.ApiClient, serviceCode string, environmentName string) RemoteAccessVpnService { return &RemoteAccessVpnApi{ entityService: services.NewEntityService(apiClient, serviceCode, environmentName, REMOTE_ACCESS_VPN_ENTITY_TYPE), } }
go
func NewRemoteAccessVpnService(apiClient api.ApiClient, serviceCode string, environmentName string) RemoteAccessVpnService { return &RemoteAccessVpnApi{ entityService: services.NewEntityService(apiClient, serviceCode, environmentName, REMOTE_ACCESS_VPN_ENTITY_TYPE), } }
[ "func", "NewRemoteAccessVpnService", "(", "apiClient", "api", ".", "ApiClient", ",", "serviceCode", "string", ",", "environmentName", "string", ")", "RemoteAccessVpnService", "{", "return", "&", "RemoteAccessVpnApi", "{", "entityService", ":", "services", ".", "NewEnt...
// NewRemoteAccessVpnService creates a new VPN Service for this specific service and environment
[ "NewRemoteAccessVpnService", "creates", "a", "new", "VPN", "Service", "for", "this", "specific", "service", "and", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/remote_access_vpn.go#L41-L45
148,144
cloud-ca/go-cloudca
services/cloudca/remote_access_vpn.go
Get
func (remoteAccessVpnApi *RemoteAccessVpnApi) Get(id string) (*RemoteAccessVpn, error) { data, err := remoteAccessVpnApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseRemoteAccessVpn(data), nil }
go
func (remoteAccessVpnApi *RemoteAccessVpnApi) Get(id string) (*RemoteAccessVpn, error) { data, err := remoteAccessVpnApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseRemoteAccessVpn(data), nil }
[ "func", "(", "remoteAccessVpnApi", "*", "RemoteAccessVpnApi", ")", "Get", "(", "id", "string", ")", "(", "*", "RemoteAccessVpn", ",", "error", ")", "{", "data", ",", "err", ":=", "remoteAccessVpnApi", ".", "entityService", ".", "Get", "(", "id", ",", "map"...
// Get a specific VPN in the current environment by its ID
[ "Get", "a", "specific", "VPN", "in", "the", "current", "environment", "by", "its", "ID" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/remote_access_vpn.go#L60-L66
148,145
cloud-ca/go-cloudca
services/cloudca/remote_access_vpn.go
ListWithOptions
func (remoteAccessVpnApi *RemoteAccessVpnApi) ListWithOptions(options map[string]string) ([]RemoteAccessVpn, error) { data, err := remoteAccessVpnApi.entityService.List(options) if err != nil { return nil, err } return parseRemoteAccessVpnList(data), nil }
go
func (remoteAccessVpnApi *RemoteAccessVpnApi) ListWithOptions(options map[string]string) ([]RemoteAccessVpn, error) { data, err := remoteAccessVpnApi.entityService.List(options) if err != nil { return nil, err } return parseRemoteAccessVpnList(data), nil }
[ "func", "(", "remoteAccessVpnApi", "*", "RemoteAccessVpnApi", ")", "ListWithOptions", "(", "options", "map", "[", "string", "]", "string", ")", "(", "[", "]", "RemoteAccessVpn", ",", "error", ")", "{", "data", ",", "err", ":=", "remoteAccessVpnApi", ".", "en...
// ListWithOptions lists the available VPNs in the current environment with options
[ "ListWithOptions", "lists", "the", "available", "VPNs", "in", "the", "current", "environment", "with", "options" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/remote_access_vpn.go#L74-L80
148,146
cloud-ca/go-cloudca
services/cloudca/remote_access_vpn.go
Enable
func (remoteAccessVpnApi *RemoteAccessVpnApi) Enable(id string) (bool, error) { _, err := remoteAccessVpnApi.entityService.Execute(id, REMOTE_ACCESS_VPN_ENABLE_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
go
func (remoteAccessVpnApi *RemoteAccessVpnApi) Enable(id string) (bool, error) { _, err := remoteAccessVpnApi.entityService.Execute(id, REMOTE_ACCESS_VPN_ENABLE_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
[ "func", "(", "remoteAccessVpnApi", "*", "RemoteAccessVpnApi", ")", "Enable", "(", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "remoteAccessVpnApi", ".", "entityService", ".", "Execute", "(", "id", ",", "REMOTE_ACCESS_VPN_...
// Enable a specific VPN in the current environment by its ID
[ "Enable", "a", "specific", "VPN", "in", "the", "current", "environment", "by", "its", "ID" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/remote_access_vpn.go#L83-L86
148,147
cloud-ca/go-cloudca
services/cloudca/remote_access_vpn.go
Disable
func (remoteAccessVpnApi *RemoteAccessVpnApi) Disable(id string) (bool, error) { _, err := remoteAccessVpnApi.entityService.Execute(id, REMOTE_ACCESS_VPN_DISABLE_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
go
func (remoteAccessVpnApi *RemoteAccessVpnApi) Disable(id string) (bool, error) { _, err := remoteAccessVpnApi.entityService.Execute(id, REMOTE_ACCESS_VPN_DISABLE_OPERATION, []byte{}, map[string]string{}) return err == nil, err }
[ "func", "(", "remoteAccessVpnApi", "*", "RemoteAccessVpnApi", ")", "Disable", "(", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "remoteAccessVpnApi", ".", "entityService", ".", "Execute", "(", "id", ",", "REMOTE_ACCESS_VPN...
// Disable a specific VPN in the current environment by its ID
[ "Disable", "a", "specific", "VPN", "in", "the", "current", "environment", "by", "its", "ID" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/remote_access_vpn.go#L89-L92
148,148
cloud-ca/go-cloudca
services/cloudca/network.go
Get
func (networkApi *NetworkApi) Get(id string) (*Network, error) { data, err := networkApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseNetwork(data), nil }
go
func (networkApi *NetworkApi) Get(id string) (*Network, error) { data, err := networkApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseNetwork(data), nil }
[ "func", "(", "networkApi", "*", "NetworkApi", ")", "Get", "(", "id", "string", ")", "(", "*", "Network", ",", "error", ")", "{", "data", ",", "err", ":=", "networkApi", ".", "entityService", ".", "Get", "(", "id", ",", "map", "[", "string", "]", "s...
//Get network with the specified id for the current environment
[ "Get", "network", "with", "the", "specified", "id", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/network.go#L71-L77
148,149
cloud-ca/go-cloudca
services/cloudca/network.go
ListOfVpc
func (networkApi *NetworkApi) ListOfVpc(vpcId string) ([]Network, error) { return networkApi.ListWithOptions(map[string]string{ vpcId: vpcId, }) }
go
func (networkApi *NetworkApi) ListOfVpc(vpcId string) ([]Network, error) { return networkApi.ListWithOptions(map[string]string{ vpcId: vpcId, }) }
[ "func", "(", "networkApi", "*", "NetworkApi", ")", "ListOfVpc", "(", "vpcId", "string", ")", "(", "[", "]", "Network", ",", "error", ")", "{", "return", "networkApi", ".", "ListWithOptions", "(", "map", "[", "string", "]", "string", "{", "vpcId", ":", ...
//List all networks of a vpc for the current environment
[ "List", "all", "networks", "of", "a", "vpc", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/network.go#L85-L89
148,150
cloud-ca/go-cloudca
services/cloudca/network.go
ListWithOptions
func (networkApi *NetworkApi) ListWithOptions(options map[string]string) ([]Network, error) { data, err := networkApi.entityService.List(options) if err != nil { return nil, err } return parseNetworkList(data), nil }
go
func (networkApi *NetworkApi) ListWithOptions(options map[string]string) ([]Network, error) { data, err := networkApi.entityService.List(options) if err != nil { return nil, err } return parseNetworkList(data), nil }
[ "func", "(", "networkApi", "*", "NetworkApi", ")", "ListWithOptions", "(", "options", "map", "[", "string", "]", "string", ")", "(", "[", "]", "Network", ",", "error", ")", "{", "data", ",", "err", ":=", "networkApi", ".", "entityService", ".", "List", ...
//List all networks for the current environment. Can use options to do sorting and paging.
[ "List", "all", "networks", "for", "the", "current", "environment", ".", "Can", "use", "options", "to", "do", "sorting", "and", "paging", "." ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/network.go#L92-L98
148,151
cloud-ca/go-cloudca
configuration/organization.go
ListWithOptions
func (organizationApi *OrganizationApi) ListWithOptions(options map[string]string) ([]Organization, error) { data, err := organizationApi.configurationService.List(options) if err != nil { return nil, err } return parseOrganizationList(data), nil }
go
func (organizationApi *OrganizationApi) ListWithOptions(options map[string]string) ([]Organization, error) { data, err := organizationApi.configurationService.List(options) if err != nil { return nil, err } return parseOrganizationList(data), nil }
[ "func", "(", "organizationApi", "*", "OrganizationApi", ")", "ListWithOptions", "(", "options", "map", "[", "string", "]", "string", ")", "(", "[", "]", "Organization", ",", "error", ")", "{", "data", ",", "err", ":=", "organizationApi", ".", "configurationS...
//List all organizations. Can use options to do sorting and paging.
[ "List", "all", "organizations", ".", "Can", "use", "options", "to", "do", "sorting", "and", "paging", "." ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/configuration/organization.go#L60-L66
148,152
cloud-ca/go-cloudca
services/task.go
Get
func (taskApi *TaskApi) Get(id string) (*Task, error) { request := api.CcaRequest{ Method: api.GET, Endpoint: "tasks/" + id, } response, err := taskApi.apiClient.Do(request) if err != nil { return nil, err } else if len(response.Errors) > 0 { return nil, api.CcaErrorResponse(*response) } data := respon...
go
func (taskApi *TaskApi) Get(id string) (*Task, error) { request := api.CcaRequest{ Method: api.GET, Endpoint: "tasks/" + id, } response, err := taskApi.apiClient.Do(request) if err != nil { return nil, err } else if len(response.Errors) > 0 { return nil, api.CcaErrorResponse(*response) } data := respon...
[ "func", "(", "taskApi", "*", "TaskApi", ")", "Get", "(", "id", "string", ")", "(", "*", "Task", ",", "error", ")", "{", "request", ":=", "api", ".", "CcaRequest", "{", "Method", ":", "api", ".", "GET", ",", "Endpoint", ":", "\"", "\"", "+", "id",...
//Retrieve a Task with sepecified id
[ "Retrieve", "a", "Task", "with", "sepecified", "id" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/task.go#L51-L74
148,153
cloud-ca/go-cloudca
services/task.go
Poll
func (taskApi *TaskApi) Poll(id string, milliseconds time.Duration) ([]byte, error) { ticker := time.NewTicker(time.Millisecond * milliseconds) task, err := taskApi.Get(id) if err != nil { return nil, err } done := task.Completed() for !done { <-ticker.C task, err = taskApi.Get(id) if err != nil { retu...
go
func (taskApi *TaskApi) Poll(id string, milliseconds time.Duration) ([]byte, error) { ticker := time.NewTicker(time.Millisecond * milliseconds) task, err := taskApi.Get(id) if err != nil { return nil, err } done := task.Completed() for !done { <-ticker.C task, err = taskApi.Get(id) if err != nil { retu...
[ "func", "(", "taskApi", "*", "TaskApi", ")", "Poll", "(", "id", "string", ",", "milliseconds", "time", ".", "Duration", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "time", ".", "Millisecond", "*"...
//Poll an the Task API. Blocks until success or failure. //Returns result on success, an error otherwise
[ "Poll", "an", "the", "Task", "API", ".", "Blocks", "until", "success", "or", "failure", ".", "Returns", "result", "on", "success", "an", "error", "otherwise" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/task.go#L78-L97
148,154
cloud-ca/go-cloudca
services/task.go
PollResponse
func (taskApi *TaskApi) PollResponse(response *api.CcaResponse, milliseconds time.Duration) ([]byte, error) { if strings.EqualFold(response.TaskStatus, SUCCESS) { return response.Data, nil } else if strings.EqualFold(response.TaskStatus, FAILED) { return nil, api.CcaErrorResponse(*response) } return taskApi.Pol...
go
func (taskApi *TaskApi) PollResponse(response *api.CcaResponse, milliseconds time.Duration) ([]byte, error) { if strings.EqualFold(response.TaskStatus, SUCCESS) { return response.Data, nil } else if strings.EqualFold(response.TaskStatus, FAILED) { return nil, api.CcaErrorResponse(*response) } return taskApi.Pol...
[ "func", "(", "taskApi", "*", "TaskApi", ")", "PollResponse", "(", "response", "*", "api", ".", "CcaResponse", ",", "milliseconds", "time", ".", "Duration", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "strings", ".", "EqualFold", "(", "res...
//Poll an the Task API. Blocks until success or failure
[ "Poll", "an", "the", "Task", "API", ".", "Blocks", "until", "success", "or", "failure" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/task.go#L100-L107
148,155
cloud-ca/go-cloudca
services/cloudca/volume.go
Get
func (volumeApi *VolumeApi) Get(id string) (*Volume, error) { data, err := volumeApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseVolume(data), nil }
go
func (volumeApi *VolumeApi) Get(id string) (*Volume, error) { data, err := volumeApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseVolume(data), nil }
[ "func", "(", "volumeApi", "*", "VolumeApi", ")", "Get", "(", "id", "string", ")", "(", "*", "Volume", ",", "error", ")", "{", "data", ",", "err", ":=", "volumeApi", ".", "entityService", ".", "Get", "(", "id", ",", "map", "[", "string", "]", "strin...
//Get volume with the specified id for the current environment
[ "Get", "volume", "with", "the", "specified", "id", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/volume.go#L69-L75
148,156
cloud-ca/go-cloudca
services/cloudca/volume.go
ListOfType
func (volumeApi *VolumeApi) ListOfType(volumeType string) ([]Volume, error) { return volumeApi.ListWithOptions(map[string]string{ "type": volumeType, }) }
go
func (volumeApi *VolumeApi) ListOfType(volumeType string) ([]Volume, error) { return volumeApi.ListWithOptions(map[string]string{ "type": volumeType, }) }
[ "func", "(", "volumeApi", "*", "VolumeApi", ")", "ListOfType", "(", "volumeType", "string", ")", "(", "[", "]", "Volume", ",", "error", ")", "{", "return", "volumeApi", ".", "ListWithOptions", "(", "map", "[", "string", "]", "string", "{", "\"", "\"", ...
//List all volumes of specified type for the current environment
[ "List", "all", "volumes", "of", "specified", "type", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/volume.go#L83-L87
148,157
cloud-ca/go-cloudca
services/cloudca/volume.go
ListWithOptions
func (volumeApi *VolumeApi) ListWithOptions(options map[string]string) ([]Volume, error) { data, err := volumeApi.entityService.List(options) if err != nil { return nil, err } return parseVolumeList(data), nil }
go
func (volumeApi *VolumeApi) ListWithOptions(options map[string]string) ([]Volume, error) { data, err := volumeApi.entityService.List(options) if err != nil { return nil, err } return parseVolumeList(data), nil }
[ "func", "(", "volumeApi", "*", "VolumeApi", ")", "ListWithOptions", "(", "options", "map", "[", "string", "]", "string", ")", "(", "[", "]", "Volume", ",", "error", ")", "{", "data", ",", "err", ":=", "volumeApi", ".", "entityService", ".", "List", "("...
//List all volumes for the current environment. Can use options to do sorting and paging.
[ "List", "all", "volumes", "for", "the", "current", "environment", ".", "Can", "use", "options", "to", "do", "sorting", "and", "paging", "." ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/volume.go#L90-L96
148,158
vrischmann/jsonutil
jsonutil.go
UnmarshalJSON
func (d *Duration) UnmarshalJSON(data []byte) error { var s string if err := json.Unmarshal(data, &s); err != nil { return err } tmp, err := time.ParseDuration(s) if err != nil { return err } d.Duration = tmp return nil }
go
func (d *Duration) UnmarshalJSON(data []byte) error { var s string if err := json.Unmarshal(data, &s); err != nil { return err } tmp, err := time.ParseDuration(s) if err != nil { return err } d.Duration = tmp return nil }
[ "func", "(", "d", "*", "Duration", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "s", "string", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "s", ")", ";", "err", "!=", "nil", "{", "...
// UnmarshalJSON implements the json.Unmarshaler interface. The duration is expected to be a quoted-string of a duration in the format accepted by time.ParseDuration.
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", ".", "The", "duration", "is", "expected", "to", "be", "a", "quoted", "-", "string", "of", "a", "duration", "in", "the", "format", "accepted", "by", "time", ".", "ParseDuration", "...
d44b59f0575ca3785e670025e2488efe0a4a10c4
https://github.com/vrischmann/jsonutil/blob/d44b59f0575ca3785e670025e2488efe0a4a10c4/jsonutil.go#L27-L41
148,159
cloud-ca/go-cloudca
services/cloudca/network_acl.go
Get
func (networkAclApi *NetworkAclApi) Get(id string) (*NetworkAcl, error) { data, err := networkAclApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseNetworkAcl(data), nil }
go
func (networkAclApi *NetworkAclApi) Get(id string) (*NetworkAcl, error) { data, err := networkAclApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseNetworkAcl(data), nil }
[ "func", "(", "networkAclApi", "*", "NetworkAclApi", ")", "Get", "(", "id", "string", ")", "(", "*", "NetworkAcl", ",", "error", ")", "{", "data", ",", "err", ":=", "networkAclApi", ".", "entityService", ".", "Get", "(", "id", ",", "map", "[", "string",...
//Get network acl with the specified id for the current environment
[ "Get", "network", "acl", "with", "the", "specified", "id", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/network_acl.go#L48-L54
148,160
cloud-ca/go-cloudca
services/cloudca/network_acl.go
ListByVpcId
func (networkAclApi *NetworkAclApi) ListByVpcId(vpcId string) ([]NetworkAcl, error) { return networkAclApi.ListWithOptions(map[string]string{"vpc_id": vpcId}) }
go
func (networkAclApi *NetworkAclApi) ListByVpcId(vpcId string) ([]NetworkAcl, error) { return networkAclApi.ListWithOptions(map[string]string{"vpc_id": vpcId}) }
[ "func", "(", "networkAclApi", "*", "NetworkAclApi", ")", "ListByVpcId", "(", "vpcId", "string", ")", "(", "[", "]", "NetworkAcl", ",", "error", ")", "{", "return", "networkAclApi", ".", "ListWithOptions", "(", "map", "[", "string", "]", "string", "{", "\""...
//List all network offerings for the current environment
[ "List", "all", "network", "offerings", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/network_acl.go#L62-L64
148,161
cloud-ca/go-cloudca
services/cloudca/network_offering.go
Get
func (networkOfferingApi *NetworkOfferingApi) Get(id string) (*NetworkOffering, error) { data, err := networkOfferingApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseNetworkOffering(data), nil }
go
func (networkOfferingApi *NetworkOfferingApi) Get(id string) (*NetworkOffering, error) { data, err := networkOfferingApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseNetworkOffering(data), nil }
[ "func", "(", "networkOfferingApi", "*", "NetworkOfferingApi", ")", "Get", "(", "id", "string", ")", "(", "*", "NetworkOffering", ",", "error", ")", "{", "data", ",", "err", ":=", "networkOfferingApi", ".", "entityService", ".", "Get", "(", "id", ",", "map"...
//Get network offering with the specified id for the current environment
[ "Get", "network", "offering", "with", "the", "specified", "id", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/network_offering.go#L43-L49
148,162
venicegeo/geojson-go
geojson/bbox.go
NewBoundingBox
func NewBoundingBox(input interface{}) (BoundingBox, error) { var ( result, bbox2 BoundingBox err error coordValue float64 ) switch inputType := input.(type) { case []string: for _, coord := range inputType { if coordValue, err = strconv.ParseFloat(coord, 64); err == nil { result = appe...
go
func NewBoundingBox(input interface{}) (BoundingBox, error) { var ( result, bbox2 BoundingBox err error coordValue float64 ) switch inputType := input.(type) { case []string: for _, coord := range inputType { if coordValue, err = strconv.ParseFloat(coord, 64); err == nil { result = appe...
[ "func", "NewBoundingBox", "(", "input", "interface", "{", "}", ")", "(", "BoundingBox", ",", "error", ")", "{", "var", "(", "result", ",", "bbox2", "BoundingBox", "\n", "err", "error", "\n", "coordValue", "float64", "\n", ")", "\n\n", "switch", "inputType"...
// NewBoundingBox creates a BoundingBox from a large number of inputs // including a string and an n-dimensional coordinate array
[ "NewBoundingBox", "creates", "a", "BoundingBox", "from", "a", "large", "number", "of", "inputs", "including", "a", "string", "and", "an", "n", "-", "dimensional", "coordinate", "array" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/bbox.go#L38-L109
148,163
venicegeo/geojson-go
geojson/bbox.go
Equals
func (bb BoundingBox) Equals(test BoundingBox) bool { bblen := len(bb) testlen := len(test) if (bblen == 0) && (testlen == 0) { return true } if (bblen == 0) || (testlen == 0) || (bblen != testlen) { return false } for inx := 0; inx < bblen; inx++ { if bb[inx] != test[inx] { return false } } return ...
go
func (bb BoundingBox) Equals(test BoundingBox) bool { bblen := len(bb) testlen := len(test) if (bblen == 0) && (testlen == 0) { return true } if (bblen == 0) || (testlen == 0) || (bblen != testlen) { return false } for inx := 0; inx < bblen; inx++ { if bb[inx] != test[inx] { return false } } return ...
[ "func", "(", "bb", "BoundingBox", ")", "Equals", "(", "test", "BoundingBox", ")", "bool", "{", "bblen", ":=", "len", "(", "bb", ")", "\n", "testlen", ":=", "len", "(", "test", ")", "\n", "if", "(", "bblen", "==", "0", ")", "&&", "(", "testlen", "...
// Equals returns true if all points in the bounding boxes are equal
[ "Equals", "returns", "true", "if", "all", "points", "in", "the", "bounding", "boxes", "are", "equal" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/bbox.go#L151-L166
148,164
venicegeo/geojson-go
geojson/bbox.go
Overlaps
func (bb BoundingBox) Overlaps(test BoundingBox) bool { bblen := len(bb) testlen := len(test) if (bblen == 0) || (testlen == 0) || (bblen != testlen) { return false } result := true bbDimensions := bblen / 2 if bb.Antimeridian() && test.Antimeridian() { // no op } else if bb.Antimeridian() { result = res...
go
func (bb BoundingBox) Overlaps(test BoundingBox) bool { bblen := len(bb) testlen := len(test) if (bblen == 0) || (testlen == 0) || (bblen != testlen) { return false } result := true bbDimensions := bblen / 2 if bb.Antimeridian() && test.Antimeridian() { // no op } else if bb.Antimeridian() { result = res...
[ "func", "(", "bb", "BoundingBox", ")", "Overlaps", "(", "test", "BoundingBox", ")", "bool", "{", "bblen", ":=", "len", "(", "bb", ")", "\n", "testlen", ":=", "len", "(", "test", ")", "\n\n", "if", "(", "bblen", "==", "0", ")", "||", "(", "testlen",...
// Overlaps returns true if the interiors of the two bounding boxes // have any area in common
[ "Overlaps", "returns", "true", "if", "the", "interiors", "of", "the", "two", "bounding", "boxes", "have", "any", "area", "in", "common" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/bbox.go#L170-L195
148,165
venicegeo/geojson-go
geojson/bbox.go
String
func (bb BoundingBox) String() string { var result string switch len(bb) { case 4: result = strconv.FormatFloat(bb[0], 'f', 3, 32) + "," + strconv.FormatFloat(bb[1], 'f', 3, 32) + "," + strconv.FormatFloat(bb[2], 'f', 3, 32) + "," + strconv.FormatFloat(bb[3], 'f', 3, 32) case 6: result = strconv.Format...
go
func (bb BoundingBox) String() string { var result string switch len(bb) { case 4: result = strconv.FormatFloat(bb[0], 'f', 3, 32) + "," + strconv.FormatFloat(bb[1], 'f', 3, 32) + "," + strconv.FormatFloat(bb[2], 'f', 3, 32) + "," + strconv.FormatFloat(bb[3], 'f', 3, 32) case 6: result = strconv.Format...
[ "func", "(", "bb", "BoundingBox", ")", "String", "(", ")", "string", "{", "var", "result", "string", "\n", "switch", "len", "(", "bb", ")", "{", "case", "4", ":", "result", "=", "strconv", ".", "FormatFloat", "(", "bb", "[", "0", "]", ",", "'f'", ...
// String returns a string representation as minx,miny,maxx,maxy
[ "String", "returns", "a", "string", "representation", "as", "minx", "miny", "maxx", "maxy" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/bbox.go#L198-L215
148,166
venicegeo/geojson-go
geojson/bbox.go
Valid
func (bb BoundingBox) Valid() error { switch len(bb) { case 0: return nil case 4: if bb[1] > bb[3] { return errors.New("Bounding Box values must be in south-westerly to north-easterly order.") } return nil case 6: if bb[1] > bb[4] || bb[2] > bb[5] { return errors.New("Bounding Box values must be in ...
go
func (bb BoundingBox) Valid() error { switch len(bb) { case 0: return nil case 4: if bb[1] > bb[3] { return errors.New("Bounding Box values must be in south-westerly to north-easterly order.") } return nil case 6: if bb[1] > bb[4] || bb[2] > bb[5] { return errors.New("Bounding Box values must be in ...
[ "func", "(", "bb", "BoundingBox", ")", "Valid", "(", ")", "error", "{", "switch", "len", "(", "bb", ")", "{", "case", "0", ":", "return", "nil", "\n", "case", "4", ":", "if", "bb", "[", "1", "]", ">", "bb", "[", "3", "]", "{", "return", "erro...
// Valid returns nil if the bounding box is valid // or an error object if it is invalid
[ "Valid", "returns", "nil", "if", "the", "bounding", "box", "is", "valid", "or", "an", "error", "object", "if", "it", "is", "invalid" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/bbox.go#L219-L235
148,167
venicegeo/geojson-go
geojson/bbox.go
Antimeridian
func (bb BoundingBox) Antimeridian() bool { if bb.Valid() == nil { switch len(bb) { case 4: if bb[0] > bb[2] { return true } case 6: if bb[0] > bb[3] { return true } } } return false }
go
func (bb BoundingBox) Antimeridian() bool { if bb.Valid() == nil { switch len(bb) { case 4: if bb[0] > bb[2] { return true } case 6: if bb[0] > bb[3] { return true } } } return false }
[ "func", "(", "bb", "BoundingBox", ")", "Antimeridian", "(", ")", "bool", "{", "if", "bb", ".", "Valid", "(", ")", "==", "nil", "{", "switch", "len", "(", "bb", ")", "{", "case", "4", ":", "if", "bb", "[", "0", "]", ">", "bb", "[", "2", "]", ...
// Antimeridian returns true if the BoundingBox crosses the antimeridian
[ "Antimeridian", "returns", "true", "if", "the", "BoundingBox", "crosses", "the", "antimeridian" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/bbox.go#L238-L252
148,168
venicegeo/geojson-go
geojson/bbox.go
Centroid
func (bb BoundingBox) Centroid() *Point { var result *Point if bb.Valid() == nil { switch len(bb) { case 0: case 4: var coordinates [2]float64 coordinates[0] = 0.5 * (bb[0] + bb[2]) coordinates[1] = 0.5 * (bb[1] + bb[3]) result = NewPoint(coordinates[0:]) case 6: var coordinates [3]float64 c...
go
func (bb BoundingBox) Centroid() *Point { var result *Point if bb.Valid() == nil { switch len(bb) { case 0: case 4: var coordinates [2]float64 coordinates[0] = 0.5 * (bb[0] + bb[2]) coordinates[1] = 0.5 * (bb[1] + bb[3]) result = NewPoint(coordinates[0:]) case 6: var coordinates [3]float64 c...
[ "func", "(", "bb", "BoundingBox", ")", "Centroid", "(", ")", "*", "Point", "{", "var", "result", "*", "Point", "\n", "if", "bb", ".", "Valid", "(", ")", "==", "nil", "{", "switch", "len", "(", "bb", ")", "{", "case", "0", ":", "case", "4", ":",...
// Centroid returns the center of the BoundingBox, // or nil if it has no coordinates or is otherwise invalid
[ "Centroid", "returns", "the", "center", "of", "the", "BoundingBox", "or", "nil", "if", "it", "has", "no", "coordinates", "or", "is", "otherwise", "invalid" ]
d1ea2453c82c1124c6d4233f92ba5424f15d8bc3
https://github.com/venicegeo/geojson-go/blob/d1ea2453c82c1124c6d4233f92ba5424f15d8bc3/geojson/bbox.go#L256-L275
148,169
cloud-ca/go-cloudca
services/cloudca/compute_offering.go
Get
func (computeOfferingApi *ComputeOfferingApi) Get(id string) (*ComputeOffering, error) { data, err := computeOfferingApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseComputeOffering(data), nil }
go
func (computeOfferingApi *ComputeOfferingApi) Get(id string) (*ComputeOffering, error) { data, err := computeOfferingApi.entityService.Get(id, map[string]string{}) if err != nil { return nil, err } return parseComputeOffering(data), nil }
[ "func", "(", "computeOfferingApi", "*", "ComputeOfferingApi", ")", "Get", "(", "id", "string", ")", "(", "*", "ComputeOffering", ",", "error", ")", "{", "data", ",", "err", ":=", "computeOfferingApi", ".", "entityService", ".", "Get", "(", "id", ",", "map"...
//Get compute offering with the specified id for the current environment
[ "Get", "compute", "offering", "with", "the", "specified", "id", "for", "the", "current", "environment" ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/compute_offering.go#L46-L52
148,170
cloud-ca/go-cloudca
services/cloudca/compute_offering.go
ListWithOptions
func (computeOfferingApi *ComputeOfferingApi) ListWithOptions(options map[string]string) ([]ComputeOffering, error) { data, err := computeOfferingApi.entityService.List(options) if err != nil { return nil, err } return parseComputeOfferingList(data), nil }
go
func (computeOfferingApi *ComputeOfferingApi) ListWithOptions(options map[string]string) ([]ComputeOffering, error) { data, err := computeOfferingApi.entityService.List(options) if err != nil { return nil, err } return parseComputeOfferingList(data), nil }
[ "func", "(", "computeOfferingApi", "*", "ComputeOfferingApi", ")", "ListWithOptions", "(", "options", "map", "[", "string", "]", "string", ")", "(", "[", "]", "ComputeOffering", ",", "error", ")", "{", "data", ",", "err", ":=", "computeOfferingApi", ".", "en...
//List all compute offerings for the current environment. Can use options to do sorting and paging.
[ "List", "all", "compute", "offerings", "for", "the", "current", "environment", ".", "Can", "use", "options", "to", "do", "sorting", "and", "paging", "." ]
fb928a1e9d26293010e4d829bbcbfc22eb31f013
https://github.com/cloud-ca/go-cloudca/blob/fb928a1e9d26293010e4d829bbcbfc22eb31f013/services/cloudca/compute_offering.go#L60-L66
148,171
codegangsta/envy
lib/env.go
MustGet
func MustGet(key string) string { v := os.Getenv(key) if v == "" { panic("Environment variable " + key + " does not exist.") } return v }
go
func MustGet(key string) string { v := os.Getenv(key) if v == "" { panic("Environment variable " + key + " does not exist.") } return v }
[ "func", "MustGet", "(", "key", "string", ")", "string", "{", "v", ":=", "os", ".", "Getenv", "(", "key", ")", "\n", "if", "v", "==", "\"", "\"", "{", "panic", "(", "\"", "\"", "+", "key", "+", "\"", "\"", ")", "\n", "}", "\n\n", "return", "v"...
// MustGet looks up the value for the given environment variable. It panics // If the value is an empty string.
[ "MustGet", "looks", "up", "the", "value", "for", "the", "given", "environment", "variable", ".", "It", "panics", "If", "the", "value", "is", "an", "empty", "string", "." ]
4b78388c8ce4fa412440ca4eaa654e2fdd752e49
https://github.com/codegangsta/envy/blob/4b78388c8ce4fa412440ca4eaa654e2fdd752e49/lib/env.go#L16-L23
148,172
codegangsta/envy
lib/env.go
Bootstrap
func Bootstrap() (Env, error) { file, err := os.Open(".env") if err != nil { return nil, err } return Load(file) }
go
func Bootstrap() (Env, error) { file, err := os.Open(".env") if err != nil { return nil, err } return Load(file) }
[ "func", "Bootstrap", "(", ")", "(", "Env", ",", "error", ")", "{", "file", ",", "err", ":=", "os", ".", "Open", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "Load", "(", ...
// Bootstrap loads a .env file into the current environment using envy.Load
[ "Bootstrap", "loads", "a", ".", "env", "file", "into", "the", "current", "environment", "using", "envy", ".", "Load" ]
4b78388c8ce4fa412440ca4eaa654e2fdd752e49
https://github.com/codegangsta/envy/blob/4b78388c8ce4fa412440ca4eaa654e2fdd752e49/lib/env.go#L26-L33
148,173
codegangsta/envy
lib/env.go
Load
func Load(reader io.Reader) (Env, error) { r := bufio.NewReader(reader) env := make(map[string]string) for { line, _, err := r.ReadLine() if err != nil { break } key, val, err := parseln(string(line)) if err != nil { return env, err } env[key] = val os.Setenv(key, val) } return env, nil }
go
func Load(reader io.Reader) (Env, error) { r := bufio.NewReader(reader) env := make(map[string]string) for { line, _, err := r.ReadLine() if err != nil { break } key, val, err := parseln(string(line)) if err != nil { return env, err } env[key] = val os.Setenv(key, val) } return env, nil }
[ "func", "Load", "(", "reader", "io", ".", "Reader", ")", "(", "Env", ",", "error", ")", "{", "r", ":=", "bufio", ".", "NewReader", "(", "reader", ")", "\n", "env", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n\n", "for", "{", ...
// Load parses lines of a reader in the .env format.
[ "Load", "parses", "lines", "of", "a", "reader", "in", "the", ".", "env", "format", "." ]
4b78388c8ce4fa412440ca4eaa654e2fdd752e49
https://github.com/codegangsta/envy/blob/4b78388c8ce4fa412440ca4eaa654e2fdd752e49/lib/env.go#L36-L56
148,174
gsterjov/go-libsecret
item.go
Label
func (item *Item) Label() (string, error) { val, err := item.dbus.GetProperty("org.freedesktop.Secret.Item.Label") if err != nil { return "", err } return val.Value().(string), nil }
go
func (item *Item) Label() (string, error) { val, err := item.dbus.GetProperty("org.freedesktop.Secret.Item.Label") if err != nil { return "", err } return val.Value().(string), nil }
[ "func", "(", "item", "*", "Item", ")", "Label", "(", ")", "(", "string", ",", "error", ")", "{", "val", ",", "err", ":=", "item", ".", "dbus", ".", "GetProperty", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ...
// READWRITE String Label;
[ "READWRITE", "String", "Label", ";" ]
a6f4afe4910cad8688db3e0e9b9ac92ad22d54e1
https://github.com/gsterjov/go-libsecret/blob/a6f4afe4910cad8688db3e0e9b9ac92ad22d54e1/item.go#L26-L33
148,175
alecthomas/colour
colour.go
TTY
func TTY(w io.Writer) Printer { if f, ok := w.(*os.File); ok && isatty.IsTerminal(f.Fd()) { return &colourPrinter{w} } return &stripPrinter{w} }
go
func TTY(w io.Writer) Printer { if f, ok := w.(*os.File); ok && isatty.IsTerminal(f.Fd()) { return &colourPrinter{w} } return &stripPrinter{w} }
[ "func", "TTY", "(", "w", "io", ".", "Writer", ")", "Printer", "{", "if", "f", ",", "ok", ":=", "w", ".", "(", "*", "os", ".", "File", ")", ";", "ok", "&&", "isatty", ".", "IsTerminal", "(", "f", ".", "Fd", "(", ")", ")", "{", "return", "&",...
// TTY creates a Printer that colourises output if w is a terminal, or strips // formatting if it is not.
[ "TTY", "creates", "a", "Printer", "that", "colourises", "output", "if", "w", "is", "a", "terminal", "or", "strips", "formatting", "if", "it", "is", "not", "." ]
60882d9e27213e8552dcff6328914fe4c2b44bc9
https://github.com/alecthomas/colour/blob/60882d9e27213e8552dcff6328914fe4c2b44bc9/colour.go#L139-L144
148,176
jacobsa/oglemock
internal_expectation.go
InternalNewExpectation
func InternalNewExpectation( reporter ErrorReporter, methodSignature reflect.Type, args []interface{}, fileName string, lineNumber int) *InternalExpectation { result := &InternalExpectation{} // Store fields that can be stored directly. result.methodSignature = methodSignature result.errorReporter = reporter ...
go
func InternalNewExpectation( reporter ErrorReporter, methodSignature reflect.Type, args []interface{}, fileName string, lineNumber int) *InternalExpectation { result := &InternalExpectation{} // Store fields that can be stored directly. result.methodSignature = methodSignature result.errorReporter = reporter ...
[ "func", "InternalNewExpectation", "(", "reporter", "ErrorReporter", ",", "methodSignature", "reflect", ".", "Type", ",", "args", "[", "]", "interface", "{", "}", ",", "fileName", "string", ",", "lineNumber", "int", ")", "*", "InternalExpectation", "{", "result",...
// InternalNewExpectation is exported for purposes of testing only. You should // not touch it.
[ "InternalNewExpectation", "is", "exported", "for", "purposes", "of", "testing", "only", ".", "You", "should", "not", "touch", "it", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/internal_expectation.go#L71-L101
148,177
jacobsa/oglemock
return.go
buildInvokeResult
func (a *returnAction) buildInvokeResult( sig reflect.Type) (res []interface{}, err error) { // Check the length of the return value. numOut := sig.NumOut() numVals := len(a.returnVals) if numOut != numVals { err = errors.New( fmt.Sprintf("Return given %d vals; expected %d.", numVals, numOut)) return } ...
go
func (a *returnAction) buildInvokeResult( sig reflect.Type) (res []interface{}, err error) { // Check the length of the return value. numOut := sig.NumOut() numVals := len(a.returnVals) if numOut != numVals { err = errors.New( fmt.Sprintf("Return given %d vals; expected %d.", numVals, numOut)) return } ...
[ "func", "(", "a", "*", "returnAction", ")", "buildInvokeResult", "(", "sig", "reflect", ".", "Type", ")", "(", "res", "[", "]", "interface", "{", "}", ",", "err", "error", ")", "{", "// Check the length of the return value.", "numOut", ":=", "sig", ".", "N...
// A version of Invoke that does error checking, used by both public methods.
[ "A", "version", "of", "Invoke", "that", "does", "error", "checking", "used", "by", "both", "public", "methods", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/return.go#L80-L107
148,178
jacobsa/oglemock
do_all.go
DoAll
func DoAll(first Action, others ...Action) Action { return &doAll{ wrapped: append([]Action{first}, others...), } }
go
func DoAll(first Action, others ...Action) Action { return &doAll{ wrapped: append([]Action{first}, others...), } }
[ "func", "DoAll", "(", "first", "Action", ",", "others", "...", "Action", ")", "Action", "{", "return", "&", "doAll", "{", "wrapped", ":", "append", "(", "[", "]", "Action", "{", "first", "}", ",", "others", "...", ")", ",", "}", "\n", "}" ]
// Create an Action that invokes the supplied actions one after another. The // return values from the final action are used; others are ignored.
[ "Create", "an", "Action", "that", "invokes", "the", "supplied", "actions", "one", "after", "another", ".", "The", "return", "values", "from", "the", "final", "action", "are", "used", ";", "others", "are", "ignored", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/do_all.go#L25-L29
148,179
marstr/randname
adjnoun.go
Generate
func (adNoun AdjNoun) Generate() string { if adNoun.Format == nil { adNoun.Format = GeneratePascalCaseAdjNoun } return adNoun.Format(adNoun.getAdjective(), adNoun.getNoun(), adNoun.getDigit()) }
go
func (adNoun AdjNoun) Generate() string { if adNoun.Format == nil { adNoun.Format = GeneratePascalCaseAdjNoun } return adNoun.Format(adNoun.getAdjective(), adNoun.getNoun(), adNoun.getDigit()) }
[ "func", "(", "adNoun", "AdjNoun", ")", "Generate", "(", ")", "string", "{", "if", "adNoun", ".", "Format", "==", "nil", "{", "adNoun", ".", "Format", "=", "GeneratePascalCaseAdjNoun", "\n", "}", "\n", "return", "adNoun", ".", "Format", "(", "adNoun", "."...
// Generate creates a new randomly generated name with the
[ "Generate", "creates", "a", "new", "randomly", "generated", "name", "with", "the" ]
d5b0f288ab8cfdaa716502900e10405f123dc0cf
https://github.com/marstr/randname/blob/d5b0f288ab8cfdaa716502900e10405f123dc0cf/adjnoun.go#L77-L82
148,180
jacobsa/oglemock
controller.go
getExpectationsLocked
func (c *controllerImpl) getExpectationsLocked( o MockObject, methodName string) []*InternalExpectation { id := o.Oglemock_Id() // Look up the mock object. expectationsByMethod, ok := c.expectationsByObject[id] if !ok { expectationsByMethod = methodMap{} c.expectationsByObject[id] = expectationsByMethod } ...
go
func (c *controllerImpl) getExpectationsLocked( o MockObject, methodName string) []*InternalExpectation { id := o.Oglemock_Id() // Look up the mock object. expectationsByMethod, ok := c.expectationsByObject[id] if !ok { expectationsByMethod = methodMap{} c.expectationsByObject[id] = expectationsByMethod } ...
[ "func", "(", "c", "*", "controllerImpl", ")", "getExpectationsLocked", "(", "o", "MockObject", ",", "methodName", "string", ")", "[", "]", "*", "InternalExpectation", "{", "id", ":=", "o", ".", "Oglemock_Id", "(", ")", "\n\n", "// Look up the mock object.", "e...
// Return the list of registered expectations for the named method of the // supplied object, or an empty slice if none have been registered. When this // method returns, it is guaranteed that c.expectationsByObject has an entry // for the object. // // c.mutex must be held for reading.
[ "Return", "the", "list", "of", "registered", "expectations", "for", "the", "named", "method", "of", "the", "supplied", "object", "or", "an", "empty", "slice", "if", "none", "have", "been", "registered", ".", "When", "this", "method", "returns", "it", "is", ...
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/controller.go#L117-L135
148,181
jacobsa/oglemock
controller.go
addExpectationLocked
func (c *controllerImpl) addExpectationLocked( o MockObject, methodName string, exp *InternalExpectation) { // Get the existing list. existing := c.getExpectationsLocked(o, methodName) // Store a modified list. id := o.Oglemock_Id() c.expectationsByObject[id][methodName] = append(existing, exp) }
go
func (c *controllerImpl) addExpectationLocked( o MockObject, methodName string, exp *InternalExpectation) { // Get the existing list. existing := c.getExpectationsLocked(o, methodName) // Store a modified list. id := o.Oglemock_Id() c.expectationsByObject[id][methodName] = append(existing, exp) }
[ "func", "(", "c", "*", "controllerImpl", ")", "addExpectationLocked", "(", "o", "MockObject", ",", "methodName", "string", ",", "exp", "*", "InternalExpectation", ")", "{", "// Get the existing list.", "existing", ":=", "c", ".", "getExpectationsLocked", "(", "o",...
// Add an expectation to the list registered for the named method of the // supplied mock object. // // c.mutex must be held for writing.
[ "Add", "an", "expectation", "to", "the", "list", "registered", "for", "the", "named", "method", "of", "the", "supplied", "mock", "object", ".", "c", ".", "mutex", "must", "be", "held", "for", "writing", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/controller.go#L141-L151
148,182
jacobsa/oglemock
controller.go
expectationMatches
func expectationMatches(exp *InternalExpectation, args []interface{}) bool { matchers := exp.ArgMatchers if len(args) != len(matchers) { panic("expectationMatches: len(args)") } // Check each matcher. for i, matcher := range matchers { if err := matcher.Matches(args[i]); err != nil { return false } } ...
go
func expectationMatches(exp *InternalExpectation, args []interface{}) bool { matchers := exp.ArgMatchers if len(args) != len(matchers) { panic("expectationMatches: len(args)") } // Check each matcher. for i, matcher := range matchers { if err := matcher.Matches(args[i]); err != nil { return false } } ...
[ "func", "expectationMatches", "(", "exp", "*", "InternalExpectation", ",", "args", "[", "]", "interface", "{", "}", ")", "bool", "{", "matchers", ":=", "exp", ".", "ArgMatchers", "\n", "if", "len", "(", "args", ")", "!=", "len", "(", "matchers", ")", "...
// expectationMatches checks the matchers for the expectation against the // supplied arguments.
[ "expectationMatches", "checks", "the", "matchers", "for", "the", "expectation", "against", "the", "supplied", "arguments", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/controller.go#L248-L262
148,183
jacobsa/oglemock
controller.go
chooseExpectationLocked
func (c *controllerImpl) chooseExpectationLocked( o MockObject, methodName string, args []interface{}) *InternalExpectation { // Do we have any expectations for this method? expectations := c.getExpectationsLocked(o, methodName) if len(expectations) == 0 { return nil } for i := len(expectations) - 1; i >= 0;...
go
func (c *controllerImpl) chooseExpectationLocked( o MockObject, methodName string, args []interface{}) *InternalExpectation { // Do we have any expectations for this method? expectations := c.getExpectationsLocked(o, methodName) if len(expectations) == 0 { return nil } for i := len(expectations) - 1; i >= 0;...
[ "func", "(", "c", "*", "controllerImpl", ")", "chooseExpectationLocked", "(", "o", "MockObject", ",", "methodName", "string", ",", "args", "[", "]", "interface", "{", "}", ")", "*", "InternalExpectation", "{", "// Do we have any expectations for this method?", "expe...
// Return the expectation that matches the supplied arguments. If there is more // than one such expectation, the one furthest along in the list for the method // is returned. If there is no such expectation, nil is returned. // // c.mutex must be held for reading.
[ "Return", "the", "expectation", "that", "matches", "the", "supplied", "arguments", ".", "If", "there", "is", "more", "than", "one", "such", "expectation", "the", "one", "furthest", "along", "in", "the", "list", "for", "the", "method", "is", "returned", ".", ...
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/controller.go#L269-L286
148,184
jacobsa/oglemock
controller.go
chooseActionAndUpdateExpectations
func (c *controllerImpl) chooseActionAndUpdateExpectations( o MockObject, methodName string, fileName string, lineNumber int, args []interface{}, ) (action Action, zeroVals []interface{}) { c.mutex.Lock() defer c.mutex.Unlock() // Find the signature for the requested method. ov := reflect.ValueOf(o) method :...
go
func (c *controllerImpl) chooseActionAndUpdateExpectations( o MockObject, methodName string, fileName string, lineNumber int, args []interface{}, ) (action Action, zeroVals []interface{}) { c.mutex.Lock() defer c.mutex.Unlock() // Find the signature for the requested method. ov := reflect.ValueOf(o) method :...
[ "func", "(", "c", "*", "controllerImpl", ")", "chooseActionAndUpdateExpectations", "(", "o", "MockObject", ",", "methodName", "string", ",", "fileName", "string", ",", "lineNumber", "int", ",", "args", "[", "]", "interface", "{", "}", ",", ")", "(", "action"...
// Find an action for the method call, updating expectation match state in the // process. Return either an action that should be invoked or a set of zero // values to return immediately. // // This is split out from HandleMethodCall in order to more easily avoid // invoking the action with locks held.
[ "Find", "an", "action", "for", "the", "method", "call", "updating", "expectation", "match", "state", "in", "the", "process", ".", "Return", "either", "an", "action", "that", "should", "be", "invoked", "or", "a", "set", "of", "zero", "values", "to", "return...
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/controller.go#L362-L457
148,185
jacobsa/oglemock
generate/generate.go
addImportForType
func addImportForType(imports importMap, t reflect.Type) { // If there is no package path, this is a built-in type and we don't need an // import. pkgPath := t.PkgPath() if pkgPath == "" { return } // Work around a bug in Go: // // http://code.google.com/p/go/issues/detail?id=2660 // var errorPtr *erro...
go
func addImportForType(imports importMap, t reflect.Type) { // If there is no package path, this is a built-in type and we don't need an // import. pkgPath := t.PkgPath() if pkgPath == "" { return } // Work around a bug in Go: // // http://code.google.com/p/go/issues/detail?id=2660 // var errorPtr *erro...
[ "func", "addImportForType", "(", "imports", "importMap", ",", "t", "reflect", ".", "Type", ")", "{", "// If there is no package path, this is a built-in type and we don't need an", "// import.", "pkgPath", ":=", "t", ".", "PkgPath", "(", ")", "\n", "if", "pkgPath", "=...
// Add an import for the supplied type, without recursing.
[ "Add", "an", "import", "for", "the", "supplied", "type", "without", "recursing", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/generate/generate.go#L181-L207
148,186
jacobsa/oglemock
generate/generate.go
addImportsForType
func addImportsForType(imports importMap, t reflect.Type) { // Add any import needed for the type itself. addImportForType(imports, t) // Handle special cases where recursion is needed. switch t.Kind() { case reflect.Array, reflect.Chan, reflect.Ptr, reflect.Slice: addImportsForType(imports, t.Elem()) case re...
go
func addImportsForType(imports importMap, t reflect.Type) { // Add any import needed for the type itself. addImportForType(imports, t) // Handle special cases where recursion is needed. switch t.Kind() { case reflect.Array, reflect.Chan, reflect.Ptr, reflect.Slice: addImportsForType(imports, t.Elem()) case re...
[ "func", "addImportsForType", "(", "imports", "importMap", ",", "t", "reflect", ".", "Type", ")", "{", "// Add any import needed for the type itself.", "addImportForType", "(", "imports", ",", "t", ")", "\n\n", "// Handle special cases where recursion is needed.", "switch", ...
// Add all necessary imports for the type, recursing as appropriate.
[ "Add", "all", "necessary", "imports", "for", "the", "type", "recursing", "as", "appropriate", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/generate/generate.go#L210-L234
148,187
jacobsa/oglemock
generate/generate.go
addImportsForInterfaceMethods
func addImportsForInterfaceMethods(imports importMap, it reflect.Type) { // Handle each method. for i := 0; i < it.NumMethod(); i++ { m := it.Method(i) addImportsForType(imports, m.Type) } }
go
func addImportsForInterfaceMethods(imports importMap, it reflect.Type) { // Handle each method. for i := 0; i < it.NumMethod(); i++ { m := it.Method(i) addImportsForType(imports, m.Type) } }
[ "func", "addImportsForInterfaceMethods", "(", "imports", "importMap", ",", "it", "reflect", ".", "Type", ")", "{", "// Handle each method.", "for", "i", ":=", "0", ";", "i", "<", "it", ".", "NumMethod", "(", ")", ";", "i", "++", "{", "m", ":=", "it", "...
// Add imports for each of the methods of the interface, but not the interface // itself.
[ "Add", "imports", "for", "each", "of", "the", "methods", "of", "the", "interface", "but", "not", "the", "interface", "itself", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/generate/generate.go#L238-L244
148,188
jacobsa/oglemock
generate/generate.go
getImports
func getImports( interfaces []reflect.Type, pkgPath string) importMap { imports := make(importMap) for _, it := range interfaces { addImportForType(imports, it) addImportsForInterfaceMethods(imports, it) } // Make sure there are imports for other types used by the generated code // itself. imports["fmt"] =...
go
func getImports( interfaces []reflect.Type, pkgPath string) importMap { imports := make(importMap) for _, it := range interfaces { addImportForType(imports, it) addImportsForInterfaceMethods(imports, it) } // Make sure there are imports for other types used by the generated code // itself. imports["fmt"] =...
[ "func", "getImports", "(", "interfaces", "[", "]", "reflect", ".", "Type", ",", "pkgPath", "string", ")", "importMap", "{", "imports", ":=", "make", "(", "importMap", ")", "\n", "for", "_", ",", "it", ":=", "range", "interfaces", "{", "addImportForType", ...
// Given a set of interfaces, return a map from import identifier to package to // use that identifier for, containing elements for each import needed by the // mock versions of those interfaces in a package with the given path.
[ "Given", "a", "set", "of", "interfaces", "return", "a", "map", "from", "import", "identifier", "to", "package", "to", "use", "that", "identifier", "for", "containing", "elements", "for", "each", "import", "needed", "by", "the", "mock", "versions", "of", "tho...
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/generate/generate.go#L249-L273
148,189
jacobsa/oglemock
generate/generate.go
GenerateMockSource
func GenerateMockSource( w io.Writer, outputPkgPath string, interfaces []reflect.Type) (err error) { // Sanity-check arguments. if outputPkgPath == "" { return errors.New("Package path must be non-empty.") } if len(interfaces) == 0 { return errors.New("List of interfaces must be non-empty.") } // Make su...
go
func GenerateMockSource( w io.Writer, outputPkgPath string, interfaces []reflect.Type) (err error) { // Sanity-check arguments. if outputPkgPath == "" { return errors.New("Package path must be non-empty.") } if len(interfaces) == 0 { return errors.New("List of interfaces must be non-empty.") } // Make su...
[ "func", "GenerateMockSource", "(", "w", "io", ".", "Writer", ",", "outputPkgPath", "string", ",", "interfaces", "[", "]", "reflect", ".", "Type", ")", "(", "err", "error", ")", "{", "// Sanity-check arguments.", "if", "outputPkgPath", "==", "\"", "\"", "{", ...
// Given a set of interfaces to mock, write out source code suitable for // inclusion in a package with the supplied full package path containing mock // implementations of those interfaces.
[ "Given", "a", "set", "of", "interfaces", "to", "mock", "write", "out", "source", "code", "suitable", "for", "inclusion", "in", "a", "package", "with", "the", "supplied", "full", "package", "path", "containing", "mock", "implementations", "of", "those", "interf...
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/generate/generate.go#L278-L369
148,190
jacobsa/oglemock
save_arg.go
SaveArg
func SaveArg(index int, dst interface{}) Action { return &saveArg{ index: index, dstPointer: dst, } }
go
func SaveArg(index int, dst interface{}) Action { return &saveArg{ index: index, dstPointer: dst, } }
[ "func", "SaveArg", "(", "index", "int", ",", "dst", "interface", "{", "}", ")", "Action", "{", "return", "&", "saveArg", "{", "index", ":", "index", ",", "dstPointer", ":", "dst", ",", "}", "\n", "}" ]
// Create an Action that saves the argument at the given zero-based index to // the supplied destination, which must be a pointer to a type that is // assignable from the argument type.
[ "Create", "an", "Action", "that", "saves", "the", "argument", "at", "the", "given", "zero", "-", "based", "index", "to", "the", "supplied", "destination", "which", "must", "be", "a", "pointer", "to", "a", "type", "that", "is", "assignable", "from", "the", ...
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/save_arg.go#L26-L31
148,191
marstr/randname
prefixed.go
Generate
func (p Prefixed) Generate() string { if p.Len == 0 { p.Len = PrefixedDefaultLen } if len(p.Acceptable) == 0 { p.Acceptable = PrefixedDefaultAcceptable } if p.RandGenerator == nil { p.RandGenerator = rand.Reader } builder := bytes.NewBufferString(p.Prefix) max := big.NewInt(int64(len(p....
go
func (p Prefixed) Generate() string { if p.Len == 0 { p.Len = PrefixedDefaultLen } if len(p.Acceptable) == 0 { p.Acceptable = PrefixedDefaultAcceptable } if p.RandGenerator == nil { p.RandGenerator = rand.Reader } builder := bytes.NewBufferString(p.Prefix) max := big.NewInt(int64(len(p....
[ "func", "(", "p", "Prefixed", ")", "Generate", "(", ")", "string", "{", "if", "p", ".", "Len", "==", "0", "{", "p", ".", "Len", "=", "PrefixedDefaultLen", "\n", "}", "\n", "if", "len", "(", "p", ".", "Acceptable", ")", "==", "0", "{", "p", ".",...
// Generate creates a string starting with a prefix, and ending with an assortment of randomly chosen runes.
[ "Generate", "creates", "a", "string", "starting", "with", "a", "prefix", "and", "ending", "with", "an", "assortment", "of", "randomly", "chosen", "runes", "." ]
d5b0f288ab8cfdaa716502900e10405f123dc0cf
https://github.com/marstr/randname/blob/d5b0f288ab8cfdaa716502900e10405f123dc0cf/prefixed.go#L37-L62
148,192
marstr/randname
prefixed.go
GenerateWithPrefix
func GenerateWithPrefix(prefix string, characters uint8) string { return Prefixed{Prefix: prefix, Len: characters}.Generate() }
go
func GenerateWithPrefix(prefix string, characters uint8) string { return Prefixed{Prefix: prefix, Len: characters}.Generate() }
[ "func", "GenerateWithPrefix", "(", "prefix", "string", ",", "characters", "uint8", ")", "string", "{", "return", "Prefixed", "{", "Prefix", ":", "prefix", ",", "Len", ":", "characters", "}", ".", "Generate", "(", ")", "\n", "}" ]
// GenerateWithPrefix generates a string with a given prefix then a given number of randomly selected characters.
[ "GenerateWithPrefix", "generates", "a", "string", "with", "a", "given", "prefix", "then", "a", "given", "number", "of", "randomly", "selected", "characters", "." ]
d5b0f288ab8cfdaa716502900e10405f123dc0cf
https://github.com/marstr/randname/blob/d5b0f288ab8cfdaa716502900e10405f123dc0cf/prefixed.go#L65-L67
148,193
jacobsa/oglemock
createmock/createmock.go
findUnknownPackage
func findUnknownPackage(output []byte) *string { if match := unknownPackageRegexp.FindSubmatch(output); match != nil { res := string(match[1]) return &res } return nil }
go
func findUnknownPackage(output []byte) *string { if match := unknownPackageRegexp.FindSubmatch(output); match != nil { res := string(match[1]) return &res } return nil }
[ "func", "findUnknownPackage", "(", "output", "[", "]", "byte", ")", "*", "string", "{", "if", "match", ":=", "unknownPackageRegexp", ".", "FindSubmatch", "(", "output", ")", ";", "match", "!=", "nil", "{", "res", ":=", "string", "(", "match", "[", "1", ...
// Does the 'go build' output indicate that a package wasn't found? If so, // return the name of the package.
[ "Does", "the", "go", "build", "output", "indicate", "that", "a", "package", "wasn", "t", "found?", "If", "so", "return", "the", "name", "of", "the", "package", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/createmock/createmock.go#L106-L113
148,194
jacobsa/oglemock
createmock/createmock.go
findUndefinedInterface
func findUndefinedInterface(output []byte) *string { if match := undefinedInterfaceRegexp.FindSubmatch(output); match != nil { res := string(match[1]) return &res } return nil }
go
func findUndefinedInterface(output []byte) *string { if match := undefinedInterfaceRegexp.FindSubmatch(output); match != nil { res := string(match[1]) return &res } return nil }
[ "func", "findUndefinedInterface", "(", "output", "[", "]", "byte", ")", "*", "string", "{", "if", "match", ":=", "undefinedInterfaceRegexp", ".", "FindSubmatch", "(", "output", ")", ";", "match", "!=", "nil", "{", "res", ":=", "string", "(", "match", "[", ...
// Does the 'go build' output indicate that an interface wasn't found? If so, // return the name of the interface.
[ "Does", "the", "go", "build", "output", "indicate", "that", "an", "interface", "wasn", "t", "found?", "If", "so", "return", "the", "name", "of", "the", "interface", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/createmock/createmock.go#L117-L124
148,195
jacobsa/oglemock
createmock/createmock.go
run
func run() error { // Reduce noise in logging output. log.SetFlags(0) // Check the command-line arguments. flag.Parse() cmdLineArgs := flag.Args() if len(cmdLineArgs) < 2 { return errors.New("Usage: createmock [package] [interface ...]") } // Create a temporary directory inside of $GOPATH to hold generated...
go
func run() error { // Reduce noise in logging output. log.SetFlags(0) // Check the command-line arguments. flag.Parse() cmdLineArgs := flag.Args() if len(cmdLineArgs) < 2 { return errors.New("Usage: createmock [package] [interface ...]") } // Create a temporary directory inside of $GOPATH to hold generated...
[ "func", "run", "(", ")", "error", "{", "// Reduce noise in logging output.", "log", ".", "SetFlags", "(", "0", ")", "\n\n", "// Check the command-line arguments.", "flag", ".", "Parse", "(", ")", "\n\n", "cmdLineArgs", ":=", "flag", ".", "Args", "(", ")", "\n"...
// Split out from main so that deferred calls are executed even in the event of // an error.
[ "Split", "out", "from", "main", "so", "that", "deferred", "calls", "are", "executed", "even", "in", "the", "event", "of", "an", "error", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/createmock/createmock.go#L128-L238
148,196
jacobsa/oglemock
invoke.go
Invoke
func Invoke(f interface{}) Action { // Make sure f is a function. fv := reflect.ValueOf(f) fk := fv.Kind() if fk != reflect.Func { desc := "<nil>" if fk != reflect.Invalid { desc = fv.Type().String() } panic(fmt.Sprintf("Invoke: expected function, got %s", desc)) } return &invokeAction{fv} }
go
func Invoke(f interface{}) Action { // Make sure f is a function. fv := reflect.ValueOf(f) fk := fv.Kind() if fk != reflect.Func { desc := "<nil>" if fk != reflect.Invalid { desc = fv.Type().String() } panic(fmt.Sprintf("Invoke: expected function, got %s", desc)) } return &invokeAction{fv} }
[ "func", "Invoke", "(", "f", "interface", "{", "}", ")", "Action", "{", "// Make sure f is a function.", "fv", ":=", "reflect", ".", "ValueOf", "(", "f", ")", "\n", "fk", ":=", "fv", ".", "Kind", "(", ")", "\n\n", "if", "fk", "!=", "reflect", ".", "Fu...
// Create an Action that invokes the supplied function, returning whatever it // returns. The signature of the function must match that of the mocked method // exactly.
[ "Create", "an", "Action", "that", "invokes", "the", "supplied", "function", "returning", "whatever", "it", "returns", ".", "The", "signature", "of", "the", "function", "must", "match", "that", "of", "the", "mocked", "method", "exactly", "." ]
e94d794d06ffc6de42cb19d0dab3c219efdd6dcf
https://github.com/jacobsa/oglemock/blob/e94d794d06ffc6de42cb19d0dab3c219efdd6dcf/invoke.go#L27-L42
148,197
marstr/randname
filedictionarybuilder.go
Build
func (fdb FileDictionaryBuilder) Build(dict *collection.Dictionary) (err error) { var handle *os.File handle, err = os.Open(fdb.Target) var currentLine string for { _, err = fmt.Fscanln(handle, &currentLine) switch err { case nil: dict.Add(currentLine) case io.EOF: err = nil fallthrough defaul...
go
func (fdb FileDictionaryBuilder) Build(dict *collection.Dictionary) (err error) { var handle *os.File handle, err = os.Open(fdb.Target) var currentLine string for { _, err = fmt.Fscanln(handle, &currentLine) switch err { case nil: dict.Add(currentLine) case io.EOF: err = nil fallthrough defaul...
[ "func", "(", "fdb", "FileDictionaryBuilder", ")", "Build", "(", "dict", "*", "collection", ".", "Dictionary", ")", "(", "err", "error", ")", "{", "var", "handle", "*", "os", ".", "File", "\n", "handle", ",", "err", "=", "os", ".", "Open", "(", "fdb",...
// Build walks a simple newline delimited file of words and populates a dictionary with them.
[ "Build", "walks", "a", "simple", "newline", "delimited", "file", "of", "words", "and", "populates", "a", "dictionary", "with", "them", "." ]
d5b0f288ab8cfdaa716502900e10405f123dc0cf
https://github.com/marstr/randname/blob/d5b0f288ab8cfdaa716502900e10405f123dc0cf/filedictionarybuilder.go#L17-L36
148,198
influxdata/yarpc
status/status.go
FromError
func FromError(err error) (s *Status, ok bool) { if err == nil { return &Status{Code: codes.OK}, true } if s, ok := err.(*Status); ok { return s, true } return nil, false }
go
func FromError(err error) (s *Status, ok bool) { if err == nil { return &Status{Code: codes.OK}, true } if s, ok := err.(*Status); ok { return s, true } return nil, false }
[ "func", "FromError", "(", "err", "error", ")", "(", "s", "*", "Status", ",", "ok", "bool", ")", "{", "if", "err", "==", "nil", "{", "return", "&", "Status", "{", "Code", ":", "codes", ".", "OK", "}", ",", "true", "\n", "}", "\n", "if", "s", "...
// FromError returns a Status representing err if it was produced from this // package, otherwise it returns nil, false.
[ "FromError", "returns", "a", "Status", "representing", "err", "if", "it", "was", "produced", "from", "this", "package", "otherwise", "it", "returns", "nil", "false", "." ]
b13d74d757bf9ea3e5574a491eb6646bdc4e2a04
https://github.com/influxdata/yarpc/blob/b13d74d757bf9ea3e5574a491eb6646bdc4e2a04/status/status.go#L15-L23
148,199
influxdata/yarpc
cmd/protoc-gen-yarpc/yarpc/plugin.go
Init
func (g *Plugin) Init(gen *generator.Generator) { g.gen = gen contextPkg = generator.RegisterUniquePackageName("context", nil) yarpcPkg = generator.RegisterUniquePackageName("yarpc", nil) }
go
func (g *Plugin) Init(gen *generator.Generator) { g.gen = gen contextPkg = generator.RegisterUniquePackageName("context", nil) yarpcPkg = generator.RegisterUniquePackageName("yarpc", nil) }
[ "func", "(", "g", "*", "Plugin", ")", "Init", "(", "gen", "*", "generator", ".", "Generator", ")", "{", "g", ".", "gen", "=", "gen", "\n", "contextPkg", "=", "generator", ".", "RegisterUniquePackageName", "(", "\"", "\"", ",", "nil", ")", "\n", "yarp...
// Init initializes the plugin.
[ "Init", "initializes", "the", "plugin", "." ]
b13d74d757bf9ea3e5574a491eb6646bdc4e2a04
https://github.com/influxdata/yarpc/blob/b13d74d757bf9ea3e5574a491eb6646bdc4e2a04/cmd/protoc-gen-yarpc/yarpc/plugin.go#L83-L87