repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6
values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
profitbricks/profitbricks-sdk-go | server.go | GetAttachedCdrom | func (c *Client) GetAttachedCdrom(dcid, srvid, cdid string) (*Image, error) {
url := serverCdromPath(dcid, srvid, cdid) // + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Image{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetAttachedCdrom(dcid, srvid, cdid string) (*Image, error) {
url := serverCdromPath(dcid, srvid, cdid) // + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Image{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAttachedCdrom",
"(",
"dcid",
",",
"srvid",
",",
"cdid",
"string",
")",
"(",
"*",
"Image",
",",
"error",
")",
"{",
"url",
":=",
"serverCdromPath",
"(",
"dcid",
",",
"srvid",
",",
"cdid",
")",
"\n",
"ret",
":... | //GetAttachedCdrom gets attached cd roms | [
"GetAttachedCdrom",
"gets",
"attached",
"cd",
"roms"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/server.go#L120-L125 | test |
profitbricks/profitbricks-sdk-go | server.go | DetachCdrom | func (c *Client) DetachCdrom(dcid, srvid, cdid string) (*http.Header, error) {
url := serverCdromPath(dcid, srvid, cdid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) DetachCdrom(dcid, srvid, cdid string) (*http.Header, error) {
url := serverCdromPath(dcid, srvid, cdid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DetachCdrom",
"(",
"dcid",
",",
"srvid",
",",
"cdid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"serverCdromPath",
"(",
"dcid",
",",
"srvid",
",",
"cdid",
")",
"+",
... | //DetachCdrom detaches a CD rom | [
"DetachCdrom",
"detaches",
"a",
"CD",
"rom"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/server.go#L128-L133 | test |
profitbricks/profitbricks-sdk-go | server.go | ListAttachedVolumes | func (c *Client) ListAttachedVolumes(dcid, srvid string) (*Volumes, error) {
url := serverVolumeColPath(dcid, srvid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Volumes{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListAttachedVolumes(dcid, srvid string) (*Volumes, error) {
url := serverVolumeColPath(dcid, srvid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Volumes{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListAttachedVolumes",
"(",
"dcid",
",",
"srvid",
"string",
")",
"(",
"*",
"Volumes",
",",
"error",
")",
"{",
"url",
":=",
"serverVolumeColPath",
"(",
"dcid",
",",
"srvid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"... | //ListAttachedVolumes lists attached volumes | [
"ListAttachedVolumes",
"lists",
"attached",
"volumes"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/server.go#L136-L141 | test |
profitbricks/profitbricks-sdk-go | server.go | AttachVolume | func (c *Client) AttachVolume(dcid string, srvid string, volid string) (*Volume, error) {
data := struct {
ID string `json:"id,omitempty"`
}{
volid,
}
url := serverVolumeColPath(dcid, srvid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Volume{}
err := c.client.Post(u... | go | func (c *Client) AttachVolume(dcid string, srvid string, volid string) (*Volume, error) {
data := struct {
ID string `json:"id,omitempty"`
}{
volid,
}
url := serverVolumeColPath(dcid, srvid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Volume{}
err := c.client.Post(u... | [
"func",
"(",
"c",
"*",
"Client",
")",
"AttachVolume",
"(",
"dcid",
"string",
",",
"srvid",
"string",
",",
"volid",
"string",
")",
"(",
"*",
"Volume",
",",
"error",
")",
"{",
"data",
":=",
"struct",
"{",
"ID",
"string",
"`json:\"id,omitempty\"`",
"\n",
... | //AttachVolume attaches a volume | [
"AttachVolume",
"attaches",
"a",
"volume"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/server.go#L144-L155 | test |
profitbricks/profitbricks-sdk-go | server.go | GetAttachedVolume | func (c *Client) GetAttachedVolume(dcid, srvid, volid string) (*Volume, error) {
url := serverVolumePath(dcid, srvid, volid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Volume{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetAttachedVolume(dcid, srvid, volid string) (*Volume, error) {
url := serverVolumePath(dcid, srvid, volid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Volume{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAttachedVolume",
"(",
"dcid",
",",
"srvid",
",",
"volid",
"string",
")",
"(",
"*",
"Volume",
",",
"error",
")",
"{",
"url",
":=",
"serverVolumePath",
"(",
"dcid",
",",
"srvid",
",",
"volid",
")",
"+",
"`?dept... | //GetAttachedVolume gets an attached volume | [
"GetAttachedVolume",
"gets",
"an",
"attached",
"volume"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/server.go#L158-L164 | test |
profitbricks/profitbricks-sdk-go | server.go | DetachVolume | func (c *Client) DetachVolume(dcid, srvid, volid string) (*http.Header, error) {
url := serverVolumePath(dcid, srvid, volid)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) DetachVolume(dcid, srvid, volid string) (*http.Header, error) {
url := serverVolumePath(dcid, srvid, volid)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DetachVolume",
"(",
"dcid",
",",
"srvid",
",",
"volid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"serverVolumePath",
"(",
"dcid",
",",
"srvid",
",",
"volid",
")",
"\... | //DetachVolume detaches a volume | [
"DetachVolume",
"detaches",
"a",
"volume"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/server.go#L167-L172 | test |
profitbricks/profitbricks-sdk-go | server.go | StartServer | func (c *Client) StartServer(dcid, srvid string) (*http.Header, error) {
url := serverPath(dcid, srvid) + "/start"
ret := &http.Header{}
err := c.client.Post(url, nil, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) StartServer(dcid, srvid string) (*http.Header, error) {
url := serverPath(dcid, srvid) + "/start"
ret := &http.Header{}
err := c.client.Post(url, nil, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"StartServer",
"(",
"dcid",
",",
"srvid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"serverPath",
"(",
"dcid",
",",
"srvid",
")",
"+",
"\"/start\"",
"\n",
"ret",
":=",... | // StartServer starts a server | [
"StartServer",
"starts",
"a",
"server"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/server.go#L175-L180 | test |
profitbricks/profitbricks-sdk-go | location.go | ListLocations | func (c *Client) ListLocations() (*Locations, error) {
url := locationColPath() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Locations{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListLocations() (*Locations, error) {
url := locationColPath() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Locations{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListLocations",
"(",
")",
"(",
"*",
"Locations",
",",
"error",
")",
"{",
"url",
":=",
"locationColPath",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",... | // ListLocations returns location collection data | [
"ListLocations",
"returns",
"location",
"collection",
"data"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/location.go#L39-L44 | test |
profitbricks/profitbricks-sdk-go | location.go | GetRegionalLocations | func (c *Client) GetRegionalLocations(regid string) (*Locations, error) {
url := locationRegPath(regid) + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Locations{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetRegionalLocations(regid string) (*Locations, error) {
url := locationRegPath(regid) + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Locations{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRegionalLocations",
"(",
"regid",
"string",
")",
"(",
"*",
"Locations",
",",
"error",
")",
"{",
"url",
":=",
"locationRegPath",
"(",
"regid",
")",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
... | // GetRegionalLocations returns a list of available locations in a specific region | [
"GetRegionalLocations",
"returns",
"a",
"list",
"of",
"available",
"locations",
"in",
"a",
"specific",
"region"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/location.go#L47-L52 | test |
profitbricks/profitbricks-sdk-go | location.go | GetLocation | func (c *Client) GetLocation(locid string) (*Location, error) {
url := locationPath(locid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Location{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetLocation(locid string) (*Location, error) {
url := locationPath(locid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Location{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetLocation",
"(",
"locid",
"string",
")",
"(",
"*",
"Location",
",",
"error",
")",
"{",
"url",
":=",
"locationPath",
"(",
"locid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`"... | // GetLocation returns location data | [
"GetLocation",
"returns",
"location",
"data"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/location.go#L55-L60 | test |
profitbricks/profitbricks-sdk-go | contractresources.go | GetContractResources | func (c *Client) GetContractResources() (*ContractResources, error) {
url := contractResourcePath() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &ContractResources{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetContractResources() (*ContractResources, error) {
url := contractResourcePath() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &ContractResources{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetContractResources",
"(",
")",
"(",
"*",
"ContractResources",
",",
"error",
")",
"{",
"url",
":=",
"contractResourcePath",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",... | // GetContractResources returns list of contract resources | [
"GetContractResources",
"returns",
"list",
"of",
"contract",
"resources"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/contractresources.go#L47-L53 | test |
profitbricks/profitbricks-sdk-go | image.go | ListImages | func (c *Client) ListImages() (*Images, error) {
url := imageColPath() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Images{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListImages() (*Images, error) {
url := imageColPath() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Images{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListImages",
"(",
")",
"(",
"*",
"Images",
",",
"error",
")",
"{",
"url",
":=",
"imageColPath",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"Forma... | // ListImages returns an Collection struct | [
"ListImages",
"returns",
"an",
"Collection",
"struct"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/image.go#L68-L73 | test |
profitbricks/profitbricks-sdk-go | image.go | GetImage | func (c *Client) GetImage(imageid string) (*Image, error) {
url := imagePath(imageid)
ret := &Image{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetImage(imageid string) (*Image, error) {
url := imagePath(imageid)
ret := &Image{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetImage",
"(",
"imageid",
"string",
")",
"(",
"*",
"Image",
",",
"error",
")",
"{",
"url",
":=",
"imagePath",
"(",
"imageid",
")",
"\n",
"ret",
":=",
"&",
"Image",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"... | // GetImage returns an Instance struct where id ==imageid | [
"GetImage",
"returns",
"an",
"Instance",
"struct",
"where",
"id",
"==",
"imageid"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/image.go#L76-L81 | test |
profitbricks/profitbricks-sdk-go | resp.go | PrintHeaders | func (r *Resp) PrintHeaders() {
for key, value := range r.Headers {
fmt.Println(key, " : ", value[0])
}
} | go | func (r *Resp) PrintHeaders() {
for key, value := range r.Headers {
fmt.Println(key, " : ", value[0])
}
} | [
"func",
"(",
"r",
"*",
"Resp",
")",
"PrintHeaders",
"(",
")",
"{",
"for",
"key",
",",
"value",
":=",
"range",
"r",
".",
"Headers",
"{",
"fmt",
".",
"Println",
"(",
"key",
",",
"\" : \"",
",",
"value",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"}"
] | // PrintHeaders prints the http headers as k,v pairs | [
"PrintHeaders",
"prints",
"the",
"http",
"headers",
"as",
"k",
"v",
"pairs"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/resp.go#L15-L20 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | ListGroups | func (c *Client) ListGroups() (*Groups, error) {
url := umGroups() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Groups{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListGroups() (*Groups, error) {
url := umGroups() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Groups{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListGroups",
"(",
")",
"(",
"*",
"Groups",
",",
"error",
")",
"{",
"url",
":=",
"umGroups",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBoo... | //ListGroups lists all groups | [
"ListGroups",
"lists",
"all",
"groups"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L166-L171 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | GetGroup | func (c *Client) GetGroup(groupid string) (*Group, error) {
url := umGroupPath(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Group{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetGroup(groupid string) (*Group, error) {
url := umGroupPath(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Group{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetGroup",
"(",
"groupid",
"string",
")",
"(",
"*",
"Group",
",",
"error",
")",
"{",
"url",
":=",
"umGroupPath",
"(",
"groupid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
... | //GetGroup gets a group | [
"GetGroup",
"gets",
"a",
"group"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L174-L179 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | CreateGroup | func (c *Client) CreateGroup(grp Group) (*Group, error) {
url := umGroups() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Group{}
err := c.client.Post(url, grp, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) CreateGroup(grp Group) (*Group, error) {
url := umGroups() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Group{}
err := c.client.Post(url, grp, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateGroup",
"(",
"grp",
"Group",
")",
"(",
"*",
"Group",
",",
"error",
")",
"{",
"url",
":=",
"umGroups",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",... | //CreateGroup creates a group | [
"CreateGroup",
"creates",
"a",
"group"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L182-L187 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | UpdateGroup | func (c *Client) UpdateGroup(groupid string, obj Group) (*Group, error) {
url := umGroupPath(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Group{}
err := c.client.Put(url, obj, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) UpdateGroup(groupid string, obj Group) (*Group, error) {
url := umGroupPath(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Group{}
err := c.client.Put(url, obj, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateGroup",
"(",
"groupid",
"string",
",",
"obj",
"Group",
")",
"(",
"*",
"Group",
",",
"error",
")",
"{",
"url",
":=",
"umGroupPath",
"(",
"groupid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"de... | //UpdateGroup updates a group | [
"UpdateGroup",
"updates",
"a",
"group"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L190-L195 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | DeleteGroup | func (c *Client) DeleteGroup(groupid string) (*http.Header, error) {
url := umGroupPath(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) DeleteGroup(groupid string) (*http.Header, error) {
url := umGroupPath(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteGroup",
"(",
"groupid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"umGroupPath",
"(",
"groupid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"... | //DeleteGroup deletes a group | [
"DeleteGroup",
"deletes",
"a",
"group"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L198-L203 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | ListShares | func (c *Client) ListShares(grpid string) (*Shares, error) {
url := umGroupShares(grpid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Shares{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListShares(grpid string) (*Shares, error) {
url := umGroupShares(grpid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Shares{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListShares",
"(",
"grpid",
"string",
")",
"(",
"*",
"Shares",
",",
"error",
")",
"{",
"url",
":=",
"umGroupShares",
"(",
"grpid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
... | //ListShares lists all shares | [
"ListShares",
"lists",
"all",
"shares"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L206-L211 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | GetShare | func (c *Client) GetShare(groupid string, resourceid string) (*Share, error) {
url := umGroupSharePath(groupid, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Share{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetShare(groupid string, resourceid string) (*Share, error) {
url := umGroupSharePath(groupid, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Share{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetShare",
"(",
"groupid",
"string",
",",
"resourceid",
"string",
")",
"(",
"*",
"Share",
",",
"error",
")",
"{",
"url",
":=",
"umGroupSharePath",
"(",
"groupid",
",",
"resourceid",
")",
"+",
"`?depth=`",
"+",
"c"... | // GetShare gets a share | [
"GetShare",
"gets",
"a",
"share"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L214-L219 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | AddShare | func (c *Client) AddShare(groupid string, resourceid string, share Share) (*Share, error) {
url := umGroupSharePath(groupid, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Share{}
err := c.client.Post(url, share, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) AddShare(groupid string, resourceid string, share Share) (*Share, error) {
url := umGroupSharePath(groupid, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Share{}
err := c.client.Post(url, share, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddShare",
"(",
"groupid",
"string",
",",
"resourceid",
"string",
",",
"share",
"Share",
")",
"(",
"*",
"Share",
",",
"error",
")",
"{",
"url",
":=",
"umGroupSharePath",
"(",
"groupid",
",",
"resourceid",
")",
"+"... | // AddShare adds a share | [
"AddShare",
"adds",
"a",
"share"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L222-L227 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | UpdateShare | func (c *Client) UpdateShare(groupid string, resourceid string, obj Share) (*Share, error) {
url := umGroupSharePath(groupid, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Share{}
err := c.client.Put(url, obj, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) UpdateShare(groupid string, resourceid string, obj Share) (*Share, error) {
url := umGroupSharePath(groupid, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Share{}
err := c.client.Put(url, obj, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateShare",
"(",
"groupid",
"string",
",",
"resourceid",
"string",
",",
"obj",
"Share",
")",
"(",
"*",
"Share",
",",
"error",
")",
"{",
"url",
":=",
"umGroupSharePath",
"(",
"groupid",
",",
"resourceid",
")",
"+... | // UpdateShare updates a share | [
"UpdateShare",
"updates",
"a",
"share"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L230-L235 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | DeleteShare | func (c *Client) DeleteShare(groupid string, resourceid string) (*http.Header, error) {
url := umGroupSharePath(groupid, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) DeleteShare(groupid string, resourceid string) (*http.Header, error) {
url := umGroupSharePath(groupid, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteShare",
"(",
"groupid",
"string",
",",
"resourceid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"umGroupSharePath",
"(",
"groupid",
",",
"resourceid",
")",
"+",
"`?d... | // DeleteShare deletes a share | [
"DeleteShare",
"deletes",
"a",
"share"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L238-L243 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | ListGroupUsers | func (c *Client) ListGroupUsers(groupid string) (*Users, error) {
url := umGroupUsers(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Users{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListGroupUsers(groupid string) (*Users, error) {
url := umGroupUsers(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Users{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListGroupUsers",
"(",
"groupid",
"string",
")",
"(",
"*",
"Users",
",",
"error",
")",
"{",
"url",
":=",
"umGroupUsers",
"(",
"groupid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&prett... | //ListGroupUsers lists Users in a group | [
"ListGroupUsers",
"lists",
"Users",
"in",
"a",
"group"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L246-L251 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | AddUserToGroup | func (c *Client) AddUserToGroup(groupid string, userid string) (*User, error) {
var usr User
usr.ID = userid
url := umGroupUsers(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &User{}
err := c.client.Post(url, usr, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) AddUserToGroup(groupid string, userid string) (*User, error) {
var usr User
usr.ID = userid
url := umGroupUsers(groupid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &User{}
err := c.client.Post(url, usr, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddUserToGroup",
"(",
"groupid",
"string",
",",
"userid",
"string",
")",
"(",
"*",
"User",
",",
"error",
")",
"{",
"var",
"usr",
"User",
"\n",
"usr",
".",
"ID",
"=",
"userid",
"\n",
"url",
":=",
"umGroupUsers",
... | // AddUserToGroup adds a user to a group | [
"AddUserToGroup",
"adds",
"a",
"user",
"to",
"a",
"group"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L254-L261 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | DeleteUserFromGroup | func (c *Client) DeleteUserFromGroup(groupid string, userid string) (*http.Header, error) {
url := umGroupUsersPath(groupid, userid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) DeleteUserFromGroup(groupid string, userid string) (*http.Header, error) {
url := umGroupUsersPath(groupid, userid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteUserFromGroup",
"(",
"groupid",
"string",
",",
"userid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"umGroupUsersPath",
"(",
"groupid",
",",
"userid",
")",
"+",
"`?d... | // DeleteUserFromGroup removes a user from a group | [
"DeleteUserFromGroup",
"removes",
"a",
"user",
"from",
"a",
"group"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L264-L269 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | ListUsers | func (c *Client) ListUsers() (*Users, error) {
url := umUsers() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Users{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListUsers() (*Users, error) {
url := umUsers() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Users{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListUsers",
"(",
")",
"(",
"*",
"Users",
",",
"error",
")",
"{",
"url",
":=",
"umUsers",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",... | //ListUsers lists all users | [
"ListUsers",
"lists",
"all",
"users"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L272-L277 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | GetUser | func (c *Client) GetUser(usrid string) (*User, error) {
url := umUsersPath(usrid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &User{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetUser(usrid string) (*User, error) {
url := umUsersPath(usrid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &User{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetUser",
"(",
"usrid",
"string",
")",
"(",
"*",
"User",
",",
"error",
")",
"{",
"url",
":=",
"umUsersPath",
"(",
"usrid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
... | // GetUser gets a user | [
"GetUser",
"gets",
"a",
"user"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L280-L285 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | CreateUser | func (c *Client) CreateUser(usr User) (*User, error) {
url := umUsers() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &User{}
err := c.client.Post(url, usr, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) CreateUser(usr User) (*User, error) {
url := umUsers() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &User{}
err := c.client.Post(url, usr, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateUser",
"(",
"usr",
"User",
")",
"(",
"*",
"User",
",",
"error",
")",
"{",
"url",
":=",
"umUsers",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
"... | //CreateUser creates a user | [
"CreateUser",
"creates",
"a",
"user"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L288-L293 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | UpdateUser | func (c *Client) UpdateUser(userid string, obj User) (*User, error) {
url := umUsersPath(userid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &User{}
err := c.client.Put(url, obj, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) UpdateUser(userid string, obj User) (*User, error) {
url := umUsersPath(userid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &User{}
err := c.client.Put(url, obj, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateUser",
"(",
"userid",
"string",
",",
"obj",
"User",
")",
"(",
"*",
"User",
",",
"error",
")",
"{",
"url",
":=",
"umUsersPath",
"(",
"userid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",... | //UpdateUser updates user information | [
"UpdateUser",
"updates",
"user",
"information"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L296-L301 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | DeleteUser | func (c *Client) DeleteUser(userid string) (*http.Header, error) {
url := umUsersPath(userid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | go | func (c *Client) DeleteUser(userid string) (*http.Header, error) {
url := umUsersPath(userid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &http.Header{}
err := c.client.Delete(url, ret, http.StatusAccepted)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteUser",
"(",
"userid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"umUsersPath",
"(",
"userid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",... | //DeleteUser deletes the specified user | [
"DeleteUser",
"deletes",
"the",
"specified",
"user"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L304-L309 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | ListResources | func (c *Client) ListResources() (*Resources, error) {
url := umResources() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Resources{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListResources() (*Resources, error) {
url := umResources() + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Resources{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListResources",
"(",
")",
"(",
"*",
"Resources",
",",
"error",
")",
"{",
"url",
":=",
"umResources",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"... | //ListResources lists all resources | [
"ListResources",
"lists",
"all",
"resources"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L312-L317 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | GetResourceByType | func (c *Client) GetResourceByType(resourcetype string, resourceid string) (*Resource, error) {
url := umResourcesTypePath(resourcetype, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Resource{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetResourceByType(resourcetype string, resourceid string) (*Resource, error) {
url := umResourcesTypePath(resourcetype, resourceid) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Resource{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetResourceByType",
"(",
"resourcetype",
"string",
",",
"resourceid",
"string",
")",
"(",
"*",
"Resource",
",",
"error",
")",
"{",
"url",
":=",
"umResourcesTypePath",
"(",
"resourcetype",
",",
"resourceid",
")",
"+",
... | //GetResourceByType gets a resource by type | [
"GetResourceByType",
"gets",
"a",
"resource",
"by",
"type"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L320-L325 | test |
profitbricks/profitbricks-sdk-go | usermanagment.go | ListResourcesByType | func (c *Client) ListResourcesByType(resourcetype string) (*Resources, error) {
url := umResourcesType(resourcetype) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Resources{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListResourcesByType(resourcetype string) (*Resources, error) {
url := umResourcesType(resourcetype) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Resources{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListResourcesByType",
"(",
"resourcetype",
"string",
")",
"(",
"*",
"Resources",
",",
"error",
")",
"{",
"url",
":=",
"umResourcesType",
"(",
"resourcetype",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"dep... | //ListResourcesByType list resources by type | [
"ListResourcesByType",
"list",
"resources",
"by",
"type"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/usermanagment.go#L328-L333 | test |
profitbricks/profitbricks-sdk-go | request.go | ListRequests | func (c *Client) ListRequests() (*Requests, error) {
url := "/requests" + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Requests{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) ListRequests() (*Requests, error) {
url := "/requests" + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Requests{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListRequests",
"(",
")",
"(",
"*",
"Requests",
",",
"error",
")",
"{",
"url",
":=",
"\"/requests\"",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
... | //ListRequests lists all requests | [
"ListRequests",
"lists",
"all",
"requests"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/request.go#L72-L77 | test |
profitbricks/profitbricks-sdk-go | request.go | GetRequest | func (c *Client) GetRequest(reqID string) (*Request, error) {
url := "/requests/" + reqID + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Request{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetRequest(reqID string) (*Request, error) {
url := "/requests/" + reqID + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &Request{}
err := c.client.Get(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRequest",
"(",
"reqID",
"string",
")",
"(",
"*",
"Request",
",",
"error",
")",
"{",
"url",
":=",
"\"/requests/\"",
"+",
"reqID",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+"... | //GetRequest gets a specific request | [
"GetRequest",
"gets",
"a",
"specific",
"request"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/request.go#L80-L85 | test |
profitbricks/profitbricks-sdk-go | request.go | GetRequestStatus | func (c *Client) GetRequestStatus(path string) (*RequestStatus, error) {
url := path + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &RequestStatus{}
err := c.client.GetRequestStatus(url, ret, http.StatusOK)
return ret, err
} | go | func (c *Client) GetRequestStatus(path string) (*RequestStatus, error) {
url := path + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty)
ret := &RequestStatus{}
err := c.client.GetRequestStatus(url, ret, http.StatusOK)
return ret, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRequestStatus",
"(",
"path",
"string",
")",
"(",
"*",
"RequestStatus",
",",
"error",
")",
"{",
"url",
":=",
"path",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
... | // GetRequestStatus retursn status of the request | [
"GetRequestStatus",
"retursn",
"status",
"of",
"the",
"request"
] | 1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4 | https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/request.go#L88-L93 | test |
mipearson/rfw | rfw.go | Close | func (l *Writer) Close() error {
l.mutex.Lock()
defer l.mutex.Unlock()
return l.file.Close()
} | go | func (l *Writer) Close() error {
l.mutex.Lock()
defer l.mutex.Unlock()
return l.file.Close()
} | [
"func",
"(",
"l",
"*",
"Writer",
")",
"Close",
"(",
")",
"error",
"{",
"l",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"l",
".",
"file",
".",
"Close",
"(",
")",
"\n",
"}"
] | // Close our writer. Subsequent writes will fail. | [
"Close",
"our",
"writer",
".",
"Subsequent",
"writes",
"will",
"fail",
"."
] | 6f0a6f3266ba1058df9ef0c94cda1cecd2e62852 | https://github.com/mipearson/rfw/blob/6f0a6f3266ba1058df9ef0c94cda1cecd2e62852/rfw.go#L55-L60 | test |
qor/serializable_meta | serializable_meta.go | GetSerializableArgument | func (serialize *SerializableMeta) GetSerializableArgument(serializableMetaInterface SerializableMetaInterface) interface{} {
if serialize.Value.OriginalValue != nil {
return serialize.Value.OriginalValue
}
if res := serializableMetaInterface.GetSerializableArgumentResource(); res != nil {
value := res.NewStruc... | go | func (serialize *SerializableMeta) GetSerializableArgument(serializableMetaInterface SerializableMetaInterface) interface{} {
if serialize.Value.OriginalValue != nil {
return serialize.Value.OriginalValue
}
if res := serializableMetaInterface.GetSerializableArgumentResource(); res != nil {
value := res.NewStruc... | [
"func",
"(",
"serialize",
"*",
"SerializableMeta",
")",
"GetSerializableArgument",
"(",
"serializableMetaInterface",
"SerializableMetaInterface",
")",
"interface",
"{",
"}",
"{",
"if",
"serialize",
".",
"Value",
".",
"OriginalValue",
"!=",
"nil",
"{",
"return",
"ser... | // GetSerializableArgument get serializable argument | [
"GetSerializableArgument",
"get",
"serializable",
"argument"
] | 5fd8542db4170c6ce0f8d669b521803b87eb0a99 | https://github.com/qor/serializable_meta/blob/5fd8542db4170c6ce0f8d669b521803b87eb0a99/serializable_meta.go#L67-L78 | test |
ianschenck/envflag | envflag.go | BoolVar | func BoolVar(p *bool, name string, value bool, usage string) {
EnvironmentFlags.BoolVar(p, name, value, usage)
} | go | func BoolVar(p *bool, name string, value bool, usage string) {
EnvironmentFlags.BoolVar(p, name, value, usage)
} | [
"func",
"BoolVar",
"(",
"p",
"*",
"bool",
",",
"name",
"string",
",",
"value",
"bool",
",",
"usage",
"string",
")",
"{",
"EnvironmentFlags",
".",
"BoolVar",
"(",
"p",
",",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // BoolVar defines a bool flag with specified name, default value, and
// usage string. The argument p points to a bool variable in which to
// store the value of the flag. | [
"BoolVar",
"defines",
"a",
"bool",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"argument",
"p",
"points",
"to",
"a",
"bool",
"variable",
"in",
"which",
"to",
"store",
"the",
"value",
"of",
"the",
"flag",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L53-L55 | test |
ianschenck/envflag | envflag.go | Bool | func Bool(name string, value bool, usage string) *bool {
return EnvironmentFlags.Bool(name, value, usage)
} | go | func Bool(name string, value bool, usage string) *bool {
return EnvironmentFlags.Bool(name, value, usage)
} | [
"func",
"Bool",
"(",
"name",
"string",
",",
"value",
"bool",
",",
"usage",
"string",
")",
"*",
"bool",
"{",
"return",
"EnvironmentFlags",
".",
"Bool",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Bool defines a bool flag with specified name, default value, and
// usage string. The return value is the address of a bool variable
// that stores the value of the flag. | [
"Bool",
"defines",
"a",
"bool",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"bool",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"flag",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L60-L62 | test |
ianschenck/envflag | envflag.go | IntVar | func IntVar(p *int, name string, value int, usage string) {
EnvironmentFlags.IntVar(p, name, value, usage)
} | go | func IntVar(p *int, name string, value int, usage string) {
EnvironmentFlags.IntVar(p, name, value, usage)
} | [
"func",
"IntVar",
"(",
"p",
"*",
"int",
",",
"name",
"string",
",",
"value",
"int",
",",
"usage",
"string",
")",
"{",
"EnvironmentFlags",
".",
"IntVar",
"(",
"p",
",",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // IntVar defines an int flag with specified name, default value, and
// usage string. The argument p points to an int variable in which to
// store the value of the flag. | [
"IntVar",
"defines",
"an",
"int",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"argument",
"p",
"points",
"to",
"an",
"int",
"variable",
"in",
"which",
"to",
"store",
"the",
"value",
"of",
"the",
"flag",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L67-L69 | test |
ianschenck/envflag | envflag.go | Int | func Int(name string, value int, usage string) *int {
return EnvironmentFlags.Int(name, value, usage)
} | go | func Int(name string, value int, usage string) *int {
return EnvironmentFlags.Int(name, value, usage)
} | [
"func",
"Int",
"(",
"name",
"string",
",",
"value",
"int",
",",
"usage",
"string",
")",
"*",
"int",
"{",
"return",
"EnvironmentFlags",
".",
"Int",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Int defines an int flag with specified name, default value, and
// usage string. The return value is the address of an int variable
// that stores the value of the flag. | [
"Int",
"defines",
"an",
"int",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"an",
"int",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"flag",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L74-L76 | test |
ianschenck/envflag | envflag.go | Int64Var | func Int64Var(p *int64, name string, value int64, usage string) {
EnvironmentFlags.Int64Var(p, name, value, usage)
} | go | func Int64Var(p *int64, name string, value int64, usage string) {
EnvironmentFlags.Int64Var(p, name, value, usage)
} | [
"func",
"Int64Var",
"(",
"p",
"*",
"int64",
",",
"name",
"string",
",",
"value",
"int64",
",",
"usage",
"string",
")",
"{",
"EnvironmentFlags",
".",
"Int64Var",
"(",
"p",
",",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Int64Var defines an int64 flag with specified name, default value,
// and usage string. The argument p points to an int64 variable in
// which to store the value of the flag. | [
"Int64Var",
"defines",
"an",
"int64",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"argument",
"p",
"points",
"to",
"an",
"int64",
"variable",
"in",
"which",
"to",
"store",
"the",
"value",
"of",
"the",
"fla... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L81-L83 | test |
ianschenck/envflag | envflag.go | Int64 | func Int64(name string, value int64, usage string) *int64 {
return EnvironmentFlags.Int64(name, value, usage)
} | go | func Int64(name string, value int64, usage string) *int64 {
return EnvironmentFlags.Int64(name, value, usage)
} | [
"func",
"Int64",
"(",
"name",
"string",
",",
"value",
"int64",
",",
"usage",
"string",
")",
"*",
"int64",
"{",
"return",
"EnvironmentFlags",
".",
"Int64",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Int64 defines an int64 flag with specified name, default value, and
// usage string. The return value is the address of an int64 variable
// that stores the value of the flag. | [
"Int64",
"defines",
"an",
"int64",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"an",
"int64",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"fl... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L88-L90 | test |
ianschenck/envflag | envflag.go | UintVar | func UintVar(p *uint, name string, value uint, usage string) {
EnvironmentFlags.UintVar(p, name, value, usage)
} | go | func UintVar(p *uint, name string, value uint, usage string) {
EnvironmentFlags.UintVar(p, name, value, usage)
} | [
"func",
"UintVar",
"(",
"p",
"*",
"uint",
",",
"name",
"string",
",",
"value",
"uint",
",",
"usage",
"string",
")",
"{",
"EnvironmentFlags",
".",
"UintVar",
"(",
"p",
",",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // UintVar defines a uint flag with specified name, default value, and
// usage string. The argument p points to a uint variable in which to
// store the value of the flag. | [
"UintVar",
"defines",
"a",
"uint",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"argument",
"p",
"points",
"to",
"a",
"uint",
"variable",
"in",
"which",
"to",
"store",
"the",
"value",
"of",
"the",
"flag",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L95-L97 | test |
ianschenck/envflag | envflag.go | Uint | func Uint(name string, value uint, usage string) *uint {
return EnvironmentFlags.Uint(name, value, usage)
} | go | func Uint(name string, value uint, usage string) *uint {
return EnvironmentFlags.Uint(name, value, usage)
} | [
"func",
"Uint",
"(",
"name",
"string",
",",
"value",
"uint",
",",
"usage",
"string",
")",
"*",
"uint",
"{",
"return",
"EnvironmentFlags",
".",
"Uint",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Uint defines a uint flag with specified name, default value, and
// usage string. The return value is the address of a uint variable
// that stores the value of the flag. | [
"Uint",
"defines",
"a",
"uint",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"uint",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"flag",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L102-L104 | test |
ianschenck/envflag | envflag.go | Uint64Var | func Uint64Var(p *uint64, name string, value uint64, usage string) {
EnvironmentFlags.Uint64Var(p, name, value, usage)
} | go | func Uint64Var(p *uint64, name string, value uint64, usage string) {
EnvironmentFlags.Uint64Var(p, name, value, usage)
} | [
"func",
"Uint64Var",
"(",
"p",
"*",
"uint64",
",",
"name",
"string",
",",
"value",
"uint64",
",",
"usage",
"string",
")",
"{",
"EnvironmentFlags",
".",
"Uint64Var",
"(",
"p",
",",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Uint64Var defines a uint64 flag with specified name, default value,
// and usage string. The argument p points to a uint64 variable in
// which to store the value of the flag. | [
"Uint64Var",
"defines",
"a",
"uint64",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"argument",
"p",
"points",
"to",
"a",
"uint64",
"variable",
"in",
"which",
"to",
"store",
"the",
"value",
"of",
"the",
"fl... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L109-L111 | test |
ianschenck/envflag | envflag.go | Uint64 | func Uint64(name string, value uint64, usage string) *uint64 {
return EnvironmentFlags.Uint64(name, value, usage)
} | go | func Uint64(name string, value uint64, usage string) *uint64 {
return EnvironmentFlags.Uint64(name, value, usage)
} | [
"func",
"Uint64",
"(",
"name",
"string",
",",
"value",
"uint64",
",",
"usage",
"string",
")",
"*",
"uint64",
"{",
"return",
"EnvironmentFlags",
".",
"Uint64",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Uint64 defines a uint64 flag with specified name, default value,
// and usage string. The return value is the address of a uint64
// variable that stores the value of the flag. | [
"Uint64",
"defines",
"a",
"uint64",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"uint64",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"f... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L116-L118 | test |
ianschenck/envflag | envflag.go | StringVar | func StringVar(p *string, name string, value string, usage string) {
EnvironmentFlags.StringVar(p, name, value, usage)
} | go | func StringVar(p *string, name string, value string, usage string) {
EnvironmentFlags.StringVar(p, name, value, usage)
} | [
"func",
"StringVar",
"(",
"p",
"*",
"string",
",",
"name",
"string",
",",
"value",
"string",
",",
"usage",
"string",
")",
"{",
"EnvironmentFlags",
".",
"StringVar",
"(",
"p",
",",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // StringVar defines a string flag with specified name, default value,
// and usage string. The argument p points to a string variable in
// which to store the value of the flag. | [
"StringVar",
"defines",
"a",
"string",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"argument",
"p",
"points",
"to",
"a",
"string",
"variable",
"in",
"which",
"to",
"store",
"the",
"value",
"of",
"the",
"fl... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L123-L125 | test |
ianschenck/envflag | envflag.go | String | func String(name string, value string, usage string) *string {
return EnvironmentFlags.String(name, value, usage)
} | go | func String(name string, value string, usage string) *string {
return EnvironmentFlags.String(name, value, usage)
} | [
"func",
"String",
"(",
"name",
"string",
",",
"value",
"string",
",",
"usage",
"string",
")",
"*",
"string",
"{",
"return",
"EnvironmentFlags",
".",
"String",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // String defines a string flag with specified name, default value,
// and usage string. The return value is the address of a string
// variable that stores the value of the flag. | [
"String",
"defines",
"a",
"string",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"string",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"f... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L130-L132 | test |
ianschenck/envflag | envflag.go | Float64Var | func Float64Var(p *float64, name string, value float64, usage string) {
EnvironmentFlags.Float64Var(p, name, value, usage)
} | go | func Float64Var(p *float64, name string, value float64, usage string) {
EnvironmentFlags.Float64Var(p, name, value, usage)
} | [
"func",
"Float64Var",
"(",
"p",
"*",
"float64",
",",
"name",
"string",
",",
"value",
"float64",
",",
"usage",
"string",
")",
"{",
"EnvironmentFlags",
".",
"Float64Var",
"(",
"p",
",",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Float64Var defines a float64 flag with specified name, default
// value, and usage string. The argument p points to a float64
// variable in which to store the value of the flag. | [
"Float64Var",
"defines",
"a",
"float64",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"argument",
"p",
"points",
"to",
"a",
"float64",
"variable",
"in",
"which",
"to",
"store",
"the",
"value",
"of",
"the",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L137-L139 | test |
ianschenck/envflag | envflag.go | Float64 | func Float64(name string, value float64, usage string) *float64 {
return EnvironmentFlags.Float64(name, value, usage)
} | go | func Float64(name string, value float64, usage string) *float64 {
return EnvironmentFlags.Float64(name, value, usage)
} | [
"func",
"Float64",
"(",
"name",
"string",
",",
"value",
"float64",
",",
"usage",
"string",
")",
"*",
"float64",
"{",
"return",
"EnvironmentFlags",
".",
"Float64",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Float64 defines a float64 flag with specified name, default value,
// and usage string. The return value is the address of a float64
// variable that stores the value of the flag. | [
"Float64",
"defines",
"a",
"float64",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"float64",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L144-L146 | test |
ianschenck/envflag | envflag.go | DurationVar | func DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
EnvironmentFlags.DurationVar(p, name, value, usage)
} | go | func DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
EnvironmentFlags.DurationVar(p, name, value, usage)
} | [
"func",
"DurationVar",
"(",
"p",
"*",
"time",
".",
"Duration",
",",
"name",
"string",
",",
"value",
"time",
".",
"Duration",
",",
"usage",
"string",
")",
"{",
"EnvironmentFlags",
".",
"DurationVar",
"(",
"p",
",",
"name",
",",
"value",
",",
"usage",
")... | // DurationVar defines a time.Duration flag with specified name,
// default value, and usage string. The argument p points to a
// time.Duration variable in which to store the value of the flag. | [
"DurationVar",
"defines",
"a",
"time",
".",
"Duration",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"argument",
"p",
"points",
"to",
"a",
"time",
".",
"Duration",
"variable",
"in",
"which",
"to",
"store",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L151-L153 | test |
ianschenck/envflag | envflag.go | Duration | func Duration(name string, value time.Duration, usage string) *time.Duration {
return EnvironmentFlags.Duration(name, value, usage)
} | go | func Duration(name string, value time.Duration, usage string) *time.Duration {
return EnvironmentFlags.Duration(name, value, usage)
} | [
"func",
"Duration",
"(",
"name",
"string",
",",
"value",
"time",
".",
"Duration",
",",
"usage",
"string",
")",
"*",
"time",
".",
"Duration",
"{",
"return",
"EnvironmentFlags",
".",
"Duration",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] | // Duration defines a time.Duration flag with specified name, default
// value, and usage string. The return value is the address of a
// time.Duration variable that stores the value of the flag. | [
"Duration",
"defines",
"a",
"time",
".",
"Duration",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"time",
".",
"Duration",
"variable",
"that",
"stores",
... | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L158-L160 | test |
ianschenck/envflag | envflag.go | Parse | func Parse() {
env := os.Environ()
// Clean up and "fake" some flag k/v pairs.
args := make([]string, 0, len(env))
for _, value := range env {
if Lookup(value[:strings.Index(value, "=")]) == nil {
continue
}
args = append(args, fmt.Sprintf("-%s", value))
}
EnvironmentFlags.Parse(args)
} | go | func Parse() {
env := os.Environ()
// Clean up and "fake" some flag k/v pairs.
args := make([]string, 0, len(env))
for _, value := range env {
if Lookup(value[:strings.Index(value, "=")]) == nil {
continue
}
args = append(args, fmt.Sprintf("-%s", value))
}
EnvironmentFlags.Parse(args)
} | [
"func",
"Parse",
"(",
")",
"{",
"env",
":=",
"os",
".",
"Environ",
"(",
")",
"\n",
"args",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"env",
")",
")",
"\n",
"for",
"_",
",",
"value",
":=",
"range",
"env",
"{",
"if",
"... | // Parse parses the environment flags from os.Environ. Must be called
// after all flags are defined and before flags are accessed by the
// program. | [
"Parse",
"parses",
"the",
"environment",
"flags",
"from",
"os",
".",
"Environ",
".",
"Must",
"be",
"called",
"after",
"all",
"flags",
"are",
"defined",
"and",
"before",
"flags",
"are",
"accessed",
"by",
"the",
"program",
"."
] | 9111d830d133f952887a936367fb0211c3134f0d | https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L171-L182 | test |
akutz/gotil | gotil.go | WriteStringToFile | func WriteStringToFile(text, path string) error {
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0644)
defer f.Close()
if err != nil {
return err
}
f.WriteString(text)
return nil
} | go | func WriteStringToFile(text, path string) error {
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0644)
defer f.Close()
if err != nil {
return err
}
f.WriteString(text)
return nil
} | [
"func",
"WriteStringToFile",
"(",
"text",
",",
"path",
"string",
")",
"error",
"{",
"f",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"path",
",",
"os",
".",
"O_CREATE",
"|",
"os",
".",
"O_WRONLY",
",",
"0644",
")",
"\n",
"defer",
"f",
".",
"Close... | // WriteStringToFile writes the string to the file at the provided path. | [
"WriteStringToFile",
"writes",
"the",
"string",
"to",
"the",
"file",
"at",
"the",
"provided",
"path",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L67-L77 | test |
akutz/gotil | gotil.go | ReadFileToString | func ReadFileToString(path string) (string, error) {
f, err := os.Open(path)
if err != nil {
return "", err
}
defer f.Close()
scanner := bufio.NewScanner(f)
scanner.Scan()
return scanner.Text(), nil
} | go | func ReadFileToString(path string) (string, error) {
f, err := os.Open(path)
if err != nil {
return "", err
}
defer f.Close()
scanner := bufio.NewScanner(f)
scanner.Scan()
return scanner.Text(), nil
} | [
"func",
"ReadFileToString",
"(",
"path",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"\"",
",",
"err",
"\n",
"}",
"\n",
"defer"... | // ReadFileToString reads the file at the provided path to a string. | [
"ReadFileToString",
"reads",
"the",
"file",
"at",
"the",
"provided",
"path",
"to",
"a",
"string",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L80-L92 | test |
akutz/gotil | gotil.go | LineReader | func LineReader(r io.Reader) (<-chan string, error) {
return lineReader(func() (io.Reader, func(), error) { return r, nil, nil })
} | go | func LineReader(r io.Reader) (<-chan string, error) {
return lineReader(func() (io.Reader, func(), error) { return r, nil, nil })
} | [
"func",
"LineReader",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"<-",
"chan",
"string",
",",
"error",
")",
"{",
"return",
"lineReader",
"(",
"func",
"(",
")",
"(",
"io",
".",
"Reader",
",",
"func",
"(",
")",
",",
"error",
")",
"{",
"return",
"r",
... | // LineReader returns a channel that reads the contents of a reader
// line-by-line. | [
"LineReader",
"returns",
"a",
"channel",
"that",
"reads",
"the",
"contents",
"of",
"a",
"reader",
"line",
"-",
"by",
"-",
"line",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L136-L138 | test |
akutz/gotil | gotil.go | LineReaderFrom | func LineReaderFrom(path string) (<-chan string, error) {
return lineReader(func() (io.Reader, func(), error) {
if !FileExists(path) {
return nil, nil, nil
}
f, err := os.Open(path)
if err != nil {
return nil, nil, err
}
return f, func() { f.Close() }, nil
})
} | go | func LineReaderFrom(path string) (<-chan string, error) {
return lineReader(func() (io.Reader, func(), error) {
if !FileExists(path) {
return nil, nil, nil
}
f, err := os.Open(path)
if err != nil {
return nil, nil, err
}
return f, func() { f.Close() }, nil
})
} | [
"func",
"LineReaderFrom",
"(",
"path",
"string",
")",
"(",
"<-",
"chan",
"string",
",",
"error",
")",
"{",
"return",
"lineReader",
"(",
"func",
"(",
")",
"(",
"io",
".",
"Reader",
",",
"func",
"(",
")",
",",
"error",
")",
"{",
"if",
"!",
"FileExist... | // LineReaderFrom returns a channel that reads the contents of a file
// line-by-line. | [
"LineReaderFrom",
"returns",
"a",
"channel",
"that",
"reads",
"the",
"contents",
"of",
"a",
"file",
"line",
"-",
"by",
"-",
"line",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L142-L153 | test |
akutz/gotil | gotil.go | FileExists | func FileExists(filePath string) bool {
if _, err := os.Stat(filePath); !os.IsNotExist(err) {
return true
}
return false
} | go | func FileExists(filePath string) bool {
if _, err := os.Stat(filePath); !os.IsNotExist(err) {
return true
}
return false
} | [
"func",
"FileExists",
"(",
"filePath",
"string",
")",
"bool",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"filePath",
")",
";",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
... | // FileExists returns a flag indicating whether a provided file path exists. | [
"FileExists",
"returns",
"a",
"flag",
"indicating",
"whether",
"a",
"provided",
"file",
"path",
"exists",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L156-L161 | test |
akutz/gotil | gotil.go | FileExistsInPath | func FileExistsInPath(fileName string) bool {
_, err := exec.LookPath(fileName)
return err == nil
} | go | func FileExistsInPath(fileName string) bool {
_, err := exec.LookPath(fileName)
return err == nil
} | [
"func",
"FileExistsInPath",
"(",
"fileName",
"string",
")",
"bool",
"{",
"_",
",",
"err",
":=",
"exec",
".",
"LookPath",
"(",
"fileName",
")",
"\n",
"return",
"err",
"==",
"nil",
"\n",
"}"
] | // FileExistsInPath returns a flag indicating whether the provided file exists
// in the current path. | [
"FileExistsInPath",
"returns",
"a",
"flag",
"indicating",
"whether",
"the",
"provided",
"file",
"exists",
"in",
"the",
"current",
"path",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L165-L168 | test |
akutz/gotil | gotil.go | GetPathParts | func GetPathParts(path string) (dirPath, fileName, absPath string) {
lookup, lookupErr := exec.LookPath(path)
if lookupErr == nil {
path = lookup
}
absPath, _ = filepath.Abs(path)
dirPath = filepath.Dir(absPath)
fileName = filepath.Base(absPath)
return
} | go | func GetPathParts(path string) (dirPath, fileName, absPath string) {
lookup, lookupErr := exec.LookPath(path)
if lookupErr == nil {
path = lookup
}
absPath, _ = filepath.Abs(path)
dirPath = filepath.Dir(absPath)
fileName = filepath.Base(absPath)
return
} | [
"func",
"GetPathParts",
"(",
"path",
"string",
")",
"(",
"dirPath",
",",
"fileName",
",",
"absPath",
"string",
")",
"{",
"lookup",
",",
"lookupErr",
":=",
"exec",
".",
"LookPath",
"(",
"path",
")",
"\n",
"if",
"lookupErr",
"==",
"nil",
"{",
"path",
"="... | // GetPathParts returns the absolute directory path, the file name, and the
// absolute path of the provided path string. | [
"GetPathParts",
"returns",
"the",
"absolute",
"directory",
"path",
"the",
"file",
"name",
"and",
"the",
"absolute",
"path",
"of",
"the",
"provided",
"path",
"string",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L172-L181 | test |
akutz/gotil | gotil.go | GetThisPathParts | func GetThisPathParts() (dirPath, fileName, absPath string) {
exeFile, _ := osext.Executable()
return GetPathParts(exeFile)
} | go | func GetThisPathParts() (dirPath, fileName, absPath string) {
exeFile, _ := osext.Executable()
return GetPathParts(exeFile)
} | [
"func",
"GetThisPathParts",
"(",
")",
"(",
"dirPath",
",",
"fileName",
",",
"absPath",
"string",
")",
"{",
"exeFile",
",",
"_",
":=",
"osext",
".",
"Executable",
"(",
")",
"\n",
"return",
"GetPathParts",
"(",
"exeFile",
")",
"\n",
"}"
] | // GetThisPathParts returns the same information as GetPathParts for the
// current executable. | [
"GetThisPathParts",
"returns",
"the",
"same",
"information",
"as",
"GetPathParts",
"for",
"the",
"current",
"executable",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L185-L188 | test |
akutz/gotil | gotil.go | RandomString | func RandomString(length int) string {
src := rand.NewSource(time.Now().UnixNano())
b := make([]byte, length)
for i, cache, remain := length-1, src.Int63(), letterIndexMax; i >= 0; {
if remain == 0 {
cache, remain = src.Int63(), letterIndexMax
}
if idx := int(cache & letterIndexMask); idx < len(letterBytes)... | go | func RandomString(length int) string {
src := rand.NewSource(time.Now().UnixNano())
b := make([]byte, length)
for i, cache, remain := length-1, src.Int63(), letterIndexMax; i >= 0; {
if remain == 0 {
cache, remain = src.Int63(), letterIndexMax
}
if idx := int(cache & letterIndexMask); idx < len(letterBytes)... | [
"func",
"RandomString",
"(",
"length",
"int",
")",
"string",
"{",
"src",
":=",
"rand",
".",
"NewSource",
"(",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
")",
"\n",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"length",
")",
"\n",
... | // RandomString generates a random set of characters with the given lenght. | [
"RandomString",
"generates",
"a",
"random",
"set",
"of",
"characters",
"with",
"the",
"given",
"lenght",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L191-L207 | test |
akutz/gotil | gotil.go | ParseAddress | func ParseAddress(addr string) (proto string, path string, err error) {
m := netAddrRx.FindStringSubmatch(addr)
if m == nil {
return "", "", goof.WithField("address", addr, "invalid address")
}
return m[1], m[2], nil
} | go | func ParseAddress(addr string) (proto string, path string, err error) {
m := netAddrRx.FindStringSubmatch(addr)
if m == nil {
return "", "", goof.WithField("address", addr, "invalid address")
}
return m[1], m[2], nil
} | [
"func",
"ParseAddress",
"(",
"addr",
"string",
")",
"(",
"proto",
"string",
",",
"path",
"string",
",",
"err",
"error",
")",
"{",
"m",
":=",
"netAddrRx",
".",
"FindStringSubmatch",
"(",
"addr",
")",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"\"\"",
... | // ParseAddress parses a standard golang network address and returns the
// protocol and path. | [
"ParseAddress",
"parses",
"a",
"standard",
"golang",
"network",
"address",
"and",
"returns",
"the",
"protocol",
"and",
"path",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L226-L232 | test |
akutz/gotil | gotil.go | HomeDir | func HomeDir() string {
if homeDirSet {
return homeDir
}
if user, err := user.Current(); err == nil {
homeDir = user.HomeDir
}
homeDirSet = true
return homeDir
} | go | func HomeDir() string {
if homeDirSet {
return homeDir
}
if user, err := user.Current(); err == nil {
homeDir = user.HomeDir
}
homeDirSet = true
return homeDir
} | [
"func",
"HomeDir",
"(",
")",
"string",
"{",
"if",
"homeDirSet",
"{",
"return",
"homeDir",
"\n",
"}",
"\n",
"if",
"user",
",",
"err",
":=",
"user",
".",
"Current",
"(",
")",
";",
"err",
"==",
"nil",
"{",
"homeDir",
"=",
"user",
".",
"HomeDir",
"\n",... | // HomeDir returns the home directory of the user that owns the current process. | [
"HomeDir",
"returns",
"the",
"home",
"directory",
"of",
"the",
"user",
"that",
"owns",
"the",
"current",
"process",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L273-L282 | test |
akutz/gotil | gotil.go | IsTCPPortAvailable | func IsTCPPortAvailable(port int) bool {
if port < minTCPPort || port > maxTCPPort {
return false
}
conn, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port))
if err != nil {
return false
}
conn.Close()
return true
} | go | func IsTCPPortAvailable(port int) bool {
if port < minTCPPort || port > maxTCPPort {
return false
}
conn, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port))
if err != nil {
return false
}
conn.Close()
return true
} | [
"func",
"IsTCPPortAvailable",
"(",
"port",
"int",
")",
"bool",
"{",
"if",
"port",
"<",
"minTCPPort",
"||",
"port",
">",
"maxTCPPort",
"{",
"return",
"false",
"\n",
"}",
"\n",
"conn",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"tcp\"",
",",
"fmt",
... | // IsTCPPortAvailable returns a flag indicating whether or not a TCP port is
// available. | [
"IsTCPPortAvailable",
"returns",
"a",
"flag",
"indicating",
"whether",
"or",
"not",
"a",
"TCP",
"port",
"is",
"available",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L297-L307 | test |
akutz/gotil | gotil.go | RandomTCPPort | func RandomTCPPort() int {
for i := maxReservedTCPPort; i < maxTCPPort; i++ {
p := tcpPortRand.Intn(maxRandTCPPort) + maxReservedTCPPort + 1
if IsTCPPortAvailable(p) {
return p
}
}
return -1
} | go | func RandomTCPPort() int {
for i := maxReservedTCPPort; i < maxTCPPort; i++ {
p := tcpPortRand.Intn(maxRandTCPPort) + maxReservedTCPPort + 1
if IsTCPPortAvailable(p) {
return p
}
}
return -1
} | [
"func",
"RandomTCPPort",
"(",
")",
"int",
"{",
"for",
"i",
":=",
"maxReservedTCPPort",
";",
"i",
"<",
"maxTCPPort",
";",
"i",
"++",
"{",
"p",
":=",
"tcpPortRand",
".",
"Intn",
"(",
"maxRandTCPPort",
")",
"+",
"maxReservedTCPPort",
"+",
"1",
"\n",
"if",
... | // RandomTCPPort gets a free, random TCP port between 1025-65535. If no free
// ports are available -1 is returned. | [
"RandomTCPPort",
"gets",
"a",
"free",
"random",
"TCP",
"port",
"between",
"1025",
"-",
"65535",
".",
"If",
"no",
"free",
"ports",
"are",
"available",
"-",
"1",
"is",
"returned",
"."
] | 6fa2e80bd3ac40f15788cfc3d12ebba49a0add92 | https://github.com/akutz/gotil/blob/6fa2e80bd3ac40f15788cfc3d12ebba49a0add92/gotil.go#L311-L319 | test |
piotrkowalczuk/mnemosyne | internal/jump/jump.go | HashString | func HashString(key string, numBuckets int) int32 {
// jump.Hash returns values from 0.
k := Hash(Sum64(key), numBuckets)
return k
} | go | func HashString(key string, numBuckets int) int32 {
// jump.Hash returns values from 0.
k := Hash(Sum64(key), numBuckets)
return k
} | [
"func",
"HashString",
"(",
"key",
"string",
",",
"numBuckets",
"int",
")",
"int32",
"{",
"k",
":=",
"Hash",
"(",
"Sum64",
"(",
"key",
")",
",",
"numBuckets",
")",
"\n",
"return",
"k",
"\n",
"}"
] | // HashString works like hash but accept string as an input. | [
"HashString",
"works",
"like",
"hash",
"but",
"accept",
"string",
"as",
"an",
"input",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/jump/jump.go#L33-L38 | test |
piotrkowalczuk/mnemosyne | mnemosyned/session_manager.go | Context | func (sm *sessionManager) Context(ctx context.Context, req *empty.Empty) (*mnemosynerpc.ContextResponse, error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return nil, status.Errorf(codes.InvalidArgument, "missing metadata in context, access token cannot be retrieved")
}
if len(md[mnemosyne.AccessToke... | go | func (sm *sessionManager) Context(ctx context.Context, req *empty.Empty) (*mnemosynerpc.ContextResponse, error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return nil, status.Errorf(codes.InvalidArgument, "missing metadata in context, access token cannot be retrieved")
}
if len(md[mnemosyne.AccessToke... | [
"func",
"(",
"sm",
"*",
"sessionManager",
")",
"Context",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"empty",
".",
"Empty",
")",
"(",
"*",
"mnemosynerpc",
".",
"ContextResponse",
",",
"error",
")",
"{",
"md",
",",
"ok",
":=",
"metadata",
... | // Context gets implements RPCServer interface. | [
"Context",
"gets",
"implements",
"RPCServer",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/mnemosyned/session_manager.go#L123-L142 | test |
piotrkowalczuk/mnemosyne | mnemosynerpc/session.go | Token | func (s *Session) Token() (*oauth2.Token, error) {
var (
err error
expireAt time.Time
)
if s.ExpireAt != nil {
expireAt, err = ptypes.Timestamp(s.ExpireAt)
if err != nil {
return nil, err
}
}
token := &oauth2.Token{
AccessToken: string(s.AccessToken),
Expiry: expireAt,
}
if s.Bag != ni... | go | func (s *Session) Token() (*oauth2.Token, error) {
var (
err error
expireAt time.Time
)
if s.ExpireAt != nil {
expireAt, err = ptypes.Timestamp(s.ExpireAt)
if err != nil {
return nil, err
}
}
token := &oauth2.Token{
AccessToken: string(s.AccessToken),
Expiry: expireAt,
}
if s.Bag != ni... | [
"func",
"(",
"s",
"*",
"Session",
")",
"Token",
"(",
")",
"(",
"*",
"oauth2",
".",
"Token",
",",
"error",
")",
"{",
"var",
"(",
"err",
"error",
"\n",
"expireAt",
"time",
".",
"Time",
"\n",
")",
"\n",
"if",
"s",
".",
"ExpireAt",
"!=",
"nil",
"{"... | // Token implements oauth2.TokenSource interface. | [
"Token",
"implements",
"oauth2",
".",
"TokenSource",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/mnemosynerpc/session.go#L12-L32 | test |
piotrkowalczuk/mnemosyne | mnemosyned/daemon.go | NewDaemon | func NewDaemon(opts *DaemonOpts) (*Daemon, error) {
d := &Daemon{
done: make(chan struct{}),
opts: opts,
logger: opts.Logger,
serverOptions: opts.RPCOptions,
rpcListener: opts.RPCListener,
debugListener: opts.DebugListener,
}
if err := d.setPostgresConnectionParameters(); err ... | go | func NewDaemon(opts *DaemonOpts) (*Daemon, error) {
d := &Daemon{
done: make(chan struct{}),
opts: opts,
logger: opts.Logger,
serverOptions: opts.RPCOptions,
rpcListener: opts.RPCListener,
debugListener: opts.DebugListener,
}
if err := d.setPostgresConnectionParameters(); err ... | [
"func",
"NewDaemon",
"(",
"opts",
"*",
"DaemonOpts",
")",
"(",
"*",
"Daemon",
",",
"error",
")",
"{",
"d",
":=",
"&",
"Daemon",
"{",
"done",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"opts",
":",
"opts",
",",
"logger",
":",
"opts",
... | // NewDaemon allocates new daemon instance using given options. | [
"NewDaemon",
"allocates",
"new",
"daemon",
"instance",
"using",
"given",
"options",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/mnemosyned/daemon.go#L83-L113 | test |
piotrkowalczuk/mnemosyne | mnemosyned/daemon.go | Close | func (d *Daemon) Close() (err error) {
d.done <- struct{}{}
d.server.GracefulStop()
if d.postgres != nil {
if err = d.postgres.Close(); err != nil {
return
}
}
if d.debugListener != nil {
if err = d.debugListener.Close(); err != nil {
return
}
}
if d.tracerCloser != nil {
if err = d.tracerCloser.... | go | func (d *Daemon) Close() (err error) {
d.done <- struct{}{}
d.server.GracefulStop()
if d.postgres != nil {
if err = d.postgres.Close(); err != nil {
return
}
}
if d.debugListener != nil {
if err = d.debugListener.Close(); err != nil {
return
}
}
if d.tracerCloser != nil {
if err = d.tracerCloser.... | [
"func",
"(",
"d",
"*",
"Daemon",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"d",
".",
"done",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"d",
".",
"server",
".",
"GracefulStop",
"(",
")",
"\n",
"if",
"d",
".",
"postgres",
"!=",
"ni... | // Close implements io.Closer interface. | [
"Close",
"implements",
"io",
".",
"Closer",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/mnemosyned/daemon.go#L293-L312 | test |
piotrkowalczuk/mnemosyne | token.go | NewAccessTokenContext | func NewAccessTokenContext(ctx context.Context, at string) context.Context {
return context.WithValue(ctx, accessTokenContextKey, at)
} | go | func NewAccessTokenContext(ctx context.Context, at string) context.Context {
return context.WithValue(ctx, accessTokenContextKey, at)
} | [
"func",
"NewAccessTokenContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"at",
"string",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"accessTokenContextKey",
",",
"at",
")",
"\n",
"}"
] | // NewAccessTokenContext returns a new Context that carries token value. | [
"NewAccessTokenContext",
"returns",
"a",
"new",
"Context",
"that",
"carries",
"token",
"value",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/token.go#L22-L24 | test |
piotrkowalczuk/mnemosyne | token.go | AccessTokenFromContext | func AccessTokenFromContext(ctx context.Context) (string, bool) {
at, ok := ctx.Value(accessTokenContextKey).(string)
return at, ok
} | go | func AccessTokenFromContext(ctx context.Context) (string, bool) {
at, ok := ctx.Value(accessTokenContextKey).(string)
return at, ok
} | [
"func",
"AccessTokenFromContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"string",
",",
"bool",
")",
"{",
"at",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"accessTokenContextKey",
")",
".",
"(",
"string",
")",
"\n",
"return",
"at",
",",
"ok",... | // AccessTokenFromContext returns the token value stored in context, if any. | [
"AccessTokenFromContext",
"returns",
"the",
"token",
"value",
"stored",
"in",
"context",
"if",
"any",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/token.go#L27-L31 | test |
piotrkowalczuk/mnemosyne | token.go | RandomAccessToken | func RandomAccessToken() (string, error) {
buf, err := generateRandomBytes(128)
if err != nil {
return "", err
}
// A hash needs to be 64 bytes long to have 256-bit collision resistance.
hash := make([]byte, 64)
// Compute a 64-byte hash of buf and put it in h.
sha3.ShakeSum256(hash, buf)
hash2 := make([]byt... | go | func RandomAccessToken() (string, error) {
buf, err := generateRandomBytes(128)
if err != nil {
return "", err
}
// A hash needs to be 64 bytes long to have 256-bit collision resistance.
hash := make([]byte, 64)
// Compute a 64-byte hash of buf and put it in h.
sha3.ShakeSum256(hash, buf)
hash2 := make([]byt... | [
"func",
"RandomAccessToken",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"buf",
",",
"err",
":=",
"generateRandomBytes",
"(",
"128",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"\"",
",",
"err",
"\n",
"}",
"\n",
"hash",
":=",
"make",
... | // RandomAccessToken generate Access Token with given key and generated hash of length 64. | [
"RandomAccessToken",
"generate",
"Access",
"Token",
"with",
"given",
"key",
"and",
"generated",
"hash",
"of",
"length",
"64",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/token.go#L34-L47 | test |
piotrkowalczuk/mnemosyne | internal/service/logger/logger.go | Init | func Init(opts Opts) (logger *zap.Logger, err error) {
var (
cfg zap.Config
options []zap.Option
lvl zapcore.Level
)
switch opts.Environment {
case "production":
cfg = zap.NewProductionConfig()
case "stackdriver":
cfg = NewStackdriverConfig()
options = append(options, zap.Fields(zap.Object("ser... | go | func Init(opts Opts) (logger *zap.Logger, err error) {
var (
cfg zap.Config
options []zap.Option
lvl zapcore.Level
)
switch opts.Environment {
case "production":
cfg = zap.NewProductionConfig()
case "stackdriver":
cfg = NewStackdriverConfig()
options = append(options, zap.Fields(zap.Object("ser... | [
"func",
"Init",
"(",
"opts",
"Opts",
")",
"(",
"logger",
"*",
"zap",
".",
"Logger",
",",
"err",
"error",
")",
"{",
"var",
"(",
"cfg",
"zap",
".",
"Config",
"\n",
"options",
"[",
"]",
"zap",
".",
"Option",
"\n",
"lvl",
"zapcore",
".",
"Level",
"\n... | // Init allocates new logger based on given options. | [
"Init",
"allocates",
"new",
"logger",
"based",
"on",
"given",
"options",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/service/logger/logger.go#L34-L67 | test |
ikawaha/kagome.ipadic | internal/dic/dic.go | Load | func Load(path string) (d *Dic, err error) {
d = new(Dic)
r, err := zip.OpenReader(path)
if err != nil {
return d, err
}
defer r.Close()
for _, f := range r.File {
if err = func() error {
rc, e := f.Open()
if e != nil {
return e
}
defer rc.Close()
switch f.Name {
case "morph.dic":
i... | go | func Load(path string) (d *Dic, err error) {
d = new(Dic)
r, err := zip.OpenReader(path)
if err != nil {
return d, err
}
defer r.Close()
for _, f := range r.File {
if err = func() error {
rc, e := f.Open()
if e != nil {
return e
}
defer rc.Close()
switch f.Name {
case "morph.dic":
i... | [
"func",
"Load",
"(",
"path",
"string",
")",
"(",
"d",
"*",
"Dic",
",",
"err",
"error",
")",
"{",
"d",
"=",
"new",
"(",
"Dic",
")",
"\n",
"r",
",",
"err",
":=",
"zip",
".",
"OpenReader",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // Load loads a dictionary from a file. | [
"Load",
"loads",
"a",
"dictionary",
"from",
"a",
"file",
"."
] | fe03f87a0c7c32945d956fcfc934c3e11d5eb182 | https://github.com/ikawaha/kagome.ipadic/blob/fe03f87a0c7c32945d956fcfc934c3e11d5eb182/internal/dic/dic.go#L130-L181 | test |
piotrkowalczuk/mnemosyne | internal/storage/postgres/storage.go | Start | func (s *Storage) Start(ctx context.Context, accessToken, refreshToken, sid, sc string, b map[string]string) (*mnemosynerpc.Session, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.start")
defer span.Finish()
ent := &sessionEntity{
AccessToken: accessToken,
RefreshToken: refresh... | go | func (s *Storage) Start(ctx context.Context, accessToken, refreshToken, sid, sc string, b map[string]string) (*mnemosynerpc.Session, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.start")
defer span.Finish()
ent := &sessionEntity{
AccessToken: accessToken,
RefreshToken: refresh... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Start",
"(",
"ctx",
"context",
".",
"Context",
",",
"accessToken",
",",
"refreshToken",
",",
"sid",
",",
"sc",
"string",
",",
"b",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"*",
"mnemosynerpc",
".",
"Sessi... | // Start implements storage interface. | [
"Start",
"implements",
"storage",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/storage/postgres/storage.go#L98-L115 | test |
piotrkowalczuk/mnemosyne | internal/storage/postgres/storage.go | Get | func (s *Storage) Get(ctx context.Context, accessToken string) (*mnemosynerpc.Session, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.get")
defer span.Finish()
var entity sessionEntity
start := time.Now()
labels := prometheus.Labels{"query": "get"}
err := s.db.QueryRowContext(ctx,... | go | func (s *Storage) Get(ctx context.Context, accessToken string) (*mnemosynerpc.Session, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.get")
defer span.Finish()
var entity sessionEntity
start := time.Now()
labels := prometheus.Labels{"query": "get"}
err := s.db.QueryRowContext(ctx,... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"accessToken",
"string",
")",
"(",
"*",
"mnemosynerpc",
".",
"Session",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"opentracing",
".",
"StartSpanFromContext"... | // Get implements storage interface. | [
"Get",
"implements",
"storage",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/storage/postgres/storage.go#L139-L175 | test |
piotrkowalczuk/mnemosyne | internal/storage/postgres/storage.go | List | func (s *Storage) List(ctx context.Context, offset, limit int64, expiredAtFrom, expiredAtTo *time.Time) ([]*mnemosynerpc.Session, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.list")
defer span.Finish()
if limit == 0 {
return nil, errors.New("cannot retrieve list of sessions, limit... | go | func (s *Storage) List(ctx context.Context, offset, limit int64, expiredAtFrom, expiredAtTo *time.Time) ([]*mnemosynerpc.Session, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.list")
defer span.Finish()
if limit == 0 {
return nil, errors.New("cannot retrieve list of sessions, limit... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"List",
"(",
"ctx",
"context",
".",
"Context",
",",
"offset",
",",
"limit",
"int64",
",",
"expiredAtFrom",
",",
"expiredAtTo",
"*",
"time",
".",
"Time",
")",
"(",
"[",
"]",
"*",
"mnemosynerpc",
".",
"Session",
"... | // List implements storage interface. | [
"List",
"implements",
"storage",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/storage/postgres/storage.go#L178-L251 | test |
piotrkowalczuk/mnemosyne | internal/storage/postgres/storage.go | Exists | func (s *Storage) Exists(ctx context.Context, accessToken string) (exists bool, err error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.exists")
defer span.Finish()
start := time.Now()
labels := prometheus.Labels{"query": "exists"}
err = s.db.QueryRowContext(ctx, s.queryExists, accessTo... | go | func (s *Storage) Exists(ctx context.Context, accessToken string) (exists bool, err error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.exists")
defer span.Finish()
start := time.Now()
labels := prometheus.Labels{"query": "exists"}
err = s.db.QueryRowContext(ctx, s.queryExists, accessTo... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Exists",
"(",
"ctx",
"context",
".",
"Context",
",",
"accessToken",
"string",
")",
"(",
"exists",
"bool",
",",
"err",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"opentracing",
".",
"StartSpanFromContext",
"(",
... | // Exists implements storage interface. | [
"Exists",
"implements",
"storage",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/storage/postgres/storage.go#L254-L270 | test |
piotrkowalczuk/mnemosyne | internal/storage/postgres/storage.go | Abandon | func (s *Storage) Abandon(ctx context.Context, accessToken string) (bool, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.abandon")
defer span.Finish()
start := time.Now()
labels := prometheus.Labels{"query": "abandon"}
result, err := s.db.ExecContext(ctx, s.queryAbandon, accessToke... | go | func (s *Storage) Abandon(ctx context.Context, accessToken string) (bool, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.abandon")
defer span.Finish()
start := time.Now()
labels := prometheus.Labels{"query": "abandon"}
result, err := s.db.ExecContext(ctx, s.queryAbandon, accessToke... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Abandon",
"(",
"ctx",
"context",
".",
"Context",
",",
"accessToken",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"opentracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"p... | // Abandon implements storage interface. | [
"Abandon",
"implements",
"storage",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/storage/postgres/storage.go#L273-L296 | test |
piotrkowalczuk/mnemosyne | internal/storage/postgres/storage.go | SetValue | func (s *Storage) SetValue(ctx context.Context, accessToken string, key, value string) (map[string]string, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.set-value")
defer span.Finish()
var err error
if accessToken == "" {
return nil, storage.ErrMissingAccessToken
}
entity := &s... | go | func (s *Storage) SetValue(ctx context.Context, accessToken string, key, value string) (map[string]string, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.set-value")
defer span.Finish()
var err error
if accessToken == "" {
return nil, storage.ErrMissingAccessToken
}
entity := &s... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"SetValue",
"(",
"ctx",
"context",
".",
"Context",
",",
"accessToken",
"string",
",",
"key",
",",
"value",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"span",
",",
"ctx",
"... | // SetValue implements storage interface. | [
"SetValue",
"implements",
"storage",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/storage/postgres/storage.go#L299-L358 | test |
piotrkowalczuk/mnemosyne | internal/storage/postgres/storage.go | Delete | func (s *Storage) Delete(ctx context.Context, subjectID, accessToken, refreshToken string, expiredAtFrom, expiredAtTo *time.Time) (int64, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.delete")
defer span.Finish()
where, args := s.where(subjectID, accessToken, refreshToken, expiredAtF... | go | func (s *Storage) Delete(ctx context.Context, subjectID, accessToken, refreshToken string, expiredAtFrom, expiredAtTo *time.Time) (int64, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.delete")
defer span.Finish()
where, args := s.where(subjectID, accessToken, refreshToken, expiredAtF... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"subjectID",
",",
"accessToken",
",",
"refreshToken",
"string",
",",
"expiredAtFrom",
",",
"expiredAtTo",
"*",
"time",
".",
"Time",
")",
"(",
"int64",
",",
"erro... | // Delete implements storage interface. | [
"Delete",
"implements",
"storage",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/storage/postgres/storage.go#L361-L381 | test |
piotrkowalczuk/mnemosyne | internal/storage/postgres/storage.go | Setup | func (s *Storage) Setup() error {
query := fmt.Sprintf(`
CREATE SCHEMA IF NOT EXISTS %s;
CREATE TABLE IF NOT EXISTS %s.%s (
access_token BYTEA PRIMARY KEY,
refresh_token BYTEA,
subject_id TEXT NOT NULL,
subject_client TEXT,
bag bytea NOT NULL,
expire_at TIMESTAMPTZ NOT NULL DEFAULT (NOW() + '%d s... | go | func (s *Storage) Setup() error {
query := fmt.Sprintf(`
CREATE SCHEMA IF NOT EXISTS %s;
CREATE TABLE IF NOT EXISTS %s.%s (
access_token BYTEA PRIMARY KEY,
refresh_token BYTEA,
subject_id TEXT NOT NULL,
subject_client TEXT,
bag bytea NOT NULL,
expire_at TIMESTAMPTZ NOT NULL DEFAULT (NOW() + '%d s... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Setup",
"(",
")",
"error",
"{",
"query",
":=",
"fmt",
".",
"Sprintf",
"(",
"`\t\tCREATE SCHEMA IF NOT EXISTS %s;\t\tCREATE TABLE IF NOT EXISTS %s.%s (\t\t\taccess_token BYTEA PRIMARY KEY,\t\t\trefresh_token BYTEA,\t\t\tsubject_id TEXT NOT NUL... | // Setup implements storage interface. | [
"Setup",
"implements",
"storage",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/storage/postgres/storage.go#L384-L407 | test |
piotrkowalczuk/mnemosyne | internal/storage/postgres/storage.go | TearDown | func (s *Storage) TearDown() error {
_, err := s.db.Exec(`DROP SCHEMA IF EXISTS ` + s.schema + ` CASCADE`)
return err
} | go | func (s *Storage) TearDown() error {
_, err := s.db.Exec(`DROP SCHEMA IF EXISTS ` + s.schema + ` CASCADE`)
return err
} | [
"func",
"(",
"s",
"*",
"Storage",
")",
"TearDown",
"(",
")",
"error",
"{",
"_",
",",
"err",
":=",
"s",
".",
"db",
".",
"Exec",
"(",
"`DROP SCHEMA IF EXISTS `",
"+",
"s",
".",
"schema",
"+",
"` CASCADE`",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // TearDown implements storage interface. | [
"TearDown",
"implements",
"storage",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/storage/postgres/storage.go#L410-L414 | test |
piotrkowalczuk/mnemosyne | mnemosyned/service.go | initJaeger | func initJaeger(service, node, agentAddress string, log *zap.Logger) (opentracing.Tracer, io.Closer, error) {
cfg := &config.Configuration{
Sampler: &config.SamplerConfig{
Type: "const",
Param: 1,
},
Tags: []opentracing.Tag{{
Key: constant.Subsystem + ".listen",
Value: node,
}},
Reporter: &con... | go | func initJaeger(service, node, agentAddress string, log *zap.Logger) (opentracing.Tracer, io.Closer, error) {
cfg := &config.Configuration{
Sampler: &config.SamplerConfig{
Type: "const",
Param: 1,
},
Tags: []opentracing.Tag{{
Key: constant.Subsystem + ".listen",
Value: node,
}},
Reporter: &con... | [
"func",
"initJaeger",
"(",
"service",
",",
"node",
",",
"agentAddress",
"string",
",",
"log",
"*",
"zap",
".",
"Logger",
")",
"(",
"opentracing",
".",
"Tracer",
",",
"io",
".",
"Closer",
",",
"error",
")",
"{",
"cfg",
":=",
"&",
"config",
".",
"Confi... | // initJaeger returns an instance of Jaeger Tracer that samples 100% of traces and logs all spans to stdout. | [
"initJaeger",
"returns",
"an",
"instance",
"of",
"Jaeger",
"Tracer",
"that",
"samples",
"100%",
"of",
"traces",
"and",
"logs",
"all",
"spans",
"to",
"stdout",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/mnemosyned/service.go#L33-L54 | test |
ikawaha/kagome.ipadic | cmd/kagome/main.go | Usage | func Usage() {
fmt.Fprintf(errorWriter, "Japanese Morphological Analyzer -- github.com/ikawaha/kagome.ipadic\n")
fmt.Fprintf(errorWriter, "usage: %s <command>\n", path.Base(os.Args[0]))
} | go | func Usage() {
fmt.Fprintf(errorWriter, "Japanese Morphological Analyzer -- github.com/ikawaha/kagome.ipadic\n")
fmt.Fprintf(errorWriter, "usage: %s <command>\n", path.Base(os.Args[0]))
} | [
"func",
"Usage",
"(",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"errorWriter",
",",
"\"Japanese Morphological Analyzer -- github.com/ikawaha/kagome.ipadic\\n\"",
")",
"\n",
"\\n",
"\n",
"}"
] | //Usage prints to stdout information about the tool | [
"Usage",
"prints",
"to",
"stdout",
"information",
"about",
"the",
"tool"
] | fe03f87a0c7c32945d956fcfc934c3e11d5eb182 | https://github.com/ikawaha/kagome.ipadic/blob/fe03f87a0c7c32945d956fcfc934c3e11d5eb182/cmd/kagome/main.go#L60-L63 | test |
ikawaha/kagome.ipadic | internal/da/da.go | Build | func Build(keywords []string) (DoubleArray, error) {
s := len(keywords)
if s == 0 {
return DoubleArray{}, nil
}
ids := make([]int, s, s)
for i := range ids {
ids[i] = i + 1
}
return BuildWithIDs(keywords, ids)
} | go | func Build(keywords []string) (DoubleArray, error) {
s := len(keywords)
if s == 0 {
return DoubleArray{}, nil
}
ids := make([]int, s, s)
for i := range ids {
ids[i] = i + 1
}
return BuildWithIDs(keywords, ids)
} | [
"func",
"Build",
"(",
"keywords",
"[",
"]",
"string",
")",
"(",
"DoubleArray",
",",
"error",
")",
"{",
"s",
":=",
"len",
"(",
"keywords",
")",
"\n",
"if",
"s",
"==",
"0",
"{",
"return",
"DoubleArray",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n",
"ids",... | // Build constructs a double array from given keywords. | [
"Build",
"constructs",
"a",
"double",
"array",
"from",
"given",
"keywords",
"."
] | fe03f87a0c7c32945d956fcfc934c3e11d5eb182 | https://github.com/ikawaha/kagome.ipadic/blob/fe03f87a0c7c32945d956fcfc934c3e11d5eb182/internal/da/da.go#L37-L47 | test |
ikawaha/kagome.ipadic | internal/da/da.go | Read | func Read(r io.Reader) (DoubleArray, error) {
var sz int64
if e := binary.Read(r, binary.LittleEndian, &sz); e != nil {
return DoubleArray{}, e
}
//fmt.Println("read data len:", sz)
d := make(DoubleArray, sz, sz)
for i := range d {
if e := binary.Read(r, binary.LittleEndian, &d[i].Base); e != nil {
return ... | go | func Read(r io.Reader) (DoubleArray, error) {
var sz int64
if e := binary.Read(r, binary.LittleEndian, &sz); e != nil {
return DoubleArray{}, e
}
//fmt.Println("read data len:", sz)
d := make(DoubleArray, sz, sz)
for i := range d {
if e := binary.Read(r, binary.LittleEndian, &d[i].Base); e != nil {
return ... | [
"func",
"Read",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"DoubleArray",
",",
"error",
")",
"{",
"var",
"sz",
"int64",
"\n",
"if",
"e",
":=",
"binary",
".",
"Read",
"(",
"r",
",",
"binary",
".",
"LittleEndian",
",",
"&",
"sz",
")",
";",
"e",
"!=... | // Read loads a double array. | [
"Read",
"loads",
"a",
"double",
"array",
"."
] | fe03f87a0c7c32945d956fcfc934c3e11d5eb182 | https://github.com/ikawaha/kagome.ipadic/blob/fe03f87a0c7c32945d956fcfc934c3e11d5eb182/internal/da/da.go#L182-L198 | test |
piotrkowalczuk/mnemosyne | internal/cluster/cluster.go | Get | func (c *Cluster) Get(k int32) (*Node, bool) {
if len(c.nodes) == 0 {
return nil, false
}
if len(c.nodes)-1 < int(k) {
return nil, false
}
return c.nodes[k], true
} | go | func (c *Cluster) Get(k int32) (*Node, bool) {
if len(c.nodes) == 0 {
return nil, false
}
if len(c.nodes)-1 < int(k) {
return nil, false
}
return c.nodes[k], true
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"Get",
"(",
"k",
"int32",
")",
"(",
"*",
"Node",
",",
"bool",
")",
"{",
"if",
"len",
"(",
"c",
".",
"nodes",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"if",
"len",
"(",
"c",
... | // Get if possible returns node for a given bucket id. | [
"Get",
"if",
"possible",
"returns",
"node",
"for",
"a",
"given",
"bucket",
"id",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/cluster/cluster.go#L108-L116 | test |
piotrkowalczuk/mnemosyne | internal/cluster/cluster.go | ExternalNodes | func (c *Cluster) ExternalNodes() (res []*Node) {
for _, n := range c.nodes {
if n.Addr != c.listen {
res = append(res, n)
}
}
return
} | go | func (c *Cluster) ExternalNodes() (res []*Node) {
for _, n := range c.nodes {
if n.Addr != c.listen {
res = append(res, n)
}
}
return
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ExternalNodes",
"(",
")",
"(",
"res",
"[",
"]",
"*",
"Node",
")",
"{",
"for",
"_",
",",
"n",
":=",
"range",
"c",
".",
"nodes",
"{",
"if",
"n",
".",
"Addr",
"!=",
"c",
".",
"listen",
"{",
"res",
"=",
"... | // ExternalNodes returns all available nodes except host. | [
"ExternalNodes",
"returns",
"all",
"available",
"nodes",
"except",
"host",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/cluster/cluster.go#L124-L131 | test |
piotrkowalczuk/mnemosyne | internal/cluster/cluster.go | GetOther | func (c *Cluster) GetOther(accessToken string) (*Node, bool) {
if c == nil {
return nil, false
}
if c.Len() == 1 {
return nil, false
}
if node, ok := c.Get(jump.HashString(accessToken, c.Len())); ok {
if node.Addr != c.listen {
if node.Client != nil {
return node, true
}
}
}
return nil, false
... | go | func (c *Cluster) GetOther(accessToken string) (*Node, bool) {
if c == nil {
return nil, false
}
if c.Len() == 1 {
return nil, false
}
if node, ok := c.Get(jump.HashString(accessToken, c.Len())); ok {
if node.Addr != c.listen {
if node.Client != nil {
return node, true
}
}
}
return nil, false
... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"GetOther",
"(",
"accessToken",
"string",
")",
"(",
"*",
"Node",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"if",
"c",
".",
"Len",
"(",
")",
"==",
... | // GetOther returns node for given access token.
// Returns false if cluster is nil, has only one element or if node that was found has same listen address as current one. | [
"GetOther",
"returns",
"node",
"for",
"given",
"access",
"token",
".",
"Returns",
"false",
"if",
"cluster",
"is",
"nil",
"has",
"only",
"one",
"element",
"or",
"if",
"node",
"that",
"was",
"found",
"has",
"same",
"listen",
"address",
"as",
"current",
"one"... | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/cluster/cluster.go#L145-L161 | test |
piotrkowalczuk/mnemosyne | internal/cluster/cluster.go | GoString | func (c *Cluster) GoString() string {
buf, _ := json.Marshal(map[string]interface{}{
"listen": c.listen,
"nodes": c.nodes,
"buckets": strconv.FormatInt(int64(c.buckets), 10),
})
return string(buf)
} | go | func (c *Cluster) GoString() string {
buf, _ := json.Marshal(map[string]interface{}{
"listen": c.listen,
"nodes": c.nodes,
"buckets": strconv.FormatInt(int64(c.buckets), 10),
})
return string(buf)
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"GoString",
"(",
")",
"string",
"{",
"buf",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"listen\"",
":",
"c",
".",
"listen",
",",
"\"nodes\"",
":",
"... | // GoString implements fmt GoStringer interface. | [
"GoString",
"implements",
"fmt",
"GoStringer",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/cluster/cluster.go#L164-L171 | test |
piotrkowalczuk/mnemosyne | internal/model/backpack.go | Scan | func (b *Bag) Scan(src interface{}) (err error) {
switch t := src.(type) {
case []byte:
err = gob.NewDecoder(bytes.NewReader(t)).Decode(b)
default:
return errors.New("unsupported data source type")
}
return
} | go | func (b *Bag) Scan(src interface{}) (err error) {
switch t := src.(type) {
case []byte:
err = gob.NewDecoder(bytes.NewReader(t)).Decode(b)
default:
return errors.New("unsupported data source type")
}
return
} | [
"func",
"(",
"b",
"*",
"Bag",
")",
"Scan",
"(",
"src",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"switch",
"t",
":=",
"src",
".",
"(",
"type",
")",
"{",
"case",
"[",
"]",
"byte",
":",
"err",
"=",
"gob",
".",
"NewDecoder",
"("... | // Scan satisfy sql.Scanner interface. | [
"Scan",
"satisfy",
"sql",
".",
"Scanner",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/model/backpack.go#L15-L24 | test |
piotrkowalczuk/mnemosyne | internal/model/backpack.go | Value | func (b Bag) Value() (driver.Value, error) {
buf := bytes.NewBuffer(nil)
err := gob.NewEncoder(buf).Encode(b)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
} | go | func (b Bag) Value() (driver.Value, error) {
buf := bytes.NewBuffer(nil)
err := gob.NewEncoder(buf).Encode(b)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
} | [
"func",
"(",
"b",
"Bag",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"buf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"nil",
")",
"\n",
"err",
":=",
"gob",
".",
"NewEncoder",
"(",
"buf",
")",
".",
"Encode",
"(",
"b"... | // Value satisfy driver.Valuer interface. | [
"Value",
"satisfy",
"driver",
".",
"Valuer",
"interface",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/model/backpack.go#L27-L35 | test |
piotrkowalczuk/mnemosyne | internal/model/backpack.go | Has | func (b *Bag) Has(key string) bool {
_, ok := (*b)[key]
return ok
} | go | func (b *Bag) Has(key string) bool {
_, ok := (*b)[key]
return ok
} | [
"func",
"(",
"b",
"*",
"Bag",
")",
"Has",
"(",
"key",
"string",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"(",
"*",
"b",
")",
"[",
"key",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] | // Has checks if the given key is set. | [
"Has",
"checks",
"if",
"the",
"given",
"key",
"is",
"set",
"."
] | 66d59c3c5b886e8e869915bb76257bcba4a47250 | https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/model/backpack.go#L48-L52 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.