id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
132,400 | sethvargo/go-fastly | fastly/s3.go | UpdateS3 | func (c *Client) UpdateS3(i *UpdateS3Input) (*S3, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/logging/s3/%s", i.Service, i.Version, i.Name)
re... | go | func (c *Client) UpdateS3(i *UpdateS3Input) (*S3, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/logging/s3/%s", i.Service, i.Version, i.Name)
re... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateS3",
"(",
"i",
"*",
"UpdateS3Input",
")",
"(",
"*",
"S3",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
"... | // UpdateS3 updates a specific S3. | [
"UpdateS3",
"updates",
"a",
"specific",
"S3",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/s3.go#L197-L221 |
132,401 | sethvargo/go-fastly | fastly/sumologic.go | ListSumologics | func (c *Client) ListSumologics(i *ListSumologicsInput) ([]*Sumologic, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err... | go | func (c *Client) ListSumologics(i *ListSumologicsInput) ([]*Sumologic, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListSumologics",
"(",
"i",
"*",
"ListSumologicsInput",
")",
"(",
"[",
"]",
"*",
"Sumologic",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"... | // ListSumologics returns the list of sumologics for the configuration version. | [
"ListSumologics",
"returns",
"the",
"list",
"of",
"sumologics",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/sumologic.go#L47-L68 |
132,402 | sethvargo/go-fastly | fastly/sumologic.go | CreateSumologic | func (c *Client) CreateSumologic(i *CreateSumologicInput) (*Sumologic, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)... | go | func (c *Client) CreateSumologic(i *CreateSumologicInput) (*Sumologic, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateSumologic",
"(",
"i",
"*",
"CreateSumologicInput",
")",
"(",
"*",
"Sumologic",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
... | // CreateSumologic creates a new Fastly sumologic. | [
"CreateSumologic",
"creates",
"a",
"new",
"Fastly",
"sumologic",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/sumologic.go#L88-L108 |
132,403 | sethvargo/go-fastly | fastly/sumologic.go | GetSumologic | func (c *Client) GetSumologic(i *GetSumologicInput) (*Sumologic, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic/%s", i.Service, ... | go | func (c *Client) GetSumologic(i *GetSumologicInput) (*Sumologic, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic/%s", i.Service, ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetSumologic",
"(",
"i",
"*",
"GetSumologicInput",
")",
"(",
"*",
"Sumologic",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\... | // GetSumologic gets the sumologic configuration with the given parameters. | [
"GetSumologic",
"gets",
"the",
"sumologic",
"configuration",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/sumologic.go#L122-L146 |
132,404 | sethvargo/go-fastly | fastly/sumologic.go | UpdateSumologic | func (c *Client) UpdateSumologic(i *UpdateSumologicInput) (*Sumologic, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic/%s", i.Ser... | go | func (c *Client) UpdateSumologic(i *UpdateSumologicInput) (*Sumologic, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic/%s", i.Ser... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateSumologic",
"(",
"i",
"*",
"UpdateSumologicInput",
")",
"(",
"*",
"Sumologic",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
... | // UpdateSumologic updates a specific sumologic. | [
"UpdateSumologic",
"updates",
"a",
"specific",
"sumologic",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/sumologic.go#L169-L193 |
132,405 | sethvargo/go-fastly | fastly/backend.go | ListBackends | func (c *Client) ListBackends(i *ListBackendsInput) ([]*Backend, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/backend", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
retu... | go | func (c *Client) ListBackends(i *ListBackendsInput) ([]*Backend, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/backend", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
retu... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListBackends",
"(",
"i",
"*",
"ListBackendsInput",
")",
"(",
"[",
"]",
"*",
"Backend",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
... | // ListBackends returns the list of backends for the configuration version. | [
"ListBackends",
"returns",
"the",
"list",
"of",
"backends",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/backend.go#L61-L82 |
132,406 | sethvargo/go-fastly | fastly/backend.go | CreateBackend | func (c *Client) CreateBackend(i *CreateBackendInput) (*Backend, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/backend", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if err != nil ... | go | func (c *Client) CreateBackend(i *CreateBackendInput) (*Backend, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/backend", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if err != nil ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateBackend",
"(",
"i",
"*",
"CreateBackendInput",
")",
"(",
"*",
"Backend",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\... | // CreateBackend creates a new Fastly backend. | [
"CreateBackend",
"creates",
"a",
"new",
"Fastly",
"backend",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/backend.go#L119-L139 |
132,407 | sethvargo/go-fastly | fastly/backend.go | GetBackend | func (c *Client) GetBackend(i *GetBackendInput) (*Backend, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/backend/%s", i.Service, i.Version, i.Nam... | go | func (c *Client) GetBackend(i *GetBackendInput) (*Backend, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/backend/%s", i.Service, i.Version, i.Nam... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetBackend",
"(",
"i",
"*",
"GetBackendInput",
")",
"(",
"*",
"Backend",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
... | // GetBackend gets the backend configuration with the given parameters. | [
"GetBackend",
"gets",
"the",
"backend",
"configuration",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/backend.go#L153-L177 |
132,408 | sethvargo/go-fastly | fastly/backend.go | UpdateBackend | func (c *Client) UpdateBackend(i *UpdateBackendInput) (*Backend, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/backend/%s", i.Service, i.Version,... | go | func (c *Client) UpdateBackend(i *UpdateBackendInput) (*Backend, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/backend/%s", i.Service, i.Version,... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateBackend",
"(",
"i",
"*",
"UpdateBackendInput",
")",
"(",
"*",
"Backend",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\... | // UpdateBackend updates a specific backend. | [
"UpdateBackend",
"updates",
"a",
"specific",
"backend",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/backend.go#L217-L241 |
132,409 | sethvargo/go-fastly | fastly/acl.go | ListACLs | func (c *Client) ListACLs(i *ListACLsInput) ([]*ACL, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/acl", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
... | go | func (c *Client) ListACLs(i *ListACLsInput) ([]*ACL, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/acl", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListACLs",
"(",
"i",
"*",
"ListACLsInput",
")",
"(",
"[",
"]",
"*",
"ACL",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\... | // ListACLs returns the list of ACLs for the configuration version. | [
"ListACLs",
"returns",
"the",
"list",
"of",
"ACLs",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/acl.go#L40-L61 |
132,410 | sethvargo/go-fastly | fastly/acl.go | GetACL | func (c *Client) GetACL(i *GetACLInput) (*ACL, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/acl/%s", i.Service, i.Version, i.Name)
resp, err :=... | go | func (c *Client) GetACL(i *GetACLInput) (*ACL, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/acl/%s", i.Service, i.Version, i.Name)
resp, err :=... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetACL",
"(",
"i",
"*",
"GetACLInput",
")",
"(",
"*",
"ACL",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
"i",... | // GetACL gets the ACL configuration with the given parameters. | [
"GetACL",
"gets",
"the",
"ACL",
"configuration",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/acl.go#L149-L173 |
132,411 | sethvargo/go-fastly | fastly/acl.go | UpdateACL | func (c *Client) UpdateACL(i *UpdateACLInput) (*ACL, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
if i.NewName == "" {
return nil, ErrMissingNewName
}
path := fmt.Sprintf("/service/%s... | go | func (c *Client) UpdateACL(i *UpdateACLInput) (*ACL, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
if i.NewName == "" {
return nil, ErrMissingNewName
}
path := fmt.Sprintf("/service/%s... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateACL",
"(",
"i",
"*",
"UpdateACLInput",
")",
"(",
"*",
"ACL",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
... | // UpdateACL updates the name of the ACL with the given parameters. | [
"UpdateACL",
"updates",
"the",
"name",
"of",
"the",
"ACL",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/acl.go#L190-L220 |
132,412 | sethvargo/go-fastly | fastly/gzip.go | ListGzips | func (c *Client) ListGzips(i *ListGzipsInput) ([]*Gzip, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/gzip", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
... | go | func (c *Client) ListGzips(i *ListGzipsInput) ([]*Gzip, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/gzip", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListGzips",
"(",
"i",
"*",
"ListGzipsInput",
")",
"(",
"[",
"]",
"*",
"Gzip",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"... | // ListGzips returns the list of gzips for the configuration version. | [
"ListGzips",
"returns",
"the",
"list",
"of",
"gzips",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/gzip.go#L39-L60 |
132,413 | sethvargo/go-fastly | fastly/gzip.go | CreateGzip | func (c *Client) CreateGzip(i *CreateGzipInput) (*Gzip, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/gzip", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if err != nil {
return n... | go | func (c *Client) CreateGzip(i *CreateGzipInput) (*Gzip, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/gzip", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if err != nil {
return n... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateGzip",
"(",
"i",
"*",
"CreateGzipInput",
")",
"(",
"*",
"Gzip",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if... | // CreateGzip creates a new Fastly Gzip. | [
"CreateGzip",
"creates",
"a",
"new",
"Fastly",
"Gzip",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/gzip.go#L76-L96 |
132,414 | sethvargo/go-fastly | fastly/gzip.go | GetGzip | func (c *Client) GetGzip(i *GetGzipInput) (*Gzip, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/gzip/%s", i.Service, i.Version, i.Name)
resp, er... | go | func (c *Client) GetGzip(i *GetGzipInput) (*Gzip, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/gzip/%s", i.Service, i.Version, i.Name)
resp, er... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetGzip",
"(",
"i",
"*",
"GetGzipInput",
")",
"(",
"*",
"Gzip",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
"... | // GetGzip gets the Gzip configuration with the given parameters. | [
"GetGzip",
"gets",
"the",
"Gzip",
"configuration",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/gzip.go#L110-L134 |
132,415 | sethvargo/go-fastly | fastly/gzip.go | UpdateGzip | func (c *Client) UpdateGzip(i *UpdateGzipInput) (*Gzip, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/gzip/%s", i.Service, i.Version, i.Name)
re... | go | func (c *Client) UpdateGzip(i *UpdateGzipInput) (*Gzip, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/gzip/%s", i.Service, i.Version, i.Name)
re... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateGzip",
"(",
"i",
"*",
"UpdateGzipInput",
")",
"(",
"*",
"Gzip",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if... | // UpdateGzip updates a specific Gzip. | [
"UpdateGzip",
"updates",
"a",
"specific",
"Gzip",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/gzip.go#L153-L177 |
132,416 | sethvargo/go-fastly | fastly/waf.go | ListWAFs | func (c *Client) ListWAFs(i *ListWAFsInput) ([]*WAF, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/wafs", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
... | go | func (c *Client) ListWAFs(i *ListWAFsInput) ([]*WAF, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/wafs", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListWAFs",
"(",
"i",
"*",
"ListWAFsInput",
")",
"(",
"[",
"]",
"*",
"WAF",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\... | // ListWAFs returns the list of wafs for the configuration version. | [
"ListWAFs",
"returns",
"the",
"list",
"of",
"wafs",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L48-L77 |
132,417 | sethvargo/go-fastly | fastly/waf.go | CreateWAF | func (c *Client) CreateWAF(i *CreateWAFInput) (*WAF, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/wafs", i.Service, i.Version)
resp, err := c.PostJSONAPI(path, i, nil)
if err != nil {
return n... | go | func (c *Client) CreateWAF(i *CreateWAFInput) (*WAF, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/wafs", i.Service, i.Version)
resp, err := c.PostJSONAPI(path, i, nil)
if err != nil {
return n... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateWAF",
"(",
"i",
"*",
"CreateWAFInput",
")",
"(",
"*",
"WAF",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
... | // CreateWAF creates a new Fastly WAF. | [
"CreateWAF",
"creates",
"a",
"new",
"Fastly",
"WAF",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L92-L112 |
132,418 | sethvargo/go-fastly | fastly/waf.go | UpdateWAF | func (c *Client) UpdateWAF(i *UpdateWAFInput) (*WAF, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.ID == "" {
return nil, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/version/%d/wafs/%s", i.Service, i.Version, i.ID)
resp, er... | go | func (c *Client) UpdateWAF(i *UpdateWAFInput) (*WAF, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.ID == "" {
return nil, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/version/%d/wafs/%s", i.Service, i.Version, i.ID)
resp, er... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateWAF",
"(",
"i",
"*",
"UpdateWAFInput",
")",
"(",
"*",
"WAF",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
... | // UpdateWAF updates a specific WAF. | [
"UpdateWAF",
"updates",
"a",
"specific",
"WAF",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L164-L188 |
132,419 | sethvargo/go-fastly | fastly/waf.go | GetOWASP | func (c *Client) GetOWASP(i *GetOWASPInput) (*OWASP, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ID == "" {
return nil, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/wafs/%s/owasp", i.Service, i.ID)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
var owasp ... | go | func (c *Client) GetOWASP(i *GetOWASPInput) (*OWASP, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ID == "" {
return nil, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/wafs/%s/owasp", i.Service, i.ID)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
var owasp ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetOWASP",
"(",
"i",
"*",
"GetOWASPInput",
")",
"(",
"*",
"OWASP",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
... | // GetOWASP gets OWASP settings for a service firewall object. | [
"GetOWASP",
"gets",
"OWASP",
"settings",
"for",
"a",
"service",
"firewall",
"object",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L263-L284 |
132,420 | sethvargo/go-fastly | fastly/waf.go | GetRules | func (c *Client) GetRules() ([]*Rule, error) {
path := fmt.Sprintf("/wafs/rules")
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
data, err := jsonapi.UnmarshalManyPayload(resp.Body, rulesType)
if err != nil {
return nil, err
}
rules := make([]*Rule, len(data))
for i := range data {
typ... | go | func (c *Client) GetRules() ([]*Rule, error) {
path := fmt.Sprintf("/wafs/rules")
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
data, err := jsonapi.UnmarshalManyPayload(resp.Body, rulesType)
if err != nil {
return nil, err
}
rules := make([]*Rule, len(data))
for i := range data {
typ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRules",
"(",
")",
"(",
"[",
"]",
"*",
"Rule",
",",
"error",
")",
"{",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
")",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"path",
",",
"n... | // GetRules returns the list of wafs for the configuration version. | [
"GetRules",
"returns",
"the",
"list",
"of",
"wafs",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L399-L421 |
132,421 | sethvargo/go-fastly | fastly/waf.go | GetRule | func (c *Client) GetRule(i *GetRuleInput) (*Rule, error) {
if i.RuleID == "" {
return nil, ErrMissingRuleID
}
path := fmt.Sprintf("/wafs/rules/%s", i.RuleID)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
var rule Rule
if err := jsonapi.UnmarshalPayload(resp.Body, &rule); err != nil {
r... | go | func (c *Client) GetRule(i *GetRuleInput) (*Rule, error) {
if i.RuleID == "" {
return nil, ErrMissingRuleID
}
path := fmt.Sprintf("/wafs/rules/%s", i.RuleID)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
var rule Rule
if err := jsonapi.UnmarshalPayload(resp.Body, &rule); err != nil {
r... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRule",
"(",
"i",
"*",
"GetRuleInput",
")",
"(",
"*",
"Rule",
",",
"error",
")",
"{",
"if",
"i",
".",
"RuleID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingRuleID",
"\n",
"}",
"\n\n",
"path",
"... | // GetRule gets a Rule using the Rule ID. | [
"GetRule",
"gets",
"a",
"Rule",
"using",
"the",
"Rule",
"ID",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L430-L446 |
132,422 | sethvargo/go-fastly | fastly/waf.go | GetRuleVCL | func (c *Client) GetRuleVCL(i *GetRuleInput) (*RuleVCL, error) {
if i.RuleID == "" {
return nil, ErrMissingRuleID
}
path := fmt.Sprintf("/wafs/rules/%s/vcl", i.RuleID)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
var vcl RuleVCL
if err := jsonapi.UnmarshalPayload(resp.Body, &vcl); err !... | go | func (c *Client) GetRuleVCL(i *GetRuleInput) (*RuleVCL, error) {
if i.RuleID == "" {
return nil, ErrMissingRuleID
}
path := fmt.Sprintf("/wafs/rules/%s/vcl", i.RuleID)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
var vcl RuleVCL
if err := jsonapi.UnmarshalPayload(resp.Body, &vcl); err !... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRuleVCL",
"(",
"i",
"*",
"GetRuleInput",
")",
"(",
"*",
"RuleVCL",
",",
"error",
")",
"{",
"if",
"i",
".",
"RuleID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingRuleID",
"\n",
"}",
"\n\n",
"path... | // GetRuleVCL gets the VCL for a Rule. | [
"GetRuleVCL",
"gets",
"the",
"VCL",
"for",
"a",
"Rule",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L455-L471 |
132,423 | sethvargo/go-fastly | fastly/waf.go | GetWAFRuleVCL | func (c *Client) GetWAFRuleVCL(i *GetWAFRuleVCLInput) (*RuleVCL, error) {
if i.ID == "" {
return nil, ErrMissingWAFID
}
if i.RuleID == "" {
return nil, ErrMissingRuleID
}
path := fmt.Sprintf("/wafs/%s/rules/%s/vcl", i.ID, i.RuleID)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
var vc... | go | func (c *Client) GetWAFRuleVCL(i *GetWAFRuleVCLInput) (*RuleVCL, error) {
if i.ID == "" {
return nil, ErrMissingWAFID
}
if i.RuleID == "" {
return nil, ErrMissingRuleID
}
path := fmt.Sprintf("/wafs/%s/rules/%s/vcl", i.ID, i.RuleID)
resp, err := c.Get(path, nil)
if err != nil {
return nil, err
}
var vc... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetWAFRuleVCL",
"(",
"i",
"*",
"GetWAFRuleVCLInput",
")",
"(",
"*",
"RuleVCL",
",",
"error",
")",
"{",
"if",
"i",
".",
"ID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingWAFID",
"\n",
"}",
"\n\n",
"... | // GetWAFRuleVCL gets the VCL for a role associated with a firewall WAF. | [
"GetWAFRuleVCL",
"gets",
"the",
"VCL",
"for",
"a",
"role",
"associated",
"with",
"a",
"firewall",
"WAF",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L482-L502 |
132,424 | sethvargo/go-fastly | fastly/waf.go | GetWAFRuleRuleSets | func (c *Client) GetWAFRuleRuleSets(i *GetWAFRuleRuleSetsInput) (*Ruleset, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ID == "" {
return nil, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/wafs/%s/ruleset", i.Service, i.ID)
resp, err := c.Get(path, nil)
if err != nil {
return n... | go | func (c *Client) GetWAFRuleRuleSets(i *GetWAFRuleRuleSetsInput) (*Ruleset, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ID == "" {
return nil, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/wafs/%s/ruleset", i.Service, i.ID)
resp, err := c.Get(path, nil)
if err != nil {
return n... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetWAFRuleRuleSets",
"(",
"i",
"*",
"GetWAFRuleRuleSetsInput",
")",
"(",
"*",
"Ruleset",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"... | // GetWAFRuleRuleSets gets the VCL for rulesets associated with a firewall WAF. | [
"GetWAFRuleRuleSets",
"gets",
"the",
"VCL",
"for",
"rulesets",
"associated",
"with",
"a",
"firewall",
"WAF",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L520-L540 |
132,425 | sethvargo/go-fastly | fastly/waf.go | UpdateWAFRuleSets | func (c *Client) UpdateWAFRuleSets(i *UpdateWAFRuleRuleSetsInput) (*Ruleset, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ID == "" {
return nil, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/wafs/%s/ruleset", i.Service, i.ID)
resp, err := c.PatchJSONAPI(path, i, nil)
if err != ni... | go | func (c *Client) UpdateWAFRuleSets(i *UpdateWAFRuleRuleSetsInput) (*Ruleset, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ID == "" {
return nil, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/wafs/%s/ruleset", i.Service, i.ID)
resp, err := c.PatchJSONAPI(path, i, nil)
if err != ni... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateWAFRuleSets",
"(",
"i",
"*",
"UpdateWAFRuleRuleSetsInput",
")",
"(",
"*",
"Ruleset",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
... | // UpdateWAFRuleSets updates the rulesets for a role associated with a firewall WAF. | [
"UpdateWAFRuleSets",
"updates",
"the",
"rulesets",
"for",
"a",
"role",
"associated",
"with",
"a",
"firewall",
"WAF",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L551-L571 |
132,426 | sethvargo/go-fastly | fastly/waf.go | formatFilters | func (i *GetWAFRuleStatusesInput) formatFilters() map[string]string {
input := i.Filters
result := map[string]string{}
pairings := map[string]interface{}{
"filter[status]": input.Status,
"filter[rule][accuracy]": input.Accuracy,
"filter[rule][maturity]": input.Maturity,
"filter[rule][message]":... | go | func (i *GetWAFRuleStatusesInput) formatFilters() map[string]string {
input := i.Filters
result := map[string]string{}
pairings := map[string]interface{}{
"filter[status]": input.Status,
"filter[rule][accuracy]": input.Accuracy,
"filter[rule][maturity]": input.Maturity,
"filter[rule][message]":... | [
"func",
"(",
"i",
"*",
"GetWAFRuleStatusesInput",
")",
"formatFilters",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"input",
":=",
"i",
".",
"Filters",
"\n",
"result",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"pairings",
":=",... | // formatFilters converts user input into query parameters for filtering
// Fastly results for rules in a WAF. | [
"formatFilters",
"converts",
"user",
"input",
"into",
"query",
"parameters",
"for",
"filtering",
"Fastly",
"results",
"for",
"rules",
"in",
"a",
"WAF",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L614-L657 |
132,427 | sethvargo/go-fastly | fastly/waf.go | GetWAFRuleStatuses | func (c *Client) GetWAFRuleStatuses(i *GetWAFRuleStatusesInput) (GetWAFRuleStatusesResponse, error) {
statusResponse := GetWAFRuleStatusesResponse{Rules: []*WAFRuleStatus{}}
if i.Service == "" {
return statusResponse, ErrMissingService
}
if i.WAF == "" {
return statusResponse, ErrMissingWAFID
}
path := fmt.S... | go | func (c *Client) GetWAFRuleStatuses(i *GetWAFRuleStatusesInput) (GetWAFRuleStatusesResponse, error) {
statusResponse := GetWAFRuleStatusesResponse{Rules: []*WAFRuleStatus{}}
if i.Service == "" {
return statusResponse, ErrMissingService
}
if i.WAF == "" {
return statusResponse, ErrMissingWAFID
}
path := fmt.S... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetWAFRuleStatuses",
"(",
"i",
"*",
"GetWAFRuleStatusesInput",
")",
"(",
"GetWAFRuleStatusesResponse",
",",
"error",
")",
"{",
"statusResponse",
":=",
"GetWAFRuleStatusesResponse",
"{",
"Rules",
":",
"[",
"]",
"*",
"WAFRule... | // GetWAFRuleStatuses fetches the status of a subset of rules associated with a WAF. | [
"GetWAFRuleStatuses",
"fetches",
"the",
"status",
"of",
"a",
"subset",
"of",
"rules",
"associated",
"with",
"a",
"WAF",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L660-L681 |
132,428 | sethvargo/go-fastly | fastly/waf.go | interpretWAFRuleStatusesPage | func (c *Client) interpretWAFRuleStatusesPage(answer *GetWAFRuleStatusesResponse, received *http.Response) error {
// before we pull the status info out of the response body, fetch
// pagination info from it:
pages, body, err := getPages(received.Body)
if err != nil {
return err
}
data, err := jsonapi.Unmarshal... | go | func (c *Client) interpretWAFRuleStatusesPage(answer *GetWAFRuleStatusesResponse, received *http.Response) error {
// before we pull the status info out of the response body, fetch
// pagination info from it:
pages, body, err := getPages(received.Body)
if err != nil {
return err
}
data, err := jsonapi.Unmarshal... | [
"func",
"(",
"c",
"*",
"Client",
")",
"interpretWAFRuleStatusesPage",
"(",
"answer",
"*",
"GetWAFRuleStatusesResponse",
",",
"received",
"*",
"http",
".",
"Response",
")",
"error",
"{",
"// before we pull the status info out of the response body, fetch",
"// pagination info... | // interpretWAFRuleStatusesPage accepts a Fastly response for a set of WAF rule statuses
// and unmarshals the results. If there are more pages of results, it fetches the next
// page, adds that response to the array of results, and repeats until all results have
// been fetched. | [
"interpretWAFRuleStatusesPage",
"accepts",
"a",
"Fastly",
"response",
"for",
"a",
"set",
"of",
"WAF",
"rule",
"statuses",
"and",
"unmarshals",
"the",
"results",
".",
"If",
"there",
"are",
"more",
"pages",
"of",
"results",
"it",
"fetches",
"the",
"next",
"page"... | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L687-L715 |
132,429 | sethvargo/go-fastly | fastly/waf.go | getPages | func getPages(body io.Reader) (paginationInfo, io.Reader, error) {
var buf bytes.Buffer
tee := io.TeeReader(body, &buf)
bodyBytes, err := ioutil.ReadAll(tee)
if err != nil {
return paginationInfo{}, nil, err
}
var pages linksResponse
json.Unmarshal(bodyBytes, &pages)
return pages.Links, bytes.NewReader(buf.... | go | func getPages(body io.Reader) (paginationInfo, io.Reader, error) {
var buf bytes.Buffer
tee := io.TeeReader(body, &buf)
bodyBytes, err := ioutil.ReadAll(tee)
if err != nil {
return paginationInfo{}, nil, err
}
var pages linksResponse
json.Unmarshal(bodyBytes, &pages)
return pages.Links, bytes.NewReader(buf.... | [
"func",
"getPages",
"(",
"body",
"io",
".",
"Reader",
")",
"(",
"paginationInfo",
",",
"io",
".",
"Reader",
",",
"error",
")",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"tee",
":=",
"io",
".",
"TeeReader",
"(",
"body",
",",
"&",
"buf",
")",
... | // getPages parses a response to get the pagination data without destroying
// the reader we receive as "resp.Body"; this essentially copies resp.Body
// and returns it so we can use it again. | [
"getPages",
"parses",
"a",
"response",
"to",
"get",
"the",
"pagination",
"data",
"without",
"destroying",
"the",
"reader",
"we",
"receive",
"as",
"resp",
".",
"Body",
";",
"this",
"essentially",
"copies",
"resp",
".",
"Body",
"and",
"returns",
"it",
"so",
... | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L740-L752 |
132,430 | sethvargo/go-fastly | fastly/waf.go | GetWAFRuleStatus | func (c *Client) GetWAFRuleStatus(i *GetWAFRuleStatusInput) (WAFRuleStatus, error) {
if i.ID == 0 {
return WAFRuleStatus{}, ErrMissingRuleID
}
if i.Service == "" {
return WAFRuleStatus{}, ErrMissingService
}
if i.WAF == "" {
return WAFRuleStatus{}, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/wafs/%... | go | func (c *Client) GetWAFRuleStatus(i *GetWAFRuleStatusInput) (WAFRuleStatus, error) {
if i.ID == 0 {
return WAFRuleStatus{}, ErrMissingRuleID
}
if i.Service == "" {
return WAFRuleStatus{}, ErrMissingService
}
if i.WAF == "" {
return WAFRuleStatus{}, ErrMissingWAFID
}
path := fmt.Sprintf("/service/%s/wafs/%... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetWAFRuleStatus",
"(",
"i",
"*",
"GetWAFRuleStatusInput",
")",
"(",
"WAFRuleStatus",
",",
"error",
")",
"{",
"if",
"i",
".",
"ID",
"==",
"0",
"{",
"return",
"WAFRuleStatus",
"{",
"}",
",",
"ErrMissingRuleID",
"\n",... | // GetWAFRuleStatus fetches the status of a single rule associated with a WAF. | [
"GetWAFRuleStatus",
"fetches",
"the",
"status",
"of",
"a",
"single",
"rule",
"associated",
"with",
"a",
"WAF",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L762-L782 |
132,431 | sethvargo/go-fastly | fastly/waf.go | validate | func (i UpdateWAFRuleStatusInput) validate() error {
if i.ID == "" {
return ErrMissingID
}
if i.RuleID == 0 {
return ErrMissingRuleID
}
if i.Service == "" {
return ErrMissingService
}
if i.WAF == "" {
return ErrMissingWAFID
}
if i.Status == "" {
return ErrMissingStatus
}
return nil
} | go | func (i UpdateWAFRuleStatusInput) validate() error {
if i.ID == "" {
return ErrMissingID
}
if i.RuleID == 0 {
return ErrMissingRuleID
}
if i.Service == "" {
return ErrMissingService
}
if i.WAF == "" {
return ErrMissingWAFID
}
if i.Status == "" {
return ErrMissingStatus
}
return nil
} | [
"func",
"(",
"i",
"UpdateWAFRuleStatusInput",
")",
"validate",
"(",
")",
"error",
"{",
"if",
"i",
".",
"ID",
"==",
"\"",
"\"",
"{",
"return",
"ErrMissingID",
"\n",
"}",
"\n",
"if",
"i",
".",
"RuleID",
"==",
"0",
"{",
"return",
"ErrMissingRuleID",
"\n",... | // validate makes sure the UpdateWAFRuleStatusInput instance has all
// fields we need to request a change. | [
"validate",
"makes",
"sure",
"the",
"UpdateWAFRuleStatusInput",
"instance",
"has",
"all",
"fields",
"we",
"need",
"to",
"request",
"a",
"change",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L795-L812 |
132,432 | sethvargo/go-fastly | fastly/waf.go | UpdateWAFRuleStatus | func (c *Client) UpdateWAFRuleStatus(i *UpdateWAFRuleStatusInput) (WAFRuleStatus, error) {
if err := i.validate(); err != nil {
return WAFRuleStatus{}, err
}
path := fmt.Sprintf("/service/%s/wafs/%s/rules/%d/rule_status", i.Service, i.WAF, i.RuleID)
var buf bytes.Buffer
err := jsonapi.MarshalPayload(&buf, i)
... | go | func (c *Client) UpdateWAFRuleStatus(i *UpdateWAFRuleStatusInput) (WAFRuleStatus, error) {
if err := i.validate(); err != nil {
return WAFRuleStatus{}, err
}
path := fmt.Sprintf("/service/%s/wafs/%s/rules/%d/rule_status", i.Service, i.WAF, i.RuleID)
var buf bytes.Buffer
err := jsonapi.MarshalPayload(&buf, i)
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateWAFRuleStatus",
"(",
"i",
"*",
"UpdateWAFRuleStatusInput",
")",
"(",
"WAFRuleStatus",
",",
"error",
")",
"{",
"if",
"err",
":=",
"i",
".",
"validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"WAFRu... | // UpdateWAFRuleStatus changes the status of a single rule associated with a WAF. | [
"UpdateWAFRuleStatus",
"changes",
"the",
"status",
"of",
"a",
"single",
"rule",
"associated",
"with",
"a",
"WAF",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L815-L844 |
132,433 | sethvargo/go-fastly | fastly/waf.go | UpdateWAFConfigSet | func (c *Client) UpdateWAFConfigSet(i *UpdateWAFConfigSetInput) (UpdateWAFConfigSetResponse, error) {
if err := i.validate(); err != nil {
return UpdateWAFConfigSetResponse{}, err
}
var wafs []interface{}
for _, w := range i.WAFList {
wafs = append(wafs, &w)
}
path := fmt.Sprintf("/wafs/configuration_sets/%s... | go | func (c *Client) UpdateWAFConfigSet(i *UpdateWAFConfigSetInput) (UpdateWAFConfigSetResponse, error) {
if err := i.validate(); err != nil {
return UpdateWAFConfigSetResponse{}, err
}
var wafs []interface{}
for _, w := range i.WAFList {
wafs = append(wafs, &w)
}
path := fmt.Sprintf("/wafs/configuration_sets/%s... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateWAFConfigSet",
"(",
"i",
"*",
"UpdateWAFConfigSetInput",
")",
"(",
"UpdateWAFConfigSetResponse",
",",
"error",
")",
"{",
"if",
"err",
":=",
"i",
".",
"validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return... | // UpdateWAFConfigSet updates a list of WAFs with the given configset | [
"UpdateWAFConfigSet",
"updates",
"a",
"list",
"of",
"WAFs",
"with",
"the",
"given",
"configset"
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L946-L969 |
132,434 | sethvargo/go-fastly | fastly/waf.go | interpretWAFCongfigSetResponse | func (c *Client) interpretWAFCongfigSetResponse(answer *UpdateWAFConfigSetResponse, received *http.Response) error {
pages, body, err := getPages(received.Body)
if err != nil {
return err
}
data, err := jsonapi.UnmarshalManyPayload(body, reflect.TypeOf([]ConfigSetWAFs{}))
if err != nil {
return err
}
for i ... | go | func (c *Client) interpretWAFCongfigSetResponse(answer *UpdateWAFConfigSetResponse, received *http.Response) error {
pages, body, err := getPages(received.Body)
if err != nil {
return err
}
data, err := jsonapi.UnmarshalManyPayload(body, reflect.TypeOf([]ConfigSetWAFs{}))
if err != nil {
return err
}
for i ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"interpretWAFCongfigSetResponse",
"(",
"answer",
"*",
"UpdateWAFConfigSetResponse",
",",
"received",
"*",
"http",
".",
"Response",
")",
"error",
"{",
"pages",
",",
"body",
",",
"err",
":=",
"getPages",
"(",
"received",
"... | // interpretWAFCongfigSetResponse accepts a Fastly response containing a set of WAF ID's that
// where given to associate with the config set and unmarshals the results.
// If there are more pages of results, it fetches the next
// page, adds that response to the array of results, and repeats until all results have
// ... | [
"interpretWAFCongfigSetResponse",
"accepts",
"a",
"Fastly",
"response",
"containing",
"a",
"set",
"of",
"WAF",
"ID",
"s",
"that",
"where",
"given",
"to",
"associate",
"with",
"the",
"config",
"set",
"and",
"unmarshals",
"the",
"results",
".",
"If",
"there",
"a... | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/waf.go#L990-L1017 |
132,435 | sethvargo/go-fastly | fastly/response_object.go | ListResponseObjects | func (c *Client) ListResponseObjects(i *ListResponseObjectsInput) ([]*ResponseObject, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/response_object", i.Service, i.Version)
resp, err := c.Get(path,... | go | func (c *Client) ListResponseObjects(i *ListResponseObjectsInput) ([]*ResponseObject, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/response_object", i.Service, i.Version)
resp, err := c.Get(path,... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListResponseObjects",
"(",
"i",
"*",
"ListResponseObjectsInput",
")",
"(",
"[",
"]",
"*",
"ResponseObject",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissi... | // ListResponseObjects returns the list of response objects for the
// configuration version. | [
"ListResponseObjects",
"returns",
"the",
"list",
"of",
"response",
"objects",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/response_object.go#L44-L65 |
132,436 | sethvargo/go-fastly | fastly/response_object.go | CreateResponseObject | func (c *Client) CreateResponseObject(i *CreateResponseObjectInput) (*ResponseObject, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/response_object", i.Service, i.Version)
resp, err := c.PostForm(... | go | func (c *Client) CreateResponseObject(i *CreateResponseObjectInput) (*ResponseObject, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/response_object", i.Service, i.Version)
resp, err := c.PostForm(... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateResponseObject",
"(",
"i",
"*",
"CreateResponseObjectInput",
")",
"(",
"*",
"ResponseObject",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
... | // CreateResponseObject creates a new Fastly response object. | [
"CreateResponseObject",
"creates",
"a",
"new",
"Fastly",
"response",
"object",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/response_object.go#L85-L105 |
132,437 | sethvargo/go-fastly | fastly/response_object.go | GetResponseObject | func (c *Client) GetResponseObject(i *GetResponseObjectInput) (*ResponseObject, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/response_object/%s"... | go | func (c *Client) GetResponseObject(i *GetResponseObjectInput) (*ResponseObject, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/response_object/%s"... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetResponseObject",
"(",
"i",
"*",
"GetResponseObjectInput",
")",
"(",
"*",
"ResponseObject",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n"... | // GetResponseObject gets the response object configuration with the given
// parameters. | [
"GetResponseObject",
"gets",
"the",
"response",
"object",
"configuration",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/response_object.go#L120-L144 |
132,438 | sethvargo/go-fastly | fastly/response_object.go | UpdateResponseObject | func (c *Client) UpdateResponseObject(i *UpdateResponseObjectInput) (*ResponseObject, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/response_obje... | go | func (c *Client) UpdateResponseObject(i *UpdateResponseObjectInput) (*ResponseObject, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/response_obje... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateResponseObject",
"(",
"i",
"*",
"UpdateResponseObjectInput",
")",
"(",
"*",
"ResponseObject",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
... | // UpdateResponseObject updates a specific response object. | [
"UpdateResponseObject",
"updates",
"a",
"specific",
"response",
"object",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/response_object.go#L167-L191 |
132,439 | dchest/passwordreset | passwordreset.go | VerifyToken | func VerifyToken(token string, pwdvalFn func(string) ([]byte, error), secret []byte) (login string, err error) {
blen := base64.URLEncoding.DecodedLen(len(token))
// Avoid allocation if the token is too short
if blen <= 4+32 {
err = ErrMalformedToken
return
}
b := make([]byte, blen)
blen, err = base64.URLEnco... | go | func VerifyToken(token string, pwdvalFn func(string) ([]byte, error), secret []byte) (login string, err error) {
blen := base64.URLEncoding.DecodedLen(len(token))
// Avoid allocation if the token is too short
if blen <= 4+32 {
err = ErrMalformedToken
return
}
b := make([]byte, blen)
blen, err = base64.URLEnco... | [
"func",
"VerifyToken",
"(",
"token",
"string",
",",
"pwdvalFn",
"func",
"(",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
",",
"secret",
"[",
"]",
"byte",
")",
"(",
"login",
"string",
",",
"err",
"error",
")",
"{",
"blen",
":=",
"base64... | // VerifyToken verifies the given token with the password value returned by the
// given function and the given secret key, and returns login extracted from
// the valid token. If the token is not valid, the function returns an error.
//
// Function pwdvalFn must return the current password value for the login it
// re... | [
"VerifyToken",
"verifies",
"the",
"given",
"token",
"with",
"the",
"password",
"value",
"returned",
"by",
"the",
"given",
"function",
"and",
"the",
"given",
"secret",
"key",
"and",
"returns",
"login",
"extracted",
"from",
"the",
"valid",
"token",
".",
"If",
... | 642cf836ac8dfd4ddec7a28cbef7b00da0807812 | https://github.com/dchest/passwordreset/blob/642cf836ac8dfd4ddec7a28cbef7b00da0807812/passwordreset.go#L134-L174 |
132,440 | mitchellh/go-mruby | class.go | DefineClassMethod | func (c *Class) DefineClassMethod(name string, cb Func, as ArgSpec) {
insertMethod(c.mrb.state, c.class.c, name, cb)
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
C.mrb_define_class_method(
c.mrb.state,
c.class,
cs,
C._go_mrb_func_t(),
C.mrb_aspec(as))
} | go | func (c *Class) DefineClassMethod(name string, cb Func, as ArgSpec) {
insertMethod(c.mrb.state, c.class.c, name, cb)
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
C.mrb_define_class_method(
c.mrb.state,
c.class,
cs,
C._go_mrb_func_t(),
C.mrb_aspec(as))
} | [
"func",
"(",
"c",
"*",
"Class",
")",
"DefineClassMethod",
"(",
"name",
"string",
",",
"cb",
"Func",
",",
"as",
"ArgSpec",
")",
"{",
"insertMethod",
"(",
"c",
".",
"mrb",
".",
"state",
",",
"c",
".",
"class",
".",
"c",
",",
"name",
",",
"cb",
")",... | // DefineClassMethod defines a class-level method on the given class. | [
"DefineClassMethod",
"defines",
"a",
"class",
"-",
"level",
"method",
"on",
"the",
"given",
"class",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/class.go#L17-L29 |
132,441 | mitchellh/go-mruby | class.go | DefineConst | func (c *Class) DefineConst(name string, value Value) {
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
C.mrb_define_const(
c.mrb.state, c.class, cs, value.MrbValue(c.mrb).value)
} | go | func (c *Class) DefineConst(name string, value Value) {
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
C.mrb_define_const(
c.mrb.state, c.class, cs, value.MrbValue(c.mrb).value)
} | [
"func",
"(",
"c",
"*",
"Class",
")",
"DefineConst",
"(",
"name",
"string",
",",
"value",
"Value",
")",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")",
")",
... | // DefineConst defines a constant within this class. | [
"DefineConst",
"defines",
"a",
"constant",
"within",
"this",
"class",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/class.go#L32-L38 |
132,442 | mitchellh/go-mruby | class.go | New | func (c *Class) New(args ...Value) (*MrbValue, error) {
var argv []C.mrb_value
var argvPtr *C.mrb_value
if len(args) > 0 {
// Make the raw byte slice to hold our arguments we'll pass to C
argv = make([]C.mrb_value, len(args))
for i, arg := range args {
argv[i] = arg.MrbValue(c.mrb).value
}
argvPtr = &a... | go | func (c *Class) New(args ...Value) (*MrbValue, error) {
var argv []C.mrb_value
var argvPtr *C.mrb_value
if len(args) > 0 {
// Make the raw byte slice to hold our arguments we'll pass to C
argv = make([]C.mrb_value, len(args))
for i, arg := range args {
argv[i] = arg.MrbValue(c.mrb).value
}
argvPtr = &a... | [
"func",
"(",
"c",
"*",
"Class",
")",
"New",
"(",
"args",
"...",
"Value",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"var",
"argv",
"[",
"]",
"C",
".",
"mrb_value",
"\n",
"var",
"argvPtr",
"*",
"C",
".",
"mrb_value",
"\n",
"if",
"len",
"... | // New instantiates the class with the given args. | [
"New",
"instantiates",
"the",
"class",
"with",
"the",
"given",
"args",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/class.go#L62-L81 |
132,443 | mitchellh/go-mruby | mruby.go | GetGlobalVariable | func (m *Mrb) GetGlobalVariable(name string) *MrbValue {
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
return newValue(m.state, C._go_mrb_gv_get(m.state, C.mrb_intern_cstr(m.state, cs)))
} | go | func (m *Mrb) GetGlobalVariable(name string) *MrbValue {
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
return newValue(m.state, C._go_mrb_gv_get(m.state, C.mrb_intern_cstr(m.state, cs)))
} | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"GetGlobalVariable",
"(",
"name",
"string",
")",
"*",
"MrbValue",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")",
")",
"\n"... | // GetGlobalVariable returns the value of the global variable by the given name. | [
"GetGlobalVariable",
"returns",
"the",
"value",
"of",
"the",
"global",
"variable",
"by",
"the",
"given",
"name",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L17-L21 |
132,444 | mitchellh/go-mruby | mruby.go | SetGlobalVariable | func (m *Mrb) SetGlobalVariable(name string, value Value) {
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
v := value.MrbValue(m)
C._go_mrb_gv_set(m.state, C.mrb_intern_cstr(m.state, cs), v.value)
} | go | func (m *Mrb) SetGlobalVariable(name string, value Value) {
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
v := value.MrbValue(m)
C._go_mrb_gv_set(m.state, C.mrb_intern_cstr(m.state, cs), v.value)
} | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"SetGlobalVariable",
"(",
"name",
"string",
",",
"value",
"Value",
")",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")",
")"... | // SetGlobalVariable sets the value of the global variable by the given name. | [
"SetGlobalVariable",
"sets",
"the",
"value",
"of",
"the",
"global",
"variable",
"by",
"the",
"given",
"name",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L24-L30 |
132,445 | mitchellh/go-mruby | mruby.go | ArenaRestore | func (m *Mrb) ArenaRestore(idx ArenaIndex) {
C.mrb_gc_arena_restore(m.state, C.int(idx))
} | go | func (m *Mrb) ArenaRestore(idx ArenaIndex) {
C.mrb_gc_arena_restore(m.state, C.int(idx))
} | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"ArenaRestore",
"(",
"idx",
"ArenaIndex",
")",
"{",
"C",
".",
"mrb_gc_arena_restore",
"(",
"m",
".",
"state",
",",
"C",
".",
"int",
"(",
"idx",
")",
")",
"\n",
"}"
] | // ArenaRestore restores the arena index so the objects between the save and this point
// can be garbage collected in the future.
//
// See ArenaSave for more documentation. | [
"ArenaRestore",
"restores",
"the",
"arena",
"index",
"so",
"the",
"objects",
"between",
"the",
"save",
"and",
"this",
"point",
"can",
"be",
"garbage",
"collected",
"in",
"the",
"future",
".",
"See",
"ArenaSave",
"for",
"more",
"documentation",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L54-L56 |
132,446 | mitchellh/go-mruby | mruby.go | Close | func (m *Mrb) Close() {
// Delete all the methods from the state
stateMethodTable.Mutex.Lock()
delete(stateMethodTable.Map, m.state)
stateMethodTable.Mutex.Unlock()
// Close the state
C.mrb_close(m.state)
} | go | func (m *Mrb) Close() {
// Delete all the methods from the state
stateMethodTable.Mutex.Lock()
delete(stateMethodTable.Map, m.state)
stateMethodTable.Mutex.Unlock()
// Close the state
C.mrb_close(m.state)
} | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"Close",
"(",
")",
"{",
"// Delete all the methods from the state",
"stateMethodTable",
".",
"Mutex",
".",
"Lock",
"(",
")",
"\n",
"delete",
"(",
"stateMethodTable",
".",
"Map",
",",
"m",
".",
"state",
")",
"\n",
"stateMe... | // Close a Mrb, this must be called to properly free resources, and
// should only be called once. | [
"Close",
"a",
"Mrb",
"this",
"must",
"be",
"called",
"to",
"properly",
"free",
"resources",
"and",
"should",
"only",
"be",
"called",
"once",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L130-L138 |
132,447 | mitchellh/go-mruby | mruby.go | LoadString | func (m *Mrb) LoadString(code string) (*MrbValue, error) {
cs := C.CString(code)
defer C.free(unsafe.Pointer(cs))
value := C._go_mrb_load_string(m.state, cs)
if exc := checkException(m.state); exc != nil {
return nil, exc
}
return newValue(m.state, value), nil
} | go | func (m *Mrb) LoadString(code string) (*MrbValue, error) {
cs := C.CString(code)
defer C.free(unsafe.Pointer(cs))
value := C._go_mrb_load_string(m.state, cs)
if exc := checkException(m.state); exc != nil {
return nil, exc
}
return newValue(m.state, value), nil
} | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"LoadString",
"(",
"code",
"string",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"code",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"... | // LoadString loads the given code, executes it, and returns its final
// value that it might return. | [
"LoadString",
"loads",
"the",
"given",
"code",
"executes",
"it",
"and",
"returns",
"its",
"final",
"value",
"that",
"it",
"might",
"return",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L194-L204 |
132,448 | mitchellh/go-mruby | mruby.go | Run | func (m *Mrb) Run(v Value, self Value) (*MrbValue, error) {
if self == nil {
self = m.TopSelf()
}
mrbV := v.MrbValue(m)
mrbSelf := self.MrbValue(m)
proc := C._go_mrb_proc_ptr(mrbV.value)
value := C.mrb_run(m.state, proc, mrbSelf.value)
if exc := checkException(m.state); exc != nil {
return nil, exc
}
r... | go | func (m *Mrb) Run(v Value, self Value) (*MrbValue, error) {
if self == nil {
self = m.TopSelf()
}
mrbV := v.MrbValue(m)
mrbSelf := self.MrbValue(m)
proc := C._go_mrb_proc_ptr(mrbV.value)
value := C.mrb_run(m.state, proc, mrbSelf.value)
if exc := checkException(m.state); exc != nil {
return nil, exc
}
r... | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"Run",
"(",
"v",
"Value",
",",
"self",
"Value",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"if",
"self",
"==",
"nil",
"{",
"self",
"=",
"m",
".",
"TopSelf",
"(",
")",
"\n",
"}",
"\n\n",
"mrbV",
":=",... | // Run executes the given value, which should be a proc type.
//
// If you're looking to execute code directly a string, look at LoadString.
//
// If self is nil, it is set to the top-level self. | [
"Run",
"executes",
"the",
"given",
"value",
"which",
"should",
"be",
"a",
"proc",
"type",
".",
"If",
"you",
"re",
"looking",
"to",
"execute",
"code",
"directly",
"a",
"string",
"look",
"at",
"LoadString",
".",
"If",
"self",
"is",
"nil",
"it",
"is",
"se... | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L211-L227 |
132,449 | mitchellh/go-mruby | mruby.go | Yield | func (m *Mrb) Yield(block Value, args ...Value) (*MrbValue, error) {
mrbBlock := block.MrbValue(m)
var argv []C.mrb_value
var argvPtr *C.mrb_value
if len(args) > 0 {
// Make the raw byte slice to hold our arguments we'll pass to C
argv = make([]C.mrb_value, len(args))
for i, arg := range args {
argv[i] =... | go | func (m *Mrb) Yield(block Value, args ...Value) (*MrbValue, error) {
mrbBlock := block.MrbValue(m)
var argv []C.mrb_value
var argvPtr *C.mrb_value
if len(args) > 0 {
// Make the raw byte slice to hold our arguments we'll pass to C
argv = make([]C.mrb_value, len(args))
for i, arg := range args {
argv[i] =... | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"Yield",
"(",
"block",
"Value",
",",
"args",
"...",
"Value",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"mrbBlock",
":=",
"block",
".",
"MrbValue",
"(",
"m",
")",
"\n\n",
"var",
"argv",
"[",
"]",
"C",
... | // Yield yields to a block with the given arguments.
//
// This should be called within the context of a Func. | [
"Yield",
"yields",
"to",
"a",
"block",
"with",
"the",
"given",
"arguments",
".",
"This",
"should",
"be",
"called",
"within",
"the",
"context",
"of",
"a",
"Func",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L258-L285 |
132,450 | mitchellh/go-mruby | mruby.go | DefineModule | func (m *Mrb) DefineModule(name string) *Class {
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
return newClass(m, C.mrb_define_module(m.state, cs))
} | go | func (m *Mrb) DefineModule(name string) *Class {
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
return newClass(m, C.mrb_define_module(m.state, cs))
} | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"DefineModule",
"(",
"name",
"string",
")",
"*",
"Class",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")",
")",
"\n",
"ret... | // DefineModule defines a top-level module. | [
"DefineModule",
"defines",
"a",
"top",
"-",
"level",
"module",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L326-L330 |
132,451 | mitchellh/go-mruby | mruby.go | TopSelf | func (m *Mrb) TopSelf() *MrbValue {
return newValue(m.state, C.mrb_obj_value(unsafe.Pointer(m.state.top_self)))
} | go | func (m *Mrb) TopSelf() *MrbValue {
return newValue(m.state, C.mrb_obj_value(unsafe.Pointer(m.state.top_self)))
} | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"TopSelf",
"(",
")",
"*",
"MrbValue",
"{",
"return",
"newValue",
"(",
"m",
".",
"state",
",",
"C",
".",
"mrb_obj_value",
"(",
"unsafe",
".",
"Pointer",
"(",
"m",
".",
"state",
".",
"top_self",
")",
")",
")",
"\n... | // TopSelf returns the top-level `self` value. | [
"TopSelf",
"returns",
"the",
"top",
"-",
"level",
"self",
"value",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L360-L362 |
132,452 | mitchellh/go-mruby | mruby.go | FixnumValue | func (m *Mrb) FixnumValue(v int) *MrbValue {
return newValue(m.state, C.mrb_fixnum_value(C.mrb_int(v)))
} | go | func (m *Mrb) FixnumValue(v int) *MrbValue {
return newValue(m.state, C.mrb_fixnum_value(C.mrb_int(v)))
} | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"FixnumValue",
"(",
"v",
"int",
")",
"*",
"MrbValue",
"{",
"return",
"newValue",
"(",
"m",
".",
"state",
",",
"C",
".",
"mrb_fixnum_value",
"(",
"C",
".",
"mrb_int",
"(",
"v",
")",
")",
")",
"\n",
"}"
] | // FixnumValue returns a Value for a fixed number. | [
"FixnumValue",
"returns",
"a",
"Value",
"for",
"a",
"fixed",
"number",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L380-L382 |
132,453 | mitchellh/go-mruby | mruby.go | StringValue | func (m *Mrb) StringValue(s string) *MrbValue {
cs := C.CString(s)
defer C.free(unsafe.Pointer(cs))
return newValue(m.state, C.mrb_str_new_cstr(m.state, cs))
} | go | func (m *Mrb) StringValue(s string) *MrbValue {
cs := C.CString(s)
defer C.free(unsafe.Pointer(cs))
return newValue(m.state, C.mrb_str_new_cstr(m.state, cs))
} | [
"func",
"(",
"m",
"*",
"Mrb",
")",
"StringValue",
"(",
"s",
"string",
")",
"*",
"MrbValue",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"s",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")",
")",
"\n",
"return"... | // StringValue returns a Value for a string. | [
"StringValue",
"returns",
"a",
"Value",
"for",
"a",
"string",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/mruby.go#L385-L389 |
132,454 | mitchellh/go-mruby | hash.go | Delete | func (h *Hash) Delete(key Value) (*MrbValue, error) {
keyVal := key.MrbValue(&Mrb{h.state}).value
result := C.mrb_hash_delete_key(h.state, h.value, keyVal)
val := newValue(h.state, result)
if val.Type() == TypeNil {
val = nil
}
return val, nil
} | go | func (h *Hash) Delete(key Value) (*MrbValue, error) {
keyVal := key.MrbValue(&Mrb{h.state}).value
result := C.mrb_hash_delete_key(h.state, h.value, keyVal)
val := newValue(h.state, result)
if val.Type() == TypeNil {
val = nil
}
return val, nil
} | [
"func",
"(",
"h",
"*",
"Hash",
")",
"Delete",
"(",
"key",
"Value",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"keyVal",
":=",
"key",
".",
"MrbValue",
"(",
"&",
"Mrb",
"{",
"h",
".",
"state",
"}",
")",
".",
"value",
"\n",
"result",
":=",... | // Delete deletes a key from the hash, returning its existing value,
// or nil if there wasn't a value. | [
"Delete",
"deletes",
"a",
"key",
"from",
"the",
"hash",
"returning",
"its",
"existing",
"value",
"or",
"nil",
"if",
"there",
"wasn",
"t",
"a",
"value",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/hash.go#L15-L25 |
132,455 | mitchellh/go-mruby | hash.go | Get | func (h *Hash) Get(key Value) (*MrbValue, error) {
keyVal := key.MrbValue(&Mrb{h.state}).value
result := C.mrb_hash_get(h.state, h.value, keyVal)
return newValue(h.state, result), nil
} | go | func (h *Hash) Get(key Value) (*MrbValue, error) {
keyVal := key.MrbValue(&Mrb{h.state}).value
result := C.mrb_hash_get(h.state, h.value, keyVal)
return newValue(h.state, result), nil
} | [
"func",
"(",
"h",
"*",
"Hash",
")",
"Get",
"(",
"key",
"Value",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"keyVal",
":=",
"key",
".",
"MrbValue",
"(",
"&",
"Mrb",
"{",
"h",
".",
"state",
"}",
")",
".",
"value",
"\n",
"result",
":=",
... | // Get reads a value from the hash. | [
"Get",
"reads",
"a",
"value",
"from",
"the",
"hash",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/hash.go#L28-L32 |
132,456 | mitchellh/go-mruby | hash.go | Set | func (h *Hash) Set(key, val Value) error {
keyVal := key.MrbValue(&Mrb{h.state}).value
valVal := val.MrbValue(&Mrb{h.state}).value
C.mrb_hash_set(h.state, h.value, keyVal, valVal)
return nil
} | go | func (h *Hash) Set(key, val Value) error {
keyVal := key.MrbValue(&Mrb{h.state}).value
valVal := val.MrbValue(&Mrb{h.state}).value
C.mrb_hash_set(h.state, h.value, keyVal, valVal)
return nil
} | [
"func",
"(",
"h",
"*",
"Hash",
")",
"Set",
"(",
"key",
",",
"val",
"Value",
")",
"error",
"{",
"keyVal",
":=",
"key",
".",
"MrbValue",
"(",
"&",
"Mrb",
"{",
"h",
".",
"state",
"}",
")",
".",
"value",
"\n",
"valVal",
":=",
"val",
".",
"MrbValue"... | // Set sets a value on the hash | [
"Set",
"sets",
"a",
"value",
"on",
"the",
"hash"
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/hash.go#L35-L40 |
132,457 | mitchellh/go-mruby | parser.go | NewParser | func NewParser(m *Mrb) *Parser {
p := C.mrb_parser_new(m.state)
// Set capture_errors to true so we don't go just printing things
// out to stdout.
C._go_mrb_parser_set_capture_errors(p, 1)
return &Parser{
mrb: m,
parser: p,
}
} | go | func NewParser(m *Mrb) *Parser {
p := C.mrb_parser_new(m.state)
// Set capture_errors to true so we don't go just printing things
// out to stdout.
C._go_mrb_parser_set_capture_errors(p, 1)
return &Parser{
mrb: m,
parser: p,
}
} | [
"func",
"NewParser",
"(",
"m",
"*",
"Mrb",
")",
"*",
"Parser",
"{",
"p",
":=",
"C",
".",
"mrb_parser_new",
"(",
"m",
".",
"state",
")",
"\n\n",
"// Set capture_errors to true so we don't go just printing things",
"// out to stdout.",
"C",
".",
"_go_mrb_parser_set_ca... | // NewParser initializes the resources for a parser.
//
// Make sure to Close the parser when you're done with it. | [
"NewParser",
"initializes",
"the",
"resources",
"for",
"a",
"parser",
".",
"Make",
"sure",
"to",
"Close",
"the",
"parser",
"when",
"you",
"re",
"done",
"with",
"it",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/parser.go#L23-L34 |
132,458 | mitchellh/go-mruby | parser.go | GenerateCode | func (p *Parser) GenerateCode() *MrbValue {
proc := C.mrb_generate_code(p.mrb.state, p.parser)
return newValue(p.mrb.state, C.mrb_obj_value(unsafe.Pointer(proc)))
} | go | func (p *Parser) GenerateCode() *MrbValue {
proc := C.mrb_generate_code(p.mrb.state, p.parser)
return newValue(p.mrb.state, C.mrb_obj_value(unsafe.Pointer(proc)))
} | [
"func",
"(",
"p",
"*",
"Parser",
")",
"GenerateCode",
"(",
")",
"*",
"MrbValue",
"{",
"proc",
":=",
"C",
".",
"mrb_generate_code",
"(",
"p",
".",
"mrb",
".",
"state",
",",
"p",
".",
"parser",
")",
"\n",
"return",
"newValue",
"(",
"p",
".",
"mrb",
... | // GenerateCode takes all the internal parser state and generates
// executable Ruby code, returning the callable proc. | [
"GenerateCode",
"takes",
"all",
"the",
"internal",
"parser",
"state",
"and",
"generates",
"executable",
"Ruby",
"code",
"returning",
"the",
"callable",
"proc",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/parser.go#L46-L49 |
132,459 | mitchellh/go-mruby | parser.go | Parse | func (p *Parser) Parse(code string, c *CompileContext) ([]*ParserMessage, error) {
// We set p.code so that the string doesn't get garbage collected
var s *C.char = C.CString(code)
p.code = code
p.parser.s = s
p.parser.send = C._go_mrb_calc_send(s)
var ctx *C.mrbc_context
if c != nil {
ctx = c.ctx
}
C.mrb_p... | go | func (p *Parser) Parse(code string, c *CompileContext) ([]*ParserMessage, error) {
// We set p.code so that the string doesn't get garbage collected
var s *C.char = C.CString(code)
p.code = code
p.parser.s = s
p.parser.send = C._go_mrb_calc_send(s)
var ctx *C.mrbc_context
if c != nil {
ctx = c.ctx
}
C.mrb_p... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"Parse",
"(",
"code",
"string",
",",
"c",
"*",
"CompileContext",
")",
"(",
"[",
"]",
"*",
"ParserMessage",
",",
"error",
")",
"{",
"// We set p.code so that the string doesn't get garbage collected",
"var",
"s",
"*",
"C",
... | // Parse parses the code in the given context, and returns any warnings
// or errors from parsing.
//
// The CompileContext can be nil to not set a context. | [
"Parse",
"parses",
"the",
"code",
"in",
"the",
"given",
"context",
"and",
"returns",
"any",
"warnings",
"or",
"errors",
"from",
"parsing",
".",
"The",
"CompileContext",
"can",
"be",
"nil",
"to",
"not",
"set",
"a",
"context",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/parser.go#L55-L100 |
132,460 | mitchellh/go-mruby | args.go | ArgsArg | func ArgsArg(r, o int) ArgSpec {
return ArgSpec(C._go_MRB_ARGS_ARG(C.int(r), C.int(o)))
} | go | func ArgsArg(r, o int) ArgSpec {
return ArgSpec(C._go_MRB_ARGS_ARG(C.int(r), C.int(o)))
} | [
"func",
"ArgsArg",
"(",
"r",
",",
"o",
"int",
")",
"ArgSpec",
"{",
"return",
"ArgSpec",
"(",
"C",
".",
"_go_MRB_ARGS_ARG",
"(",
"C",
".",
"int",
"(",
"r",
")",
",",
"C",
".",
"int",
"(",
"o",
")",
")",
")",
"\n",
"}"
] | // ArgsArg says the given number of arguments are required and
// the second number is optional. | [
"ArgsArg",
"says",
"the",
"given",
"number",
"of",
"arguments",
"are",
"required",
"and",
"the",
"second",
"number",
"is",
"optional",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/args.go#L20-L22 |
132,461 | mitchellh/go-mruby | args.go | ArgsReq | func ArgsReq(n int) ArgSpec {
return ArgSpec(C._go_MRB_ARGS_REQ(C.int(n)))
} | go | func ArgsReq(n int) ArgSpec {
return ArgSpec(C._go_MRB_ARGS_REQ(C.int(n)))
} | [
"func",
"ArgsReq",
"(",
"n",
"int",
")",
"ArgSpec",
"{",
"return",
"ArgSpec",
"(",
"C",
".",
"_go_MRB_ARGS_REQ",
"(",
"C",
".",
"int",
"(",
"n",
")",
")",
")",
"\n",
"}"
] | // ArgsReq says that the given number of arguments are required. | [
"ArgsReq",
"says",
"that",
"the",
"given",
"number",
"of",
"arguments",
"are",
"required",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/args.go#L35-L37 |
132,462 | mitchellh/go-mruby | args.go | ArgsOpt | func ArgsOpt(n int) ArgSpec {
return ArgSpec(C._go_MRB_ARGS_OPT(C.int(n)))
} | go | func ArgsOpt(n int) ArgSpec {
return ArgSpec(C._go_MRB_ARGS_OPT(C.int(n)))
} | [
"func",
"ArgsOpt",
"(",
"n",
"int",
")",
"ArgSpec",
"{",
"return",
"ArgSpec",
"(",
"C",
".",
"_go_MRB_ARGS_OPT",
"(",
"C",
".",
"int",
"(",
"n",
")",
")",
")",
"\n",
"}"
] | // ArgsOpt says that the given number of arguments are optional. | [
"ArgsOpt",
"says",
"that",
"the",
"given",
"number",
"of",
"arguments",
"are",
"optional",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/args.go#L40-L42 |
132,463 | mitchellh/go-mruby | array.go | Len | func (v *Array) Len() int {
return int(C.mrb_ary_len(v.state, v.value))
} | go | func (v *Array) Len() int {
return int(C.mrb_ary_len(v.state, v.value))
} | [
"func",
"(",
"v",
"*",
"Array",
")",
"Len",
"(",
")",
"int",
"{",
"return",
"int",
"(",
"C",
".",
"mrb_ary_len",
"(",
"v",
".",
"state",
",",
"v",
".",
"value",
")",
")",
"\n",
"}"
] | // Len returns the length of the array. | [
"Len",
"returns",
"the",
"length",
"of",
"the",
"array",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/array.go#L14-L16 |
132,464 | mitchellh/go-mruby | decode.go | decodeStructHashGetter | func decodeStructHashGetter(mrb *Mrb, h *Hash) decodeStructGetter {
return func(key string) (*MrbValue, error) {
rbKey := mrb.StringValue(key)
return h.Get(rbKey)
}
} | go | func decodeStructHashGetter(mrb *Mrb, h *Hash) decodeStructGetter {
return func(key string) (*MrbValue, error) {
rbKey := mrb.StringValue(key)
return h.Get(rbKey)
}
} | [
"func",
"decodeStructHashGetter",
"(",
"mrb",
"*",
"Mrb",
",",
"h",
"*",
"Hash",
")",
"decodeStructGetter",
"{",
"return",
"func",
"(",
"key",
"string",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"rbKey",
":=",
"mrb",
".",
"StringValue",
"(",
"... | // decodeStructHashGetter is a decodeStructGetter that reads values from
// a hash. | [
"decodeStructHashGetter",
"is",
"a",
"decodeStructGetter",
"that",
"reads",
"values",
"from",
"a",
"hash",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/decode.go#L498-L503 |
132,465 | mitchellh/go-mruby | decode.go | decodeStructObjectMethods | func decodeStructObjectMethods(mrb *Mrb, v *MrbValue) decodeStructGetter {
return func(key string) (*MrbValue, error) {
return v.Call(key)
}
} | go | func decodeStructObjectMethods(mrb *Mrb, v *MrbValue) decodeStructGetter {
return func(key string) (*MrbValue, error) {
return v.Call(key)
}
} | [
"func",
"decodeStructObjectMethods",
"(",
"mrb",
"*",
"Mrb",
",",
"v",
"*",
"MrbValue",
")",
"decodeStructGetter",
"{",
"return",
"func",
"(",
"key",
"string",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"return",
"v",
".",
"Call",
"(",
"key",
"... | // decodeStructObjectMethods is a decodeStructGetter that reads values from
// an object by calling methods. | [
"decodeStructObjectMethods",
"is",
"a",
"decodeStructGetter",
"that",
"reads",
"values",
"from",
"an",
"object",
"by",
"calling",
"methods",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/decode.go#L507-L511 |
132,466 | mitchellh/go-mruby | context.go | SetFilename | func (c *CompileContext) SetFilename(f string) {
c.filename = f
c.ctx.filename = C.CString(c.filename)
} | go | func (c *CompileContext) SetFilename(f string) {
c.filename = f
c.ctx.filename = C.CString(c.filename)
} | [
"func",
"(",
"c",
"*",
"CompileContext",
")",
"SetFilename",
"(",
"f",
"string",
")",
"{",
"c",
".",
"filename",
"=",
"f",
"\n",
"c",
".",
"ctx",
".",
"filename",
"=",
"C",
".",
"CString",
"(",
"c",
".",
"filename",
")",
"\n",
"}"
] | // SetFilename sets the filename associated with this compilation context.
//
// Code parsed under this context will be from this file. | [
"SetFilename",
"sets",
"the",
"filename",
"associated",
"with",
"this",
"compilation",
"context",
".",
"Code",
"parsed",
"under",
"this",
"context",
"will",
"be",
"from",
"this",
"file",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/context.go#L41-L44 |
132,467 | mitchellh/go-mruby | value.go | SetInstanceVariable | func (v *MrbValue) SetInstanceVariable(variable string, value *MrbValue) {
cs := C.CString(variable)
defer C.free(unsafe.Pointer(cs))
C._go_mrb_iv_set(v.state, v.value, C.mrb_intern_cstr(v.state, cs), value.value)
} | go | func (v *MrbValue) SetInstanceVariable(variable string, value *MrbValue) {
cs := C.CString(variable)
defer C.free(unsafe.Pointer(cs))
C._go_mrb_iv_set(v.state, v.value, C.mrb_intern_cstr(v.state, cs), value.value)
} | [
"func",
"(",
"v",
"*",
"MrbValue",
")",
"SetInstanceVariable",
"(",
"variable",
"string",
",",
"value",
"*",
"MrbValue",
")",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"variable",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
... | // SetInstanceVariable sets an instance variable on this value. | [
"SetInstanceVariable",
"sets",
"an",
"instance",
"variable",
"on",
"this",
"value",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/value.go#L45-L49 |
132,468 | mitchellh/go-mruby | value.go | GetInstanceVariable | func (v *MrbValue) GetInstanceVariable(variable string) *MrbValue {
cs := C.CString(variable)
defer C.free(unsafe.Pointer(cs))
return newValue(v.state, C._go_mrb_iv_get(v.state, v.value, C.mrb_intern_cstr(v.state, cs)))
} | go | func (v *MrbValue) GetInstanceVariable(variable string) *MrbValue {
cs := C.CString(variable)
defer C.free(unsafe.Pointer(cs))
return newValue(v.state, C._go_mrb_iv_get(v.state, v.value, C.mrb_intern_cstr(v.state, cs)))
} | [
"func",
"(",
"v",
"*",
"MrbValue",
")",
"GetInstanceVariable",
"(",
"variable",
"string",
")",
"*",
"MrbValue",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"variable",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")"... | // GetInstanceVariable gets an instance variable on this value. | [
"GetInstanceVariable",
"gets",
"an",
"instance",
"variable",
"on",
"this",
"value",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/value.go#L52-L56 |
132,469 | mitchellh/go-mruby | value.go | Call | func (v *MrbValue) Call(method string, args ...Value) (*MrbValue, error) {
return v.call(method, args, nil)
} | go | func (v *MrbValue) Call(method string, args ...Value) (*MrbValue, error) {
return v.call(method, args, nil)
} | [
"func",
"(",
"v",
"*",
"MrbValue",
")",
"Call",
"(",
"method",
"string",
",",
"args",
"...",
"Value",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"return",
"v",
".",
"call",
"(",
"method",
",",
"args",
",",
"nil",
")",
"\n",
"}"
] | // Call calls a method with the given name and arguments on this
// value. | [
"Call",
"calls",
"a",
"method",
"with",
"the",
"given",
"name",
"and",
"arguments",
"on",
"this",
"value",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/value.go#L60-L62 |
132,470 | mitchellh/go-mruby | value.go | CallBlock | func (v *MrbValue) CallBlock(method string, args ...Value) (*MrbValue, error) {
if len(args) == 0 {
return nil, fmt.Errorf("args must be non-empty and have a proc at the end")
}
n := len(args)
return v.call(method, args[:n-1], args[n-1])
} | go | func (v *MrbValue) CallBlock(method string, args ...Value) (*MrbValue, error) {
if len(args) == 0 {
return nil, fmt.Errorf("args must be non-empty and have a proc at the end")
}
n := len(args)
return v.call(method, args[:n-1], args[n-1])
} | [
"func",
"(",
"v",
"*",
"MrbValue",
")",
"CallBlock",
"(",
"method",
"string",
",",
"args",
"...",
"Value",
")",
"(",
"*",
"MrbValue",
",",
"error",
")",
"{",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf... | // CallBlock is the same as call except that it expects the last
// argument to be a Proc that will be passed into the function call.
// It is an error if args is empty or if there is no block on the end. | [
"CallBlock",
"is",
"the",
"same",
"as",
"call",
"except",
"that",
"it",
"expects",
"the",
"last",
"argument",
"to",
"be",
"a",
"Proc",
"that",
"will",
"be",
"passed",
"into",
"the",
"function",
"call",
".",
"It",
"is",
"an",
"error",
"if",
"args",
"is"... | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/value.go#L67-L74 |
132,471 | mitchellh/go-mruby | value.go | IsDead | func (v *MrbValue) IsDead() bool {
return C.ushort(C._go_isdead(v.state, v.value)) != 0
} | go | func (v *MrbValue) IsDead() bool {
return C.ushort(C._go_isdead(v.state, v.value)) != 0
} | [
"func",
"(",
"v",
"*",
"MrbValue",
")",
"IsDead",
"(",
")",
"bool",
"{",
"return",
"C",
".",
"ushort",
"(",
"C",
".",
"_go_isdead",
"(",
"v",
".",
"state",
",",
"v",
".",
"value",
")",
")",
"!=",
"0",
"\n",
"}"
] | // IsDead tells you if an object has been collected by the GC or not. | [
"IsDead",
"tells",
"you",
"if",
"an",
"object",
"has",
"been",
"collected",
"by",
"the",
"GC",
"or",
"not",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/value.go#L119-L121 |
132,472 | mitchellh/go-mruby | value.go | SetProcTargetClass | func (v *MrbValue) SetProcTargetClass(c *Class) {
proc := C._go_mrb_proc_ptr(v.value)
proc.target_class = c.class
} | go | func (v *MrbValue) SetProcTargetClass(c *Class) {
proc := C._go_mrb_proc_ptr(v.value)
proc.target_class = c.class
} | [
"func",
"(",
"v",
"*",
"MrbValue",
")",
"SetProcTargetClass",
"(",
"c",
"*",
"Class",
")",
"{",
"proc",
":=",
"C",
".",
"_go_mrb_proc_ptr",
"(",
"v",
".",
"value",
")",
"\n",
"proc",
".",
"target_class",
"=",
"c",
".",
"class",
"\n",
"}"
] | // SetProcTargetClass sets the target class where a proc will be executed
// when this value is a proc. | [
"SetProcTargetClass",
"sets",
"the",
"target",
"class",
"where",
"a",
"proc",
"will",
"be",
"executed",
"when",
"this",
"value",
"is",
"a",
"proc",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/value.go#L140-L143 |
132,473 | mitchellh/go-mruby | value.go | Type | func (v *MrbValue) Type() ValueType {
if C._go_mrb_nil_p(v.value) == 1 {
return TypeNil
}
return ValueType(C._go_mrb_type(v.value))
} | go | func (v *MrbValue) Type() ValueType {
if C._go_mrb_nil_p(v.value) == 1 {
return TypeNil
}
return ValueType(C._go_mrb_type(v.value))
} | [
"func",
"(",
"v",
"*",
"MrbValue",
")",
"Type",
"(",
")",
"ValueType",
"{",
"if",
"C",
".",
"_go_mrb_nil_p",
"(",
"v",
".",
"value",
")",
"==",
"1",
"{",
"return",
"TypeNil",
"\n",
"}",
"\n\n",
"return",
"ValueType",
"(",
"C",
".",
"_go_mrb_type",
... | // Type returns the ValueType of the MrbValue. See the constants table. | [
"Type",
"returns",
"the",
"ValueType",
"of",
"the",
"MrbValue",
".",
"See",
"the",
"constants",
"table",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/value.go#L146-L152 |
132,474 | mitchellh/go-mruby | value.go | String | func (v *MrbValue) String() string {
value := C.mrb_obj_as_string(v.state, v.value)
result := C.GoString(C.mrb_string_value_ptr(v.state, value))
return result
} | go | func (v *MrbValue) String() string {
value := C.mrb_obj_as_string(v.state, v.value)
result := C.GoString(C.mrb_string_value_ptr(v.state, value))
return result
} | [
"func",
"(",
"v",
"*",
"MrbValue",
")",
"String",
"(",
")",
"string",
"{",
"value",
":=",
"C",
".",
"mrb_obj_as_string",
"(",
"v",
".",
"state",
",",
"v",
".",
"value",
")",
"\n",
"result",
":=",
"C",
".",
"GoString",
"(",
"C",
".",
"mrb_string_val... | // String returns the "to_s" result of this value. | [
"String",
"returns",
"the",
"to_s",
"result",
"of",
"this",
"value",
"."
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/value.go#L207-L211 |
132,475 | mitchellh/go-mruby | value.go | MrbValue | func (s String) MrbValue(m *Mrb) *MrbValue {
return m.StringValue(string(s))
} | go | func (s String) MrbValue(m *Mrb) *MrbValue {
return m.StringValue(string(s))
} | [
"func",
"(",
"s",
"String",
")",
"MrbValue",
"(",
"m",
"*",
"Mrb",
")",
"*",
"MrbValue",
"{",
"return",
"m",
".",
"StringValue",
"(",
"string",
"(",
"s",
")",
")",
"\n",
"}"
] | // MrbValue returns the native MRB value | [
"MrbValue",
"returns",
"the",
"native",
"MRB",
"value"
] | cd6a04a6ea57d3ecdf60ec703c927fb4984569ff | https://github.com/mitchellh/go-mruby/blob/cd6a04a6ea57d3ecdf60ec703c927fb4984569ff/value.go#L242-L244 |
132,476 | multiformats/go-multistream | client.go | SelectProtoOrFail | func SelectProtoOrFail(proto string, rwc io.ReadWriteCloser) error {
err := handshake(rwc)
if err != nil {
return err
}
return trySelect(proto, rwc)
} | go | func SelectProtoOrFail(proto string, rwc io.ReadWriteCloser) error {
err := handshake(rwc)
if err != nil {
return err
}
return trySelect(proto, rwc)
} | [
"func",
"SelectProtoOrFail",
"(",
"proto",
"string",
",",
"rwc",
"io",
".",
"ReadWriteCloser",
")",
"error",
"{",
"err",
":=",
"handshake",
"(",
"rwc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"trySelect",
... | // SelectProtoOrFail performs the initial multistream handshake
// to inform the muxer of the protocol that will be used to communicate
// on this ReadWriteCloser. It returns an error if, for example,
// the muxer does not know how to handle this protocol. | [
"SelectProtoOrFail",
"performs",
"the",
"initial",
"multistream",
"handshake",
"to",
"inform",
"the",
"muxer",
"of",
"the",
"protocol",
"that",
"will",
"be",
"used",
"to",
"communicate",
"on",
"this",
"ReadWriteCloser",
".",
"It",
"returns",
"an",
"error",
"if",... | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/client.go#L16-L23 |
132,477 | multiformats/go-multistream | client.go | SelectOneOf | func SelectOneOf(protos []string, rwc io.ReadWriteCloser) (string, error) {
err := handshake(rwc)
if err != nil {
return "", err
}
for _, p := range protos {
err := trySelect(p, rwc)
switch err {
case nil:
return p, nil
case ErrNotSupported:
default:
return "", err
}
}
return "", ErrNotSuppor... | go | func SelectOneOf(protos []string, rwc io.ReadWriteCloser) (string, error) {
err := handshake(rwc)
if err != nil {
return "", err
}
for _, p := range protos {
err := trySelect(p, rwc)
switch err {
case nil:
return p, nil
case ErrNotSupported:
default:
return "", err
}
}
return "", ErrNotSuppor... | [
"func",
"SelectOneOf",
"(",
"protos",
"[",
"]",
"string",
",",
"rwc",
"io",
".",
"ReadWriteCloser",
")",
"(",
"string",
",",
"error",
")",
"{",
"err",
":=",
"handshake",
"(",
"rwc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",... | // SelectOneOf will perform handshakes with the protocols on the given slice
// until it finds one which is supported by the muxer. | [
"SelectOneOf",
"will",
"perform",
"handshakes",
"with",
"the",
"protocols",
"on",
"the",
"given",
"slice",
"until",
"it",
"finds",
"one",
"which",
"is",
"supported",
"by",
"the",
"muxer",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/client.go#L27-L44 |
132,478 | multiformats/go-multistream | lazyClient.go | NewMSSelect | func NewMSSelect(c io.ReadWriteCloser, proto string) Multistream {
return &lazyClientConn{
protos: []string{ProtocolID, proto},
con: c,
}
} | go | func NewMSSelect(c io.ReadWriteCloser, proto string) Multistream {
return &lazyClientConn{
protos: []string{ProtocolID, proto},
con: c,
}
} | [
"func",
"NewMSSelect",
"(",
"c",
"io",
".",
"ReadWriteCloser",
",",
"proto",
"string",
")",
"Multistream",
"{",
"return",
"&",
"lazyClientConn",
"{",
"protos",
":",
"[",
"]",
"string",
"{",
"ProtocolID",
",",
"proto",
"}",
",",
"con",
":",
"c",
",",
"}... | // NewMSSelect returns a new Multistream which is able to perform
// protocol selection with a MultistreamMuxer. | [
"NewMSSelect",
"returns",
"a",
"new",
"Multistream",
"which",
"is",
"able",
"to",
"perform",
"protocol",
"selection",
"with",
"a",
"MultistreamMuxer",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/lazyClient.go#L19-L24 |
132,479 | multiformats/go-multistream | lazyClient.go | NewMultistream | func NewMultistream(c io.ReadWriteCloser, proto string) Multistream {
return &lazyClientConn{
protos: []string{proto},
con: c,
}
} | go | func NewMultistream(c io.ReadWriteCloser, proto string) Multistream {
return &lazyClientConn{
protos: []string{proto},
con: c,
}
} | [
"func",
"NewMultistream",
"(",
"c",
"io",
".",
"ReadWriteCloser",
",",
"proto",
"string",
")",
"Multistream",
"{",
"return",
"&",
"lazyClientConn",
"{",
"protos",
":",
"[",
"]",
"string",
"{",
"proto",
"}",
",",
"con",
":",
"c",
",",
"}",
"\n",
"}"
] | // NewMultistream returns a multistream for the given protocol. This will not
// perform any protocol selection. If you are using a MultistreamMuxer, use
// NewMSSelect. | [
"NewMultistream",
"returns",
"a",
"multistream",
"for",
"the",
"given",
"protocol",
".",
"This",
"will",
"not",
"perform",
"any",
"protocol",
"selection",
".",
"If",
"you",
"are",
"using",
"a",
"MultistreamMuxer",
"use",
"NewMSSelect",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/lazyClient.go#L29-L34 |
132,480 | multiformats/go-multistream | lazyClient.go | Read | func (l *lazyClientConn) Read(b []byte) (int, error) {
l.rhandshakeOnce.Do(func() {
go l.whandshakeOnce.Do(l.doWriteHandshake)
l.doReadHandshake()
})
if l.rerr != nil {
return 0, l.rerr
}
if len(b) == 0 {
return 0, nil
}
return l.con.Read(b)
} | go | func (l *lazyClientConn) Read(b []byte) (int, error) {
l.rhandshakeOnce.Do(func() {
go l.whandshakeOnce.Do(l.doWriteHandshake)
l.doReadHandshake()
})
if l.rerr != nil {
return 0, l.rerr
}
if len(b) == 0 {
return 0, nil
}
return l.con.Read(b)
} | [
"func",
"(",
"l",
"*",
"lazyClientConn",
")",
"Read",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"l",
".",
"rhandshakeOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"go",
"l",
".",
"whandshakeOnce",
".",
"Do",
"(",
"l",... | // Read reads data from the io.ReadWriteCloser.
//
// If the protocol hasn't yet been negotiated, this method triggers the write
// half of the handshake and then waits for the read half to complete.
//
// It returns an error if the read half of the handshake fails. | [
"Read",
"reads",
"data",
"from",
"the",
"io",
".",
"ReadWriteCloser",
".",
"If",
"the",
"protocol",
"hasn",
"t",
"yet",
"been",
"negotiated",
"this",
"method",
"triggers",
"the",
"write",
"half",
"of",
"the",
"handshake",
"and",
"then",
"waits",
"for",
"th... | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/lazyClient.go#L64-L77 |
132,481 | multiformats/go-multistream | multistream.go | Ls | func Ls(rw io.ReadWriter) ([]string, error) {
err := delimWriteBuffered(rw, []byte("ls"))
if err != nil {
return nil, err
}
n, err := binary.ReadUvarint(&byteReader{rw})
if err != nil {
return nil, err
}
var out []string
for i := uint64(0); i < n; i++ {
val, err := lpReadBuf(rw)
if err != nil {
ret... | go | func Ls(rw io.ReadWriter) ([]string, error) {
err := delimWriteBuffered(rw, []byte("ls"))
if err != nil {
return nil, err
}
n, err := binary.ReadUvarint(&byteReader{rw})
if err != nil {
return nil, err
}
var out []string
for i := uint64(0); i < n; i++ {
val, err := lpReadBuf(rw)
if err != nil {
ret... | [
"func",
"Ls",
"(",
"rw",
"io",
".",
"ReadWriter",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"err",
":=",
"delimWriteBuffered",
"(",
"rw",
",",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return... | // Ls is a Multistream muxer command which returns the list of handler names
// available on a muxer. | [
"Ls",
"is",
"a",
"Multistream",
"muxer",
"command",
"which",
"returns",
"the",
"list",
"of",
"handler",
"names",
"available",
"on",
"a",
"muxer",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/multistream.go#L87-L108 |
132,482 | multiformats/go-multistream | multistream.go | AddHandler | func (msm *MultistreamMuxer) AddHandler(protocol string, handler HandlerFunc) {
msm.AddHandlerWithFunc(protocol, fulltextMatch(protocol), handler)
} | go | func (msm *MultistreamMuxer) AddHandler(protocol string, handler HandlerFunc) {
msm.AddHandlerWithFunc(protocol, fulltextMatch(protocol), handler)
} | [
"func",
"(",
"msm",
"*",
"MultistreamMuxer",
")",
"AddHandler",
"(",
"protocol",
"string",
",",
"handler",
"HandlerFunc",
")",
"{",
"msm",
".",
"AddHandlerWithFunc",
"(",
"protocol",
",",
"fulltextMatch",
"(",
"protocol",
")",
",",
"handler",
")",
"\n",
"}"
... | // AddHandler attaches a new protocol handler to the muxer. | [
"AddHandler",
"attaches",
"a",
"new",
"protocol",
"handler",
"to",
"the",
"muxer",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/multistream.go#L117-L119 |
132,483 | multiformats/go-multistream | multistream.go | AddHandlerWithFunc | func (msm *MultistreamMuxer) AddHandlerWithFunc(protocol string, match func(string) bool, handler HandlerFunc) {
msm.handlerlock.Lock()
defer msm.handlerlock.Unlock()
msm.removeHandler(protocol)
msm.handlers = append(msm.handlers, Handler{
MatchFunc: match,
Handle: handler,
AddName: protocol,
})
} | go | func (msm *MultistreamMuxer) AddHandlerWithFunc(protocol string, match func(string) bool, handler HandlerFunc) {
msm.handlerlock.Lock()
defer msm.handlerlock.Unlock()
msm.removeHandler(protocol)
msm.handlers = append(msm.handlers, Handler{
MatchFunc: match,
Handle: handler,
AddName: protocol,
})
} | [
"func",
"(",
"msm",
"*",
"MultistreamMuxer",
")",
"AddHandlerWithFunc",
"(",
"protocol",
"string",
",",
"match",
"func",
"(",
"string",
")",
"bool",
",",
"handler",
"HandlerFunc",
")",
"{",
"msm",
".",
"handlerlock",
".",
"Lock",
"(",
")",
"\n",
"defer",
... | // AddHandlerWithFunc attaches a new protocol handler to the muxer with a match.
// If the match function returns true for a given protocol tag, the protocol
// will be selected even if the handler name and protocol tags are different. | [
"AddHandlerWithFunc",
"attaches",
"a",
"new",
"protocol",
"handler",
"to",
"the",
"muxer",
"with",
"a",
"match",
".",
"If",
"the",
"match",
"function",
"returns",
"true",
"for",
"a",
"given",
"protocol",
"tag",
"the",
"protocol",
"will",
"be",
"selected",
"e... | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/multistream.go#L124-L134 |
132,484 | multiformats/go-multistream | multistream.go | RemoveHandler | func (msm *MultistreamMuxer) RemoveHandler(protocol string) {
msm.handlerlock.Lock()
defer msm.handlerlock.Unlock()
msm.removeHandler(protocol)
} | go | func (msm *MultistreamMuxer) RemoveHandler(protocol string) {
msm.handlerlock.Lock()
defer msm.handlerlock.Unlock()
msm.removeHandler(protocol)
} | [
"func",
"(",
"msm",
"*",
"MultistreamMuxer",
")",
"RemoveHandler",
"(",
"protocol",
"string",
")",
"{",
"msm",
".",
"handlerlock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"msm",
".",
"handlerlock",
".",
"Unlock",
"(",
")",
"\n\n",
"msm",
".",
"removeHandle... | // RemoveHandler removes the handler with the given name from the muxer. | [
"RemoveHandler",
"removes",
"the",
"handler",
"with",
"the",
"given",
"name",
"from",
"the",
"muxer",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/multistream.go#L137-L142 |
132,485 | multiformats/go-multistream | multistream.go | Protocols | func (msm *MultistreamMuxer) Protocols() []string {
msm.handlerlock.RLock()
defer msm.handlerlock.RUnlock()
var out []string
for _, h := range msm.handlers {
out = append(out, h.AddName)
}
return out
} | go | func (msm *MultistreamMuxer) Protocols() []string {
msm.handlerlock.RLock()
defer msm.handlerlock.RUnlock()
var out []string
for _, h := range msm.handlers {
out = append(out, h.AddName)
}
return out
} | [
"func",
"(",
"msm",
"*",
"MultistreamMuxer",
")",
"Protocols",
"(",
")",
"[",
"]",
"string",
"{",
"msm",
".",
"handlerlock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"msm",
".",
"handlerlock",
".",
"RUnlock",
"(",
")",
"\n\n",
"var",
"out",
"[",
"]",
... | // Protocols returns the list of handler-names added to this this muxer. | [
"Protocols",
"returns",
"the",
"list",
"of",
"handler",
"-",
"names",
"added",
"to",
"this",
"this",
"muxer",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/multistream.go#L154-L164 |
132,486 | multiformats/go-multistream | multistream.go | NegotiateLazy | func (msm *MultistreamMuxer) NegotiateLazy(rwc io.ReadWriteCloser) (Multistream, string, HandlerFunc, error) {
pval := make(chan string, 1)
writeErr := make(chan error, 1)
defer close(pval)
lzc := &lazyServerConn{
con: rwc,
}
started := make(chan struct{})
go lzc.waitForHandshake.Do(func() {
close(started)... | go | func (msm *MultistreamMuxer) NegotiateLazy(rwc io.ReadWriteCloser) (Multistream, string, HandlerFunc, error) {
pval := make(chan string, 1)
writeErr := make(chan error, 1)
defer close(pval)
lzc := &lazyServerConn{
con: rwc,
}
started := make(chan struct{})
go lzc.waitForHandshake.Do(func() {
close(started)... | [
"func",
"(",
"msm",
"*",
"MultistreamMuxer",
")",
"NegotiateLazy",
"(",
"rwc",
"io",
".",
"ReadWriteCloser",
")",
"(",
"Multistream",
",",
"string",
",",
"HandlerFunc",
",",
"error",
")",
"{",
"pval",
":=",
"make",
"(",
"chan",
"string",
",",
"1",
")",
... | // NegotiateLazy performs protocol selection and returns
// a multistream, the protocol used, the handler and an error. It is lazy
// because the write-handshake is performed on a subroutine, allowing this
// to return before that handshake is completed. | [
"NegotiateLazy",
"performs",
"protocol",
"selection",
"and",
"returns",
"a",
"multistream",
"the",
"protocol",
"used",
"the",
"handler",
"and",
"an",
"error",
".",
"It",
"is",
"lazy",
"because",
"the",
"write",
"-",
"handshake",
"is",
"performed",
"on",
"a",
... | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/multistream.go#L187-L269 |
132,487 | multiformats/go-multistream | multistream.go | Ls | func (msm *MultistreamMuxer) Ls(w io.Writer) error {
buf := new(bytes.Buffer)
msm.handlerlock.RLock()
err := writeUvarint(buf, uint64(len(msm.handlers)))
if err != nil {
return err
}
for _, h := range msm.handlers {
err := delimWrite(buf, []byte(h.AddName))
if err != nil {
msm.handlerlock.RUnlock()
... | go | func (msm *MultistreamMuxer) Ls(w io.Writer) error {
buf := new(bytes.Buffer)
msm.handlerlock.RLock()
err := writeUvarint(buf, uint64(len(msm.handlers)))
if err != nil {
return err
}
for _, h := range msm.handlers {
err := delimWrite(buf, []byte(h.AddName))
if err != nil {
msm.handlerlock.RUnlock()
... | [
"func",
"(",
"msm",
"*",
"MultistreamMuxer",
")",
"Ls",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"buf",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n\n",
"msm",
".",
"handlerlock",
".",
"RLock",
"(",
")",
"\n",
"err",
":=",
"writeUvar... | // Ls implements the "ls" command which writes the list of
// supported protocols to the given Writer. | [
"Ls",
"implements",
"the",
"ls",
"command",
"which",
"writes",
"the",
"list",
"of",
"supported",
"protocols",
"to",
"the",
"given",
"Writer",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/multistream.go#L328-L353 |
132,488 | multiformats/go-multistream | multistream.go | ReadNextToken | func ReadNextToken(rw io.ReadWriter) (string, error) {
tok, err := ReadNextTokenBytes(rw)
if err != nil {
return "", err
}
return string(tok), nil
} | go | func ReadNextToken(rw io.ReadWriter) (string, error) {
tok, err := ReadNextTokenBytes(rw)
if err != nil {
return "", err
}
return string(tok), nil
} | [
"func",
"ReadNextToken",
"(",
"rw",
"io",
".",
"ReadWriter",
")",
"(",
"string",
",",
"error",
")",
"{",
"tok",
",",
"err",
":=",
"ReadNextTokenBytes",
"(",
"rw",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}"... | // ReadNextToken extracts a token from a ReadWriter. It is used during
// protocol negotiation and returns a string. | [
"ReadNextToken",
"extracts",
"a",
"token",
"from",
"a",
"ReadWriter",
".",
"It",
"is",
"used",
"during",
"protocol",
"negotiation",
"and",
"returns",
"a",
"string",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/multistream.go#L368-L375 |
132,489 | multiformats/go-multistream | multistream.go | ReadNextTokenBytes | func ReadNextTokenBytes(rw io.ReadWriter) ([]byte, error) {
data, err := lpReadBuf(rw)
switch err {
case nil:
return data, nil
case ErrTooLarge:
err := delimWriteBuffered(rw, []byte("messages over 64k are not allowed"))
if err != nil {
return nil, err
}
return nil, ErrTooLarge
default:
return nil, e... | go | func ReadNextTokenBytes(rw io.ReadWriter) ([]byte, error) {
data, err := lpReadBuf(rw)
switch err {
case nil:
return data, nil
case ErrTooLarge:
err := delimWriteBuffered(rw, []byte("messages over 64k are not allowed"))
if err != nil {
return nil, err
}
return nil, ErrTooLarge
default:
return nil, e... | [
"func",
"ReadNextTokenBytes",
"(",
"rw",
"io",
".",
"ReadWriter",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"lpReadBuf",
"(",
"rw",
")",
"\n",
"switch",
"err",
"{",
"case",
"nil",
":",
"return",
"data",
",",
"nil... | // ReadNextTokenBytes extracts a token from a ReadWriter. It is used
// during protocol negotiation and returns a byte slice. | [
"ReadNextTokenBytes",
"extracts",
"a",
"token",
"from",
"a",
"ReadWriter",
".",
"It",
"is",
"used",
"during",
"protocol",
"negotiation",
"and",
"returns",
"a",
"byte",
"slice",
"."
] | 7fe63401b47b8ee414fc16619e08a6abc1c5cf2b | https://github.com/multiformats/go-multistream/blob/7fe63401b47b8ee414fc16619e08a6abc1c5cf2b/multistream.go#L379-L393 |
132,490 | kataras/go-template | loader.go | Directory | func (t *Loader) Directory(dir string, fileExtension string) *BinaryLoader {
if dir == "" {
dir = DefaultDirectory // the default templates dir
}
if fileExtension == "" {
fileExtension = DefaultExtension
} else if fileExtension[0] != '.' { // if missing the start dot
fileExtension = "." + fileExtension
}
t... | go | func (t *Loader) Directory(dir string, fileExtension string) *BinaryLoader {
if dir == "" {
dir = DefaultDirectory // the default templates dir
}
if fileExtension == "" {
fileExtension = DefaultExtension
} else if fileExtension[0] != '.' { // if missing the start dot
fileExtension = "." + fileExtension
}
t... | [
"func",
"(",
"t",
"*",
"Loader",
")",
"Directory",
"(",
"dir",
"string",
",",
"fileExtension",
"string",
")",
"*",
"BinaryLoader",
"{",
"if",
"dir",
"==",
"\"",
"\"",
"{",
"dir",
"=",
"DefaultDirectory",
"// the default templates dir",
"\n",
"}",
"\n",
"if... | // Directory sets the directory to load from
// returns the Binary location which is optional | [
"Directory",
"sets",
"the",
"directory",
"to",
"load",
"from",
"returns",
"the",
"Binary",
"location",
"which",
"is",
"optional"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/loader.go#L40-L54 |
132,491 | kataras/go-template | loader.go | Binary | func (t *BinaryLoader) Binary(assetFn func(name string) ([]byte, error), namesFn func() []string) {
if assetFn == nil || namesFn == nil {
return
}
t.AssetFn = assetFn
t.NamesFn = namesFn
// if extension is not static(setted by .Directory)
if t.Extension == "" {
if names := namesFn(); len(names) > 0 {
t.Ex... | go | func (t *BinaryLoader) Binary(assetFn func(name string) ([]byte, error), namesFn func() []string) {
if assetFn == nil || namesFn == nil {
return
}
t.AssetFn = assetFn
t.NamesFn = namesFn
// if extension is not static(setted by .Directory)
if t.Extension == "" {
if names := namesFn(); len(names) > 0 {
t.Ex... | [
"func",
"(",
"t",
"*",
"BinaryLoader",
")",
"Binary",
"(",
"assetFn",
"func",
"(",
"name",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
",",
"namesFn",
"func",
"(",
")",
"[",
"]",
"string",
")",
"{",
"if",
"assetFn",
"==",
"nil",
"||"... | // Binary optionally, called after Loader.Directory, used when files are distributed inside the app executable
// sets the AssetFn and NamesFn | [
"Binary",
"optionally",
"called",
"after",
"Loader",
".",
"Directory",
"used",
"when",
"files",
"are",
"distributed",
"inside",
"the",
"app",
"executable",
"sets",
"the",
"AssetFn",
"and",
"NamesFn"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/loader.go#L58-L71 |
132,492 | kataras/go-template | loader.go | IsBinary | func (t *Loader) IsBinary() bool {
return t.AssetFn != nil && t.NamesFn != nil
} | go | func (t *Loader) IsBinary() bool {
return t.AssetFn != nil && t.NamesFn != nil
} | [
"func",
"(",
"t",
"*",
"Loader",
")",
"IsBinary",
"(",
")",
"bool",
"{",
"return",
"t",
".",
"AssetFn",
"!=",
"nil",
"&&",
"t",
".",
"NamesFn",
"!=",
"nil",
"\n",
"}"
] | // IsBinary returns true if .Binary is called and AssetFn and NamesFn are setted | [
"IsBinary",
"returns",
"true",
"if",
".",
"Binary",
"is",
"called",
"and",
"AssetFn",
"and",
"NamesFn",
"are",
"setted"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/loader.go#L74-L76 |
132,493 | kataras/go-template | loader.go | LoadEngine | func (t *Loader) LoadEngine(e Engine) error {
if t.Dir == "" {
return errMissingDirectoryOrAssets
}
if t.IsBinary() {
// don't try to put abs path here
// fixes: http://support.iris-go.com/d/22-template-binary-problem-in-v6
return e.LoadAssets(t.Dir, t.Extension, t.AssetFn, t.NamesFn)
}
// fixes when use... | go | func (t *Loader) LoadEngine(e Engine) error {
if t.Dir == "" {
return errMissingDirectoryOrAssets
}
if t.IsBinary() {
// don't try to put abs path here
// fixes: http://support.iris-go.com/d/22-template-binary-problem-in-v6
return e.LoadAssets(t.Dir, t.Extension, t.AssetFn, t.NamesFn)
}
// fixes when use... | [
"func",
"(",
"t",
"*",
"Loader",
")",
"LoadEngine",
"(",
"e",
"Engine",
")",
"error",
"{",
"if",
"t",
".",
"Dir",
"==",
"\"",
"\"",
"{",
"return",
"errMissingDirectoryOrAssets",
"\n",
"}",
"\n\n",
"if",
"t",
".",
"IsBinary",
"(",
")",
"{",
"// don't ... | // LoadEngine receives a template Engine and calls its LoadAssets or the LoadDirectory with the loader's locations | [
"LoadEngine",
"receives",
"a",
"template",
"Engine",
"and",
"calls",
"its",
"LoadAssets",
"or",
"the",
"LoadDirectory",
"with",
"the",
"loader",
"s",
"locations"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/loader.go#L81-L100 |
132,494 | kataras/go-template | handlebars/handlebars.go | New | func New(cfg ...Config) *Engine {
c := DefaultConfig()
if len(cfg) > 0 {
c = cfg[0]
}
// cuz mergo has a little bug on maps
if c.Helpers == nil {
c.Helpers = make(map[string]interface{}, 0)
}
e := &Engine{Config: c, templateCache: make(map[string]*raymond.Template, 0)}
raymond.RegisterHelper("render", fu... | go | func New(cfg ...Config) *Engine {
c := DefaultConfig()
if len(cfg) > 0 {
c = cfg[0]
}
// cuz mergo has a little bug on maps
if c.Helpers == nil {
c.Helpers = make(map[string]interface{}, 0)
}
e := &Engine{Config: c, templateCache: make(map[string]*raymond.Template, 0)}
raymond.RegisterHelper("render", fu... | [
"func",
"New",
"(",
"cfg",
"...",
"Config",
")",
"*",
"Engine",
"{",
"c",
":=",
"DefaultConfig",
"(",
")",
"\n",
"if",
"len",
"(",
"cfg",
")",
">",
"0",
"{",
"c",
"=",
"cfg",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
"// cuz mergo has a little bug on maps",
... | // New creates and returns the Handlebars template engine | [
"New",
"creates",
"and",
"returns",
"the",
"Handlebars",
"template",
"engine"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/handlebars/handlebars.go#L31-L53 |
132,495 | kataras/go-template | handlebars/handlebars.go | LoadDirectory | func (e *Engine) LoadDirectory(dir string, extension string) error {
// register the global helpers on the first load
if len(e.templateCache) == 0 && e.Config.Helpers != nil {
raymond.RegisterHelpers(e.Config.Helpers)
}
// the render works like {{ render "myfile.html" theContext.PartialContext}}
// instead of... | go | func (e *Engine) LoadDirectory(dir string, extension string) error {
// register the global helpers on the first load
if len(e.templateCache) == 0 && e.Config.Helpers != nil {
raymond.RegisterHelpers(e.Config.Helpers)
}
// the render works like {{ render "myfile.html" theContext.PartialContext}}
// instead of... | [
"func",
"(",
"e",
"*",
"Engine",
")",
"LoadDirectory",
"(",
"dir",
"string",
",",
"extension",
"string",
")",
"error",
"{",
"// register the global helpers on the first load",
"if",
"len",
"(",
"e",
".",
"templateCache",
")",
"==",
"0",
"&&",
"e",
".",
"Conf... | // LoadDirectory builds the handlebars templates | [
"LoadDirectory",
"builds",
"the",
"handlebars",
"templates"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/handlebars/handlebars.go#L61-L107 |
132,496 | kataras/go-template | amber/amber.go | New | func New(cfg ...Config) *Engine {
c := DefaultConfig()
if len(cfg) > 0 {
c = cfg[0]
}
// cuz mergo has a little bug on maps
if c.Funcs == nil {
c.Funcs = make(map[string]interface{}, 0)
}
return &Engine{Config: c}
} | go | func New(cfg ...Config) *Engine {
c := DefaultConfig()
if len(cfg) > 0 {
c = cfg[0]
}
// cuz mergo has a little bug on maps
if c.Funcs == nil {
c.Funcs = make(map[string]interface{}, 0)
}
return &Engine{Config: c}
} | [
"func",
"New",
"(",
"cfg",
"...",
"Config",
")",
"*",
"Engine",
"{",
"c",
":=",
"DefaultConfig",
"(",
")",
"\n",
"if",
"len",
"(",
"cfg",
")",
">",
"0",
"{",
"c",
"=",
"cfg",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
"// cuz mergo has a little bug on maps",
... | // New creates and returns a new amber engine | [
"New",
"creates",
"and",
"returns",
"a",
"new",
"amber",
"engine"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/amber/amber.go#L22-L34 |
132,497 | kataras/go-template | amber/amber.go | LoadDirectory | func (e *Engine) LoadDirectory(directory string, extension string) error {
opt := amber.DirOptions{}
opt.Recursive = true
// prepare the global amber funcs
funcs := template.FuncMap{}
for k, v := range amber.FuncMap { // add the amber's default funcs
funcs[k] = v
}
if e.Config.Funcs != nil { // add the conf... | go | func (e *Engine) LoadDirectory(directory string, extension string) error {
opt := amber.DirOptions{}
opt.Recursive = true
// prepare the global amber funcs
funcs := template.FuncMap{}
for k, v := range amber.FuncMap { // add the amber's default funcs
funcs[k] = v
}
if e.Config.Funcs != nil { // add the conf... | [
"func",
"(",
"e",
"*",
"Engine",
")",
"LoadDirectory",
"(",
"directory",
"string",
",",
"extension",
"string",
")",
"error",
"{",
"opt",
":=",
"amber",
".",
"DirOptions",
"{",
"}",
"\n",
"opt",
".",
"Recursive",
"=",
"true",
"\n\n",
"// prepare the global ... | // LoadDirectory builds the amber templates | [
"LoadDirectory",
"builds",
"the",
"amber",
"templates"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/amber/amber.go#L42-L75 |
132,498 | kataras/go-template | amber/amber.go | LoadAssets | func (e *Engine) LoadAssets(virtualDirectory string, virtualExtension string, assetFn func(name string) ([]byte, error), namesFn func() []string) error {
e.templateCache = make(map[string]*template.Template)
// prepare the global amber funcs
funcs := template.FuncMap{}
for k, v := range amber.FuncMap { // add the ... | go | func (e *Engine) LoadAssets(virtualDirectory string, virtualExtension string, assetFn func(name string) ([]byte, error), namesFn func() []string) error {
e.templateCache = make(map[string]*template.Template)
// prepare the global amber funcs
funcs := template.FuncMap{}
for k, v := range amber.FuncMap { // add the ... | [
"func",
"(",
"e",
"*",
"Engine",
")",
"LoadAssets",
"(",
"virtualDirectory",
"string",
",",
"virtualExtension",
"string",
",",
"assetFn",
"func",
"(",
"name",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
",",
"namesFn",
"func",
"(",
")",
"[... | // LoadAssets builds the templates from binary assets | [
"LoadAssets",
"builds",
"the",
"templates",
"from",
"binary",
"assets"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/amber/amber.go#L78-L136 |
132,499 | kataras/go-template | mux.go | LoadAll | func (entries Entries) LoadAll() error {
for i, n := 0, len(entries); i < n; i++ {
if err := entries[i].LoadEngine(); err != nil {
return err
}
}
return nil
} | go | func (entries Entries) LoadAll() error {
for i, n := 0, len(entries); i < n; i++ {
if err := entries[i].LoadEngine(); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"entries",
"Entries",
")",
"LoadAll",
"(",
")",
"error",
"{",
"for",
"i",
",",
"n",
":=",
"0",
",",
"len",
"(",
"entries",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"if",
"err",
":=",
"entries",
"[",
"i",
"]",
".",
"LoadEngin... | // LoadAll loads all template engines entries, returns the first error | [
"LoadAll",
"loads",
"all",
"template",
"engines",
"entries",
"returns",
"the",
"first",
"error"
] | a4a986b413e8d88ebd894b4a3e327314069f2439 | https://github.com/kataras/go-template/blob/a4a986b413e8d88ebd894b4a3e327314069f2439/mux.go#L50-L57 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.