id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
152,200 | fabiorphp/kongo | service.go | Update | func (s *ServicesService) Update(idOrName string, svc *Service) (*Service, *http.Response, error) {
return s.UpdateWithContext(context.TODO(), idOrName, svc)
} | go | func (s *ServicesService) Update(idOrName string, svc *Service) (*Service, *http.Response, error) {
return s.UpdateWithContext(context.TODO(), idOrName, svc)
} | [
"func",
"(",
"s",
"*",
"ServicesService",
")",
"Update",
"(",
"idOrName",
"string",
",",
"svc",
"*",
"Service",
")",
"(",
"*",
"Service",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"s",
".",
"UpdateWithContext",
"(",
"context"... | // Update updates a service | [
"Update",
"updates",
"a",
"service"
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/service.go#L289-L291 |
152,201 | fabiorphp/kongo | service.go | UpdateByURL | func (s *ServicesService) UpdateByURL(idOrName string, svc *Service) (*Service, *http.Response, error) {
return s.UpdateByURLWithContext(context.TODO(), idOrName, svc)
} | go | func (s *ServicesService) UpdateByURL(idOrName string, svc *Service) (*Service, *http.Response, error) {
return s.UpdateByURLWithContext(context.TODO(), idOrName, svc)
} | [
"func",
"(",
"s",
"*",
"ServicesService",
")",
"UpdateByURL",
"(",
"idOrName",
"string",
",",
"svc",
"*",
"Service",
")",
"(",
"*",
"Service",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"s",
".",
"UpdateByURLWithContext",
"(",
... | // UpdateByURL updates a service registred by URL and pass the ID or Name | [
"UpdateByURL",
"updates",
"a",
"service",
"registred",
"by",
"URL",
"and",
"pass",
"the",
"ID",
"or",
"Name"
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/service.go#L299-L301 |
152,202 | imdario/medeina | switch.go | ServeHTTP | func (hs HostSwitch) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Check if a http.Handler is registered for the given host.
// If yes, use it to handle the request.
if handler := hs[r.Host]; handler != nil {
handler.ServeHTTP(w, r)
} else {
// Handle host names for wich no handler is registered
http.Error(w, "Forbidden", 403) // Or Redirect?
}
} | go | func (hs HostSwitch) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Check if a http.Handler is registered for the given host.
// If yes, use it to handle the request.
if handler := hs[r.Host]; handler != nil {
handler.ServeHTTP(w, r)
} else {
// Handle host names for wich no handler is registered
http.Error(w, "Forbidden", 403) // Or Redirect?
}
} | [
"func",
"(",
"hs",
"HostSwitch",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"// Check if a http.Handler is registered for the given host.",
"// If yes, use it to handle the request.",
"if",
"handler",
":="... | // Implement the ServerHTTP method on our new type | [
"Implement",
"the",
"ServerHTTP",
"method",
"on",
"our",
"new",
"type"
] | 642dbf2de43f87904dc463498bf3bacb0c493b9f | https://github.com/imdario/medeina/blob/642dbf2de43f87904dc463498bf3bacb0c493b9f/switch.go#L15-L24 |
152,203 | fabiorphp/kongo | customer.go | CreateWithContext | func (c *CustomersService) CreateWithContext(ctx context.Context, customer *Customer) (*Customer, *http.Response, error) {
resource, _ := url.Parse(customersResourcePath)
req, err := c.client.NewRequest(ctx, http.MethodPost, resource, customer)
if err != nil {
return nil, nil, err
}
root := new(Customer)
res, err := c.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root, res, nil
} | go | func (c *CustomersService) CreateWithContext(ctx context.Context, customer *Customer) (*Customer, *http.Response, error) {
resource, _ := url.Parse(customersResourcePath)
req, err := c.client.NewRequest(ctx, http.MethodPost, resource, customer)
if err != nil {
return nil, nil, err
}
root := new(Customer)
res, err := c.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root, res, nil
} | [
"func",
"(",
"c",
"*",
"CustomersService",
")",
"CreateWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"customer",
"*",
"Customer",
")",
"(",
"*",
"Customer",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"resource",
",",
"_",
":... | // CreateWithContext creates a new customer. | [
"CreateWithContext",
"creates",
"a",
"new",
"customer",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/customer.go#L96-L114 |
152,204 | fabiorphp/kongo | customer.go | Create | func (c *CustomersService) Create(customer *Customer) (*Customer, *http.Response, error) {
return c.CreateWithContext(context.TODO(), customer)
} | go | func (c *CustomersService) Create(customer *Customer) (*Customer, *http.Response, error) {
return c.CreateWithContext(context.TODO(), customer)
} | [
"func",
"(",
"c",
"*",
"CustomersService",
")",
"Create",
"(",
"customer",
"*",
"Customer",
")",
"(",
"*",
"Customer",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"c",
".",
"CreateWithContext",
"(",
"context",
".",
"TODO",
"(",... | // Create creates a new customer. | [
"Create",
"creates",
"a",
"new",
"customer",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/customer.go#L117-L119 |
152,205 | fabiorphp/kongo | customer.go | DeleteWithContext | func (c *CustomersService) DeleteWithContext(ctx context.Context, idOrUsername string) (*http.Response, error) {
resource, _ := url.Parse(customersResourcePath)
resource.Path = path.Join(resource.Path, idOrUsername)
req, err := c.client.NewRequest(ctx, http.MethodDelete, resource, nil)
if err != nil {
return nil, err
}
return c.client.Do(req, nil)
} | go | func (c *CustomersService) DeleteWithContext(ctx context.Context, idOrUsername string) (*http.Response, error) {
resource, _ := url.Parse(customersResourcePath)
resource.Path = path.Join(resource.Path, idOrUsername)
req, err := c.client.NewRequest(ctx, http.MethodDelete, resource, nil)
if err != nil {
return nil, err
}
return c.client.Do(req, nil)
} | [
"func",
"(",
"c",
"*",
"CustomersService",
")",
"DeleteWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"idOrUsername",
"string",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"resource",
",",
"_",
":=",
"url",
".",
"Parse",
... | // DeleteWithContext retrieves registered customer by ID or Username. | [
"DeleteWithContext",
"retrieves",
"registered",
"customer",
"by",
"ID",
"or",
"Username",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/customer.go#L122-L133 |
152,206 | fabiorphp/kongo | customer.go | Delete | func (c *CustomersService) Delete(idOrUsername string) (*http.Response, error) {
return c.DeleteWithContext(context.TODO(), idOrUsername)
} | go | func (c *CustomersService) Delete(idOrUsername string) (*http.Response, error) {
return c.DeleteWithContext(context.TODO(), idOrUsername)
} | [
"func",
"(",
"c",
"*",
"CustomersService",
")",
"Delete",
"(",
"idOrUsername",
"string",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"c",
".",
"DeleteWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"idOrUsername",
... | // Delete retrieves registered customer by ID or Username. | [
"Delete",
"retrieves",
"registered",
"customer",
"by",
"ID",
"or",
"Username",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/customer.go#L136-L138 |
152,207 | fabiorphp/kongo | customer.go | Get | func (c *CustomersService) Get(idOrUsername string) (*Customer, *http.Response, error) {
return c.GetWithContext(context.TODO(), idOrUsername)
} | go | func (c *CustomersService) Get(idOrUsername string) (*Customer, *http.Response, error) {
return c.GetWithContext(context.TODO(), idOrUsername)
} | [
"func",
"(",
"c",
"*",
"CustomersService",
")",
"Get",
"(",
"idOrUsername",
"string",
")",
"(",
"*",
"Customer",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
"... | // Get retrieves registered customer by ID or Username. | [
"Get",
"retrieves",
"registered",
"customer",
"by",
"ID",
"or",
"Username",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/customer.go#L163-L165 |
152,208 | fabiorphp/kongo | customer.go | ListWithContext | func (c *CustomersService) ListWithContext(ctx context.Context, options *ListCustomersOptions) ([]*Customer, *http.Response, error) {
opts, _ := query.Values(options)
resource, _ := url.Parse(customersResourcePath)
resource.RawQuery = opts.Encode()
req, err := c.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
root := new(CustomersRoot)
res, err := c.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root.Customers, res, nil
} | go | func (c *CustomersService) ListWithContext(ctx context.Context, options *ListCustomersOptions) ([]*Customer, *http.Response, error) {
opts, _ := query.Values(options)
resource, _ := url.Parse(customersResourcePath)
resource.RawQuery = opts.Encode()
req, err := c.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
root := new(CustomersRoot)
res, err := c.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root.Customers, res, nil
} | [
"func",
"(",
"c",
"*",
"CustomersService",
")",
"ListWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"options",
"*",
"ListCustomersOptions",
")",
"(",
"[",
"]",
"*",
"Customer",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"opts",... | // ListWithContext retrieves a list of registered customers. | [
"ListWithContext",
"retrieves",
"a",
"list",
"of",
"registered",
"customers",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/customer.go#L168-L188 |
152,209 | fabiorphp/kongo | customer.go | List | func (c *CustomersService) List(options *ListCustomersOptions) ([]*Customer, *http.Response, error) {
return c.ListWithContext(context.TODO(), options)
} | go | func (c *CustomersService) List(options *ListCustomersOptions) ([]*Customer, *http.Response, error) {
return c.ListWithContext(context.TODO(), options)
} | [
"func",
"(",
"c",
"*",
"CustomersService",
")",
"List",
"(",
"options",
"*",
"ListCustomersOptions",
")",
"(",
"[",
"]",
"*",
"Customer",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListWithContext",
"(",
"context",
... | // List retrieves a list of registered customers. | [
"List",
"retrieves",
"a",
"list",
"of",
"registered",
"customers",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/customer.go#L191-L193 |
152,210 | fabiorphp/kongo | customer.go | UpdateWithContext | func (c *CustomersService) UpdateWithContext(ctx context.Context, idOrUsername string, customer *Customer) (*Customer, *http.Response, error) {
resource, _ := url.Parse(customersResourcePath)
resource.Path = path.Join(resource.Path, idOrUsername)
req, err := c.client.NewRequest(ctx, http.MethodPatch, resource, customer)
if err != nil {
return nil, nil, err
}
root := new(Customer)
res, err := c.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root, res, nil
} | go | func (c *CustomersService) UpdateWithContext(ctx context.Context, idOrUsername string, customer *Customer) (*Customer, *http.Response, error) {
resource, _ := url.Parse(customersResourcePath)
resource.Path = path.Join(resource.Path, idOrUsername)
req, err := c.client.NewRequest(ctx, http.MethodPatch, resource, customer)
if err != nil {
return nil, nil, err
}
root := new(Customer)
res, err := c.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root, res, nil
} | [
"func",
"(",
"c",
"*",
"CustomersService",
")",
"UpdateWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"idOrUsername",
"string",
",",
"customer",
"*",
"Customer",
")",
"(",
"*",
"Customer",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
... | // UpdateWithContext updates a customer registered by ID or Username. | [
"UpdateWithContext",
"updates",
"a",
"customer",
"registered",
"by",
"ID",
"or",
"Username",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/customer.go#L196-L215 |
152,211 | fabiorphp/kongo | customer.go | Update | func (c *CustomersService) Update(idOrUsername string, customer *Customer) (*Customer, *http.Response, error) {
return c.UpdateWithContext(context.TODO(), idOrUsername, customer)
} | go | func (c *CustomersService) Update(idOrUsername string, customer *Customer) (*Customer, *http.Response, error) {
return c.UpdateWithContext(context.TODO(), idOrUsername, customer)
} | [
"func",
"(",
"c",
"*",
"CustomersService",
")",
"Update",
"(",
"idOrUsername",
"string",
",",
"customer",
"*",
"Customer",
")",
"(",
"*",
"Customer",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"c",
".",
"UpdateWithContext",
"(",... | // Update updates a customer registered by ID or Username. | [
"Update",
"updates",
"a",
"customer",
"registered",
"by",
"ID",
"or",
"Username",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/customer.go#L218-L220 |
152,212 | fabiorphp/kongo | route.go | CreateWithContext | func (r *RoutesService) CreateWithContext(ctx context.Context, route *Route) (*Route, *http.Response, error) {
resource, _ := url.Parse(routesResourcePath)
req, err := r.client.NewRequest(ctx, http.MethodPost, resource, route)
if err != nil {
return nil, nil, err
}
root := new(Route)
res, err := r.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root, res, nil
} | go | func (r *RoutesService) CreateWithContext(ctx context.Context, route *Route) (*Route, *http.Response, error) {
resource, _ := url.Parse(routesResourcePath)
req, err := r.client.NewRequest(ctx, http.MethodPost, resource, route)
if err != nil {
return nil, nil, err
}
root := new(Route)
res, err := r.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root, res, nil
} | [
"func",
"(",
"r",
"*",
"RoutesService",
")",
"CreateWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"route",
"*",
"Route",
")",
"(",
"*",
"Route",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"resource",
",",
"_",
":=",
"url",... | // CreateWithContext creates a new route. | [
"CreateWithContext",
"creates",
"a",
"new",
"route",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/route.go#L111-L129 |
152,213 | fabiorphp/kongo | route.go | Create | func (r *RoutesService) Create(route *Route) (*Route, *http.Response, error) {
return r.CreateWithContext(context.TODO(), route)
} | go | func (r *RoutesService) Create(route *Route) (*Route, *http.Response, error) {
return r.CreateWithContext(context.TODO(), route)
} | [
"func",
"(",
"r",
"*",
"RoutesService",
")",
"Create",
"(",
"route",
"*",
"Route",
")",
"(",
"*",
"Route",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"r",
".",
"CreateWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
",... | // Create creates a new route. | [
"Create",
"creates",
"a",
"new",
"route",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/route.go#L132-L134 |
152,214 | fabiorphp/kongo | route.go | DeleteWithContext | func (r *RoutesService) DeleteWithContext(ctx context.Context, id string) (*http.Response, error) {
resource, _ := url.Parse(routesResourcePath)
resource.Path = path.Join(resource.Path, id)
req, err := r.client.NewRequest(ctx, http.MethodDelete, resource, nil)
if err != nil {
return nil, err
}
return r.client.Do(req, nil)
} | go | func (r *RoutesService) DeleteWithContext(ctx context.Context, id string) (*http.Response, error) {
resource, _ := url.Parse(routesResourcePath)
resource.Path = path.Join(resource.Path, id)
req, err := r.client.NewRequest(ctx, http.MethodDelete, resource, nil)
if err != nil {
return nil, err
}
return r.client.Do(req, nil)
} | [
"func",
"(",
"r",
"*",
"RoutesService",
")",
"DeleteWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"resource",
",",
"_",
":=",
"url",
".",
"Parse",
"(",
"route... | // DeleteWithContext retrieves registered route by ID. | [
"DeleteWithContext",
"retrieves",
"registered",
"route",
"by",
"ID",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/route.go#L137-L148 |
152,215 | fabiorphp/kongo | route.go | Delete | func (r *RoutesService) Delete(id string) (*http.Response, error) {
return r.DeleteWithContext(context.TODO(), id)
} | go | func (r *RoutesService) Delete(id string) (*http.Response, error) {
return r.DeleteWithContext(context.TODO(), id)
} | [
"func",
"(",
"r",
"*",
"RoutesService",
")",
"Delete",
"(",
"id",
"string",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"r",
".",
"DeleteWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"id",
")",
"\n",
"}"
] | // Delete retrieves registered route by ID or Name. | [
"Delete",
"retrieves",
"registered",
"route",
"by",
"ID",
"or",
"Name",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/route.go#L151-L153 |
152,216 | fabiorphp/kongo | route.go | GetWithContext | func (r *RoutesService) GetWithContext(ctx context.Context, id string) (*Route, *http.Response, error) {
resource, _ := url.Parse(routesResourcePath)
resource.Path = path.Join(resource.Path, id)
req, err := r.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
route := new(Route)
res, err := r.client.Do(req, route)
if err != nil {
return nil, res, err
}
return route, res, nil
} | go | func (r *RoutesService) GetWithContext(ctx context.Context, id string) (*Route, *http.Response, error) {
resource, _ := url.Parse(routesResourcePath)
resource.Path = path.Join(resource.Path, id)
req, err := r.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
route := new(Route)
res, err := r.client.Do(req, route)
if err != nil {
return nil, res, err
}
return route, res, nil
} | [
"func",
"(",
"r",
"*",
"RoutesService",
")",
"GetWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"(",
"*",
"Route",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"resource",
",",
"_",
":=",
"url",
".",
"P... | // GetWithContext retrieves registered route by ID. | [
"GetWithContext",
"retrieves",
"registered",
"route",
"by",
"ID",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/route.go#L156-L175 |
152,217 | fabiorphp/kongo | route.go | Get | func (r *RoutesService) Get(id string) (*Route, *http.Response, error) {
return r.GetWithContext(context.TODO(), id)
} | go | func (r *RoutesService) Get(id string) (*Route, *http.Response, error) {
return r.GetWithContext(context.TODO(), id)
} | [
"func",
"(",
"r",
"*",
"RoutesService",
")",
"Get",
"(",
"id",
"string",
")",
"(",
"*",
"Route",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"r",
".",
"GetWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"id",
")... | // Get retrieves registered route by ID. | [
"Get",
"retrieves",
"registered",
"route",
"by",
"ID",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/route.go#L178-L180 |
152,218 | fabiorphp/kongo | route.go | ListWithContext | func (r *RoutesService) ListWithContext(ctx context.Context, options *ListRoutesOptions) ([]*Route, *http.Response, error) {
opts, _ := query.Values(options)
resource, _ := url.Parse(routesResourcePath)
resource.RawQuery = opts.Encode()
req, err := r.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
root := new(RoutesRoot)
res, err := r.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root.Routes, res, nil
} | go | func (r *RoutesService) ListWithContext(ctx context.Context, options *ListRoutesOptions) ([]*Route, *http.Response, error) {
opts, _ := query.Values(options)
resource, _ := url.Parse(routesResourcePath)
resource.RawQuery = opts.Encode()
req, err := r.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
root := new(RoutesRoot)
res, err := r.client.Do(req, root)
if err != nil {
return nil, res, err
}
return root.Routes, res, nil
} | [
"func",
"(",
"r",
"*",
"RoutesService",
")",
"ListWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"options",
"*",
"ListRoutesOptions",
")",
"(",
"[",
"]",
"*",
"Route",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"opts",
",",
... | // ListWithContext retrieves a list of registered routes. | [
"ListWithContext",
"retrieves",
"a",
"list",
"of",
"registered",
"routes",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/route.go#L183-L203 |
152,219 | fabiorphp/kongo | route.go | List | func (r *RoutesService) List(options *ListRoutesOptions) ([]*Route, *http.Response, error) {
return r.ListWithContext(context.TODO(), options)
} | go | func (r *RoutesService) List(options *ListRoutesOptions) ([]*Route, *http.Response, error) {
return r.ListWithContext(context.TODO(), options)
} | [
"func",
"(",
"r",
"*",
"RoutesService",
")",
"List",
"(",
"options",
"*",
"ListRoutesOptions",
")",
"(",
"[",
"]",
"*",
"Route",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"r",
".",
"ListWithContext",
"(",
"context",
".",
"T... | // List retrieves a list of registered routes. | [
"List",
"retrieves",
"a",
"list",
"of",
"registered",
"routes",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/route.go#L206-L208 |
152,220 | fabiorphp/kongo | route.go | Update | func (r *RoutesService) Update(id string, route *Route) (*Route, *http.Response, error) {
return r.UpdateWithContext(context.TODO(), id, route)
} | go | func (r *RoutesService) Update(id string, route *Route) (*Route, *http.Response, error) {
return r.UpdateWithContext(context.TODO(), id, route)
} | [
"func",
"(",
"r",
"*",
"RoutesService",
")",
"Update",
"(",
"id",
"string",
",",
"route",
"*",
"Route",
")",
"(",
"*",
"Route",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"r",
".",
"UpdateWithContext",
"(",
"context",
".",
... | // Update updates a route. | [
"Update",
"updates",
"a",
"route",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/route.go#L233-L235 |
152,221 | fabiorphp/kongo | kongo.go | NewClient | func NewClient(client *http.Client, baseURL *url.URL) (*Kongo, error) {
if client == nil {
client = http.DefaultClient
}
if baseURL == nil {
return nil, errors.New("Empty URL is not allowed")
}
k := &Kongo{client: client, BaseURL: baseURL, UserAgent: userAgent}
k.Node = &NodeService{k}
k.Services = &ServicesService{k}
k.Routes = &RoutesService{k}
k.Customers = &CustomersService{k}
return k, nil
} | go | func NewClient(client *http.Client, baseURL *url.URL) (*Kongo, error) {
if client == nil {
client = http.DefaultClient
}
if baseURL == nil {
return nil, errors.New("Empty URL is not allowed")
}
k := &Kongo{client: client, BaseURL: baseURL, UserAgent: userAgent}
k.Node = &NodeService{k}
k.Services = &ServicesService{k}
k.Routes = &RoutesService{k}
k.Customers = &CustomersService{k}
return k, nil
} | [
"func",
"NewClient",
"(",
"client",
"*",
"http",
".",
"Client",
",",
"baseURL",
"*",
"url",
".",
"URL",
")",
"(",
"*",
"Kongo",
",",
"error",
")",
"{",
"if",
"client",
"==",
"nil",
"{",
"client",
"=",
"http",
".",
"DefaultClient",
"\n",
"}",
"\n\n"... | // NewClient returns a new Kongo API client. | [
"NewClient",
"returns",
"a",
"new",
"Kongo",
"API",
"client",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/kongo.go#L65-L81 |
152,222 | fabiorphp/kongo | kongo.go | New | func New(client *http.Client, baseURL string) (*Kongo, error) {
if baseURL == "" {
return nil, errors.New("Empty URL is not allowed")
}
parsedURL, err := url.Parse(baseURL)
if err != nil {
return nil, err
}
return NewClient(client, parsedURL)
} | go | func New(client *http.Client, baseURL string) (*Kongo, error) {
if baseURL == "" {
return nil, errors.New("Empty URL is not allowed")
}
parsedURL, err := url.Parse(baseURL)
if err != nil {
return nil, err
}
return NewClient(client, parsedURL)
} | [
"func",
"New",
"(",
"client",
"*",
"http",
".",
"Client",
",",
"baseURL",
"string",
")",
"(",
"*",
"Kongo",
",",
"error",
")",
"{",
"if",
"baseURL",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
... | // New returns a new Kongo API client. | [
"New",
"returns",
"a",
"new",
"Kongo",
"API",
"client",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/kongo.go#L84-L96 |
152,223 | fabiorphp/kongo | kongo.go | NewRequest | func (k *Kongo) NewRequest(ctx context.Context, method string, res *url.URL, body interface{}) (*http.Request, error) {
url := k.BaseURL.ResolveReference(res)
buf := new(bytes.Buffer)
if body != nil {
err := json.NewEncoder(buf).Encode(body)
if err != nil {
return nil, err
}
}
req, err := http.NewRequest(method, url.String(), buf)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
req.Header.Add("Content-Type", mediaType)
req.Header.Add("Accept", mediaType)
req.Header.Add("User-Agent", userAgent)
return req, nil
} | go | func (k *Kongo) NewRequest(ctx context.Context, method string, res *url.URL, body interface{}) (*http.Request, error) {
url := k.BaseURL.ResolveReference(res)
buf := new(bytes.Buffer)
if body != nil {
err := json.NewEncoder(buf).Encode(body)
if err != nil {
return nil, err
}
}
req, err := http.NewRequest(method, url.String(), buf)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
req.Header.Add("Content-Type", mediaType)
req.Header.Add("Accept", mediaType)
req.Header.Add("User-Agent", userAgent)
return req, nil
} | [
"func",
"(",
"k",
"*",
"Kongo",
")",
"NewRequest",
"(",
"ctx",
"context",
".",
"Context",
",",
"method",
"string",
",",
"res",
"*",
"url",
".",
"URL",
",",
"body",
"interface",
"{",
"}",
")",
"(",
"*",
"http",
".",
"Request",
",",
"error",
")",
"... | // NewRequest creates an API requrest. A relative URL can be provided in res URL instance. If specified, the
// value pointed to by body JSON encoded and included in as the request body. | [
"NewRequest",
"creates",
"an",
"API",
"requrest",
".",
"A",
"relative",
"URL",
"can",
"be",
"provided",
"in",
"res",
"URL",
"instance",
".",
"If",
"specified",
"the",
"value",
"pointed",
"to",
"by",
"body",
"JSON",
"encoded",
"and",
"included",
"in",
"as",... | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/kongo.go#L100-L125 |
152,224 | fabiorphp/kongo | kongo.go | Do | func (k *Kongo) Do(req *http.Request, value interface{}) (*http.Response, error) {
res, err := k.client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
err = k.checkResponse(res)
if err != nil {
return res, err
}
if value == nil {
return res, nil
}
err = json.NewDecoder(res.Body).Decode(value)
if err != nil {
return nil, err
}
return res, nil
} | go | func (k *Kongo) Do(req *http.Request, value interface{}) (*http.Response, error) {
res, err := k.client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
err = k.checkResponse(res)
if err != nil {
return res, err
}
if value == nil {
return res, nil
}
err = json.NewDecoder(res.Body).Decode(value)
if err != nil {
return nil, err
}
return res, nil
} | [
"func",
"(",
"k",
"*",
"Kongo",
")",
"Do",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"k",
".",
"client",
".",
"Do",
"... | // Do sends an API request and returns the API response. If the HTTP response is in the 2xx range,
// unmarshal the response body into value. | [
"Do",
"sends",
"an",
"API",
"request",
"and",
"returns",
"the",
"API",
"response",
".",
"If",
"the",
"HTTP",
"response",
"is",
"in",
"the",
"2xx",
"range",
"unmarshal",
"the",
"response",
"body",
"into",
"value",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/kongo.go#L129-L155 |
152,225 | fabiorphp/kongo | kongo.go | checkResponse | func (k *Kongo) checkResponse(res *http.Response) error {
if c := res.StatusCode; c >= 200 && c <= 299 {
return nil
}
errorResponse := &ErrorResponse{Response: res}
data, err := ioutil.ReadAll(res.Body)
if err != nil {
return errorResponse
}
if len(data) == 0 {
return errorResponse
}
err = json.Unmarshal(data, errorResponse)
if err != nil {
errorResponse.Message = string(data)
}
return errorResponse
} | go | func (k *Kongo) checkResponse(res *http.Response) error {
if c := res.StatusCode; c >= 200 && c <= 299 {
return nil
}
errorResponse := &ErrorResponse{Response: res}
data, err := ioutil.ReadAll(res.Body)
if err != nil {
return errorResponse
}
if len(data) == 0 {
return errorResponse
}
err = json.Unmarshal(data, errorResponse)
if err != nil {
errorResponse.Message = string(data)
}
return errorResponse
} | [
"func",
"(",
"k",
"*",
"Kongo",
")",
"checkResponse",
"(",
"res",
"*",
"http",
".",
"Response",
")",
"error",
"{",
"if",
"c",
":=",
"res",
".",
"StatusCode",
";",
"c",
">=",
"200",
"&&",
"c",
"<=",
"299",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
... | // checkResponse checks the API response for errors and returns them if present. | [
"checkResponse",
"checks",
"the",
"API",
"response",
"for",
"errors",
"and",
"returns",
"them",
"if",
"present",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/kongo.go#L158-L182 |
152,226 | fabiorphp/kongo | kongo.go | Error | func (e *ErrorResponse) Error() string {
if e.Message == "" {
e.Message = "Request error"
}
return fmt.Sprintf(
"%d %s",
e.Response.StatusCode,
e.Message,
)
} | go | func (e *ErrorResponse) Error() string {
if e.Message == "" {
e.Message = "Request error"
}
return fmt.Sprintf(
"%d %s",
e.Response.StatusCode,
e.Message,
)
} | [
"func",
"(",
"e",
"*",
"ErrorResponse",
")",
"Error",
"(",
")",
"string",
"{",
"if",
"e",
".",
"Message",
"==",
"\"",
"\"",
"{",
"e",
".",
"Message",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e"... | // Error retrieves the error message of Error Response | [
"Error",
"retrieves",
"the",
"error",
"message",
"of",
"Error",
"Response"
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/kongo.go#L185-L195 |
152,227 | fabiorphp/kongo | kongo.go | UnmarshalJSON | func (t *Time) UnmarshalJSON(value []byte) (err error) {
v := strings.Trim(string(value), "\"")
if v == "" {
t.Time = time.Time{}
return
}
timestamp, err := strconv.ParseInt(v, 10, 64)
if err != nil {
return
}
t.Time = time.Unix(timestamp, 0)
return
} | go | func (t *Time) UnmarshalJSON(value []byte) (err error) {
v := strings.Trim(string(value), "\"")
if v == "" {
t.Time = time.Time{}
return
}
timestamp, err := strconv.ParseInt(v, 10, 64)
if err != nil {
return
}
t.Time = time.Unix(timestamp, 0)
return
} | [
"func",
"(",
"t",
"*",
"Time",
")",
"UnmarshalJSON",
"(",
"value",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"v",
":=",
"strings",
".",
"Trim",
"(",
"string",
"(",
"value",
")",
",",
"\"",
"\\\"",
"\"",
")",
"\n\n",
"if",
"v",
"==",... | // UnmarshalJSON unmarshals string time into Time instance | [
"UnmarshalJSON",
"unmarshals",
"string",
"time",
"into",
"Time",
"instance"
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/kongo.go#L198-L216 |
152,228 | imdario/medeina | medeina.go | joinDeque | func joinDeque(s *lane.Deque) string {
var (
buffer bytes.Buffer
bDeque *lane.Deque
)
bDeque = lane.NewDeque()
for e := s.Shift(); e != nil; e = s.Shift() {
subpath := fmt.Sprintf("%v", e)
if !(subpath == "" && s.Empty()) {
buffer.WriteString("/")
buffer.WriteString(subpath)
}
bDeque.Append(e)
}
for e := bDeque.Shift(); e != nil; e = bDeque.Shift() {
s.Append(e)
}
return buffer.String()
} | go | func joinDeque(s *lane.Deque) string {
var (
buffer bytes.Buffer
bDeque *lane.Deque
)
bDeque = lane.NewDeque()
for e := s.Shift(); e != nil; e = s.Shift() {
subpath := fmt.Sprintf("%v", e)
if !(subpath == "" && s.Empty()) {
buffer.WriteString("/")
buffer.WriteString(subpath)
}
bDeque.Append(e)
}
for e := bDeque.Shift(); e != nil; e = bDeque.Shift() {
s.Append(e)
}
return buffer.String()
} | [
"func",
"joinDeque",
"(",
"s",
"*",
"lane",
".",
"Deque",
")",
"string",
"{",
"var",
"(",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"bDeque",
"*",
"lane",
".",
"Deque",
"\n",
")",
"\n",
"bDeque",
"=",
"lane",
".",
"NewDeque",
"(",
")",
"\n",
"for",
... | // Joins a deque using slashes. This is not a
// generic function. | [
"Joins",
"a",
"deque",
"using",
"slashes",
".",
"This",
"is",
"not",
"a",
"generic",
"function",
"."
] | 642dbf2de43f87904dc463498bf3bacb0c493b9f | https://github.com/imdario/medeina/blob/642dbf2de43f87904dc463498bf3bacb0c493b9f/medeina.go#L51-L69 |
152,229 | imdario/medeina | medeina.go | NewMedeina | func NewMedeina() *Medeina {
return &Medeina{
router: &router{
httprouter.New(),
},
methods: lane.NewStack(),
path: lane.NewDeque(),
}
} | go | func NewMedeina() *Medeina {
return &Medeina{
router: &router{
httprouter.New(),
},
methods: lane.NewStack(),
path: lane.NewDeque(),
}
} | [
"func",
"NewMedeina",
"(",
")",
"*",
"Medeina",
"{",
"return",
"&",
"Medeina",
"{",
"router",
":",
"&",
"router",
"{",
"httprouter",
".",
"New",
"(",
")",
",",
"}",
",",
"methods",
":",
"lane",
".",
"NewStack",
"(",
")",
",",
"path",
":",
"lane",
... | // Returns a new initialized Medeina tree routing with default httprouter's one. | [
"Returns",
"a",
"new",
"initialized",
"Medeina",
"tree",
"routing",
"with",
"default",
"httprouter",
"s",
"one",
"."
] | 642dbf2de43f87904dc463498bf3bacb0c493b9f | https://github.com/imdario/medeina/blob/642dbf2de43f87904dc463498bf3bacb0c493b9f/medeina.go#L78-L86 |
152,230 | imdario/medeina | medeina.go | handle | func (m *Medeina) handle(method Method, handle Handle) {
m.methods.Push(method)
handle()
m.methods.Pop()
} | go | func (m *Medeina) handle(method Method, handle Handle) {
m.methods.Push(method)
handle()
m.methods.Pop()
} | [
"func",
"(",
"m",
"*",
"Medeina",
")",
"handle",
"(",
"method",
"Method",
",",
"handle",
"Handle",
")",
"{",
"m",
".",
"methods",
".",
"Push",
"(",
"method",
")",
"\n",
"handle",
"(",
")",
"\n",
"m",
".",
"methods",
".",
"Pop",
"(",
")",
"\n",
... | // Core logic of handling routes in a tree. | [
"Core",
"logic",
"of",
"handling",
"routes",
"in",
"a",
"tree",
"."
] | 642dbf2de43f87904dc463498bf3bacb0c493b9f | https://github.com/imdario/medeina/blob/642dbf2de43f87904dc463498bf3bacb0c493b9f/medeina.go#L89-L93 |
152,231 | imdario/medeina | medeina.go | On | func (m *Medeina) On(path string, handle Handle) {
m.path.Append(path)
handle()
m.path.Pop()
} | go | func (m *Medeina) On(path string, handle Handle) {
m.path.Append(path)
handle()
m.path.Pop()
} | [
"func",
"(",
"m",
"*",
"Medeina",
")",
"On",
"(",
"path",
"string",
",",
"handle",
"Handle",
")",
"{",
"m",
".",
"path",
".",
"Append",
"(",
"path",
")",
"\n",
"handle",
"(",
")",
"\n",
"m",
".",
"path",
".",
"Pop",
"(",
")",
"\n",
"}"
] | // Adds a new subpath to the current context. Everything under the
// closure will use all the previously set path as root for their
// URLs. | [
"Adds",
"a",
"new",
"subpath",
"to",
"the",
"current",
"context",
".",
"Everything",
"under",
"the",
"closure",
"will",
"use",
"all",
"the",
"previously",
"set",
"path",
"as",
"root",
"for",
"their",
"URLs",
"."
] | 642dbf2de43f87904dc463498bf3bacb0c493b9f | https://github.com/imdario/medeina/blob/642dbf2de43f87904dc463498bf3bacb0c493b9f/medeina.go#L125-L129 |
152,232 | imdario/medeina | medeina.go | OnFunc | func (m *Medeina) OnFunc(path string, handle func(*Medeina)) {
m.path.Append(path)
handle(m)
m.path.Pop()
} | go | func (m *Medeina) OnFunc(path string, handle func(*Medeina)) {
m.path.Append(path)
handle(m)
m.path.Pop()
} | [
"func",
"(",
"m",
"*",
"Medeina",
")",
"OnFunc",
"(",
"path",
"string",
",",
"handle",
"func",
"(",
"*",
"Medeina",
")",
")",
"{",
"m",
".",
"path",
".",
"Append",
"(",
"path",
")",
"\n",
"handle",
"(",
"m",
")",
"\n",
"m",
".",
"path",
".",
... | // As On but using a function which accepts a routing tree as parameter.
// This will be useful to split routes definition in several functions. | [
"As",
"On",
"but",
"using",
"a",
"function",
"which",
"accepts",
"a",
"routing",
"tree",
"as",
"parameter",
".",
"This",
"will",
"be",
"useful",
"to",
"split",
"routes",
"definition",
"in",
"several",
"functions",
"."
] | 642dbf2de43f87904dc463498bf3bacb0c493b9f | https://github.com/imdario/medeina/blob/642dbf2de43f87904dc463498bf3bacb0c493b9f/medeina.go#L133-L137 |
152,233 | imdario/medeina | medeina.go | OnHandler | func (m *Medeina) OnHandler(path string, handle http.Handler) {
m.path.Append(path)
m.Handler("*medeina_subpath", handle, Methods...)
m.path.Pop()
} | go | func (m *Medeina) OnHandler(path string, handle http.Handler) {
m.path.Append(path)
m.Handler("*medeina_subpath", handle, Methods...)
m.path.Pop()
} | [
"func",
"(",
"m",
"*",
"Medeina",
")",
"OnHandler",
"(",
"path",
"string",
",",
"handle",
"http",
".",
"Handler",
")",
"{",
"m",
".",
"path",
".",
"Append",
"(",
"path",
")",
"\n",
"m",
".",
"Handler",
"(",
"\"",
"\"",
",",
"handle",
",",
"Method... | // As On but using a function which accepts a standard http.Handler,
// delegating further route handling to the handler. It adds a HttpRouter
// catch-all matcher called 'medeina_subpath'.
// This will be useful to split routes definition in several functions. | [
"As",
"On",
"but",
"using",
"a",
"function",
"which",
"accepts",
"a",
"standard",
"http",
".",
"Handler",
"delegating",
"further",
"route",
"handling",
"to",
"the",
"handler",
".",
"It",
"adds",
"a",
"HttpRouter",
"catch",
"-",
"all",
"matcher",
"called",
... | 642dbf2de43f87904dc463498bf3bacb0c493b9f | https://github.com/imdario/medeina/blob/642dbf2de43f87904dc463498bf3bacb0c493b9f/medeina.go#L143-L147 |
152,234 | imdario/medeina | medeina.go | Is | func (m *Medeina) Is(path string, handle httprouter.Handle, methods ...Method) {
m.path.Append(path)
fullPath := joinDeque(m.path)
m.path.Pop()
// If any method is provided, it overrides the default one.
if len(methods) > 0 {
for _, method := range methods {
sm := string(method)
m.router.Handle(sm, fullPath, handle)
}
} else {
method := m.methods.Head()
if method == nil {
panic(fmt.Errorf("you cannot set an endpoint outside a HTTP method scope or without passing methods by parameter"))
}
m.router.Handle(string(method.(Method)), fullPath, handle)
}
} | go | func (m *Medeina) Is(path string, handle httprouter.Handle, methods ...Method) {
m.path.Append(path)
fullPath := joinDeque(m.path)
m.path.Pop()
// If any method is provided, it overrides the default one.
if len(methods) > 0 {
for _, method := range methods {
sm := string(method)
m.router.Handle(sm, fullPath, handle)
}
} else {
method := m.methods.Head()
if method == nil {
panic(fmt.Errorf("you cannot set an endpoint outside a HTTP method scope or without passing methods by parameter"))
}
m.router.Handle(string(method.(Method)), fullPath, handle)
}
} | [
"func",
"(",
"m",
"*",
"Medeina",
")",
"Is",
"(",
"path",
"string",
",",
"handle",
"httprouter",
".",
"Handle",
",",
"methods",
"...",
"Method",
")",
"{",
"m",
".",
"path",
".",
"Append",
"(",
"path",
")",
"\n",
"fullPath",
":=",
"joinDeque",
"(",
... | // Sets a canonical path. A canonical path means no further entries are in the path. | [
"Sets",
"a",
"canonical",
"path",
".",
"A",
"canonical",
"path",
"means",
"no",
"further",
"entries",
"are",
"in",
"the",
"path",
"."
] | 642dbf2de43f87904dc463498bf3bacb0c493b9f | https://github.com/imdario/medeina/blob/642dbf2de43f87904dc463498bf3bacb0c493b9f/medeina.go#L166-L183 |
152,235 | imdario/medeina | medeina.go | HandlerPathPrefix | func HandlerPathPrefix(prefix string, handle http.Handler) http.Handler {
if !strings.HasPrefix(prefix, "/") {
prefix = fmt.Sprintf("/%s", prefix)
}
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
old := r.URL
r.URL, _ = url.ParseRequestURI(strings.Replace(old.Path, prefix, "", 1))
handle.ServeHTTP(w, r)
r.URL = old
})
} | go | func HandlerPathPrefix(prefix string, handle http.Handler) http.Handler {
if !strings.HasPrefix(prefix, "/") {
prefix = fmt.Sprintf("/%s", prefix)
}
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
old := r.URL
r.URL, _ = url.ParseRequestURI(strings.Replace(old.Path, prefix, "", 1))
handle.ServeHTTP(w, r)
r.URL = old
})
} | [
"func",
"HandlerPathPrefix",
"(",
"prefix",
"string",
",",
"handle",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"prefix",
",",
"\"",
"\"",
")",
"{",
"prefix",
"=",
"fmt",
".",
"Sprintf",
"(",
... | // Utility function to use with http.Handler compatible routers. Modifies
// the request's URL in order to make subrouters relative to the prefix.
// If you use a router as subrouter without this they need to match the full
// path. | [
"Utility",
"function",
"to",
"use",
"with",
"http",
".",
"Handler",
"compatible",
"routers",
".",
"Modifies",
"the",
"request",
"s",
"URL",
"in",
"order",
"to",
"make",
"subrouters",
"relative",
"to",
"the",
"prefix",
".",
"If",
"you",
"use",
"a",
"router"... | 642dbf2de43f87904dc463498bf3bacb0c493b9f | https://github.com/imdario/medeina/blob/642dbf2de43f87904dc463498bf3bacb0c493b9f/medeina.go#L211-L221 |
152,236 | xenserver/go-xenserver-client | vdi.go | Unexpose | func (self *VDI) Unexpose() (err error) {
disk_uuid, err := self.GetUuid()
if err != nil {
return err
}
hosts, err := self.Client.GetHosts()
if err != nil {
err = errors.New(fmt.Sprintf("Could not retrieve hosts in the pool: %s", err.Error()))
return err
}
host := hosts[0]
args := make(map[string]string)
args["vdi_uuid"] = disk_uuid
result, err := host.CallPlugin("transfer", "unexpose", args)
if err != nil {
return err
}
log.Println(fmt.Sprintf("Unexpose result: %s", result))
return nil
} | go | func (self *VDI) Unexpose() (err error) {
disk_uuid, err := self.GetUuid()
if err != nil {
return err
}
hosts, err := self.Client.GetHosts()
if err != nil {
err = errors.New(fmt.Sprintf("Could not retrieve hosts in the pool: %s", err.Error()))
return err
}
host := hosts[0]
args := make(map[string]string)
args["vdi_uuid"] = disk_uuid
result, err := host.CallPlugin("transfer", "unexpose", args)
if err != nil {
return err
}
log.Println(fmt.Sprintf("Unexpose result: %s", result))
return nil
} | [
"func",
"(",
"self",
"*",
"VDI",
")",
"Unexpose",
"(",
")",
"(",
"err",
"error",
")",
"{",
"disk_uuid",
",",
"err",
":=",
"self",
".",
"GetUuid",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"hosts",
",",
... | // Unexpose a VDI if exposed with a Transfer VM. | [
"Unexpose",
"a",
"VDI",
"if",
"exposed",
"with",
"a",
"Transfer",
"VM",
"."
] | 86a0f30ec1588955b8e63b7b5ffbab43fc3a9ff1 | https://github.com/xenserver/go-xenserver-client/blob/86a0f30ec1588955b8e63b7b5ffbab43fc3a9ff1/vdi.go#L172-L201 |
152,237 | fabiorphp/kongo | node.go | InfoWithContext | func (n *NodeService) InfoWithContext(ctx context.Context) (*NodeInfo, *http.Response, error) {
resource, _ := url.Parse(nodeInfoResourcePath)
req, err := n.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
nodeInfo := new(NodeInfo)
res, err := n.client.Do(req, nodeInfo)
if err != nil {
return nil, res, err
}
return nodeInfo, res, nil
} | go | func (n *NodeService) InfoWithContext(ctx context.Context) (*NodeInfo, *http.Response, error) {
resource, _ := url.Parse(nodeInfoResourcePath)
req, err := n.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
nodeInfo := new(NodeInfo)
res, err := n.client.Do(req, nodeInfo)
if err != nil {
return nil, res, err
}
return nodeInfo, res, nil
} | [
"func",
"(",
"n",
"*",
"NodeService",
")",
"InfoWithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"NodeInfo",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"resource",
",",
"_",
":=",
"url",
".",
"Parse",
"(",
"nodeInfo... | // InfoWithContext retrieves the server node information | [
"InfoWithContext",
"retrieves",
"the",
"server",
"node",
"information"
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/node.go#L203-L221 |
152,238 | fabiorphp/kongo | node.go | Info | func (n *NodeService) Info() (*NodeInfo, *http.Response, error) {
return n.InfoWithContext(context.TODO())
} | go | func (n *NodeService) Info() (*NodeInfo, *http.Response, error) {
return n.InfoWithContext(context.TODO())
} | [
"func",
"(",
"n",
"*",
"NodeService",
")",
"Info",
"(",
")",
"(",
"*",
"NodeInfo",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"n",
".",
"InfoWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
")",
"\n",
"}"
] | // Info retrieves the server node information | [
"Info",
"retrieves",
"the",
"server",
"node",
"information"
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/node.go#L224-L226 |
152,239 | fabiorphp/kongo | node.go | StatusWithContext | func (n *NodeService) StatusWithContext(ctx context.Context) (*NodeStatus, *http.Response, error) {
resource, _ := url.Parse(nodeStatusResourcePath)
req, err := n.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
nodeStatus := new(NodeStatus)
res, err := n.client.Do(req, nodeStatus)
if err != nil {
return nil, res, err
}
return nodeStatus, res, nil
} | go | func (n *NodeService) StatusWithContext(ctx context.Context) (*NodeStatus, *http.Response, error) {
resource, _ := url.Parse(nodeStatusResourcePath)
req, err := n.client.NewRequest(ctx, http.MethodGet, resource, nil)
if err != nil {
return nil, nil, err
}
nodeStatus := new(NodeStatus)
res, err := n.client.Do(req, nodeStatus)
if err != nil {
return nil, res, err
}
return nodeStatus, res, nil
} | [
"func",
"(",
"n",
"*",
"NodeService",
")",
"StatusWithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"NodeStatus",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"resource",
",",
"_",
":=",
"url",
".",
"Parse",
"(",
"node... | // StatusWithContext retrieves the server node status. | [
"StatusWithContext",
"retrieves",
"the",
"server",
"node",
"status",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/node.go#L229-L247 |
152,240 | fabiorphp/kongo | node.go | Status | func (n *NodeService) Status() (*NodeStatus, *http.Response, error) {
return n.StatusWithContext(context.TODO())
} | go | func (n *NodeService) Status() (*NodeStatus, *http.Response, error) {
return n.StatusWithContext(context.TODO())
} | [
"func",
"(",
"n",
"*",
"NodeService",
")",
"Status",
"(",
")",
"(",
"*",
"NodeStatus",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"n",
".",
"StatusWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
")",
"\n",
"}"
] | // Status retrieves the server node status. | [
"Status",
"retrieves",
"the",
"server",
"node",
"status",
"."
] | 4b98febd8f13378979c33e392de0a78adc06e336 | https://github.com/fabiorphp/kongo/blob/4b98febd8f13378979c33e392de0a78adc06e336/node.go#L250-L252 |
152,241 | TheCacophonyProject/lepton3 | telemetry.go | ParseTelemetry | func ParseTelemetry(raw []byte, t *Telemetry) error {
var tw telemetryWords
if err := binary.Read(bytes.NewBuffer(raw), Big16, &tw); err != nil {
return err
}
t.TimeOn = tw.TimeOn.ToD()
t.FFCState = statusToFFCState(tw.StatusBits)
t.FrameCount = int(tw.FrameCounter)
t.FrameMean = tw.FrameMean
t.TempC = tw.FPATemp.ToC()
t.LastFFCTempC = tw.FPATempLastFFC.ToC()
t.LastFFCTime = tw.TimeCounterLastFFC.ToD()
return nil
} | go | func ParseTelemetry(raw []byte, t *Telemetry) error {
var tw telemetryWords
if err := binary.Read(bytes.NewBuffer(raw), Big16, &tw); err != nil {
return err
}
t.TimeOn = tw.TimeOn.ToD()
t.FFCState = statusToFFCState(tw.StatusBits)
t.FrameCount = int(tw.FrameCounter)
t.FrameMean = tw.FrameMean
t.TempC = tw.FPATemp.ToC()
t.LastFFCTempC = tw.FPATempLastFFC.ToC()
t.LastFFCTime = tw.TimeCounterLastFFC.ToD()
return nil
} | [
"func",
"ParseTelemetry",
"(",
"raw",
"[",
"]",
"byte",
",",
"t",
"*",
"Telemetry",
")",
"error",
"{",
"var",
"tw",
"telemetryWords",
"\n",
"if",
"err",
":=",
"binary",
".",
"Read",
"(",
"bytes",
".",
"NewBuffer",
"(",
"raw",
")",
",",
"Big16",
",",
... | // ParseTelemetry converts a slice containing raw Lepton 3 telemetry
// data into a Telemetry struct. | [
"ParseTelemetry",
"converts",
"a",
"slice",
"containing",
"raw",
"Lepton",
"3",
"telemetry",
"data",
"into",
"a",
"Telemetry",
"struct",
"."
] | 24af961474c7feb0c8f92911c371e18c0fccfb0c | https://github.com/TheCacophonyProject/lepton3/blob/24af961474c7feb0c8f92911c371e18c0fccfb0c/telemetry.go#L37-L50 |
152,242 | TheCacophonyProject/lepton3 | telemetry.go | ToD | func (d durationMS) ToD() time.Duration {
return time.Duration(d) * time.Millisecond
} | go | func (d durationMS) ToD() time.Duration {
return time.Duration(d) * time.Millisecond
} | [
"func",
"(",
"d",
"durationMS",
")",
"ToD",
"(",
")",
"time",
".",
"Duration",
"{",
"return",
"time",
".",
"Duration",
"(",
"d",
")",
"*",
"time",
".",
"Millisecond",
"\n",
"}"
] | // ToD converts a millisecond based timing to time.Duration. | [
"ToD",
"converts",
"a",
"millisecond",
"based",
"timing",
"to",
"time",
".",
"Duration",
"."
] | 24af961474c7feb0c8f92911c371e18c0fccfb0c | https://github.com/TheCacophonyProject/lepton3/blob/24af961474c7feb0c8f92911c371e18c0fccfb0c/telemetry.go#L74-L76 |
152,243 | TheCacophonyProject/lepton3 | frame.go | ToFrame | func (rf *RawFrame) ToFrame(out *Frame) error {
if err := ParseTelemetry(rf[:], &out.Status); err != nil {
return err
}
rawPix := rf[telemetryPacketCount*vospiDataSize:]
i := 0
for y := 0; y < FrameRows; y++ {
for x := 0; x < FrameCols; x++ {
out.Pix[y][x] = binary.BigEndian.Uint16(rawPix[i : i+2])
i += 2
}
}
return nil
} | go | func (rf *RawFrame) ToFrame(out *Frame) error {
if err := ParseTelemetry(rf[:], &out.Status); err != nil {
return err
}
rawPix := rf[telemetryPacketCount*vospiDataSize:]
i := 0
for y := 0; y < FrameRows; y++ {
for x := 0; x < FrameCols; x++ {
out.Pix[y][x] = binary.BigEndian.Uint16(rawPix[i : i+2])
i += 2
}
}
return nil
} | [
"func",
"(",
"rf",
"*",
"RawFrame",
")",
"ToFrame",
"(",
"out",
"*",
"Frame",
")",
"error",
"{",
"if",
"err",
":=",
"ParseTelemetry",
"(",
"rf",
"[",
":",
"]",
",",
"&",
"out",
".",
"Status",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
... | // ToFrame converts a RawFrame to a Frame. | [
"ToFrame",
"converts",
"a",
"RawFrame",
"to",
"a",
"Frame",
"."
] | 24af961474c7feb0c8f92911c371e18c0fccfb0c | https://github.com/TheCacophonyProject/lepton3/blob/24af961474c7feb0c8f92911c371e18c0fccfb0c/frame.go#L26-L40 |
152,244 | TheCacophonyProject/lepton3 | frame.go | Copy | func (fr *Frame) Copy(orig *Frame) {
fr.Status = orig.Status
for y := 0; y < FrameRows; y++ {
copy(fr.Pix[y][:], orig.Pix[y][:])
}
} | go | func (fr *Frame) Copy(orig *Frame) {
fr.Status = orig.Status
for y := 0; y < FrameRows; y++ {
copy(fr.Pix[y][:], orig.Pix[y][:])
}
} | [
"func",
"(",
"fr",
"*",
"Frame",
")",
"Copy",
"(",
"orig",
"*",
"Frame",
")",
"{",
"fr",
".",
"Status",
"=",
"orig",
".",
"Status",
"\n",
"for",
"y",
":=",
"0",
";",
"y",
"<",
"FrameRows",
";",
"y",
"++",
"{",
"copy",
"(",
"fr",
".",
"Pix",
... | // Copy sets current frame as other frame | [
"Copy",
"sets",
"current",
"frame",
"as",
"other",
"frame"
] | 24af961474c7feb0c8f92911c371e18c0fccfb0c | https://github.com/TheCacophonyProject/lepton3/blob/24af961474c7feb0c8f92911c371e18c0fccfb0c/frame.go#L43-L48 |
152,245 | o1egl/gormrus | logger.go | NewWithNameAndLogger | func NewWithNameAndLogger(name string, logger *logrus.Logger) *gormLogger {
return &gormLogger{name: name, logger: logger}
} | go | func NewWithNameAndLogger(name string, logger *logrus.Logger) *gormLogger {
return &gormLogger{name: name, logger: logger}
} | [
"func",
"NewWithNameAndLogger",
"(",
"name",
"string",
",",
"logger",
"*",
"logrus",
".",
"Logger",
")",
"*",
"gormLogger",
"{",
"return",
"&",
"gormLogger",
"{",
"name",
":",
"name",
",",
"logger",
":",
"logger",
"}",
"\n",
"}"
] | // NewWithNameAndLogger Create new logger with custom name and logger | [
"NewWithNameAndLogger",
"Create",
"new",
"logger",
"with",
"custom",
"name",
"and",
"logger"
] | fde1f6a23457f4e196f8d18a9bc45c491320384f | https://github.com/o1egl/gormrus/blob/fde1f6a23457f4e196f8d18a9bc45c491320384f/logger.go#L76-L78 |
152,246 | mikkeloscar/aur | aur.go | SearchBy | func SearchBy(query string, by By) ([]Pkg, error) {
return searchBy(query, by.String())
} | go | func SearchBy(query string, by By) ([]Pkg, error) {
return searchBy(query, by.String())
} | [
"func",
"SearchBy",
"(",
"query",
"string",
",",
"by",
"By",
")",
"(",
"[",
"]",
"Pkg",
",",
"error",
")",
"{",
"return",
"searchBy",
"(",
"query",
",",
"by",
".",
"String",
"(",
")",
")",
"\n",
"}"
] | // SearchBy searches for packages with a specified search by | [
"SearchBy",
"searches",
"for",
"packages",
"with",
"a",
"specified",
"search",
"by"
] | f956f121b3fa2bdaec629d547f3b6ecb8f68996d | https://github.com/mikkeloscar/aur/blob/f956f121b3fa2bdaec629d547f3b6ecb8f68996d/aur.go#L124-L126 |
152,247 | mikkeloscar/aur | aur.go | Info | func Info(pkgs []string) ([]Pkg, error) {
v := url.Values{}
v.Set("type", "info")
for _, arg := range pkgs {
v.Add("arg[]", arg)
}
return get(v)
} | go | func Info(pkgs []string) ([]Pkg, error) {
v := url.Values{}
v.Set("type", "info")
for _, arg := range pkgs {
v.Add("arg[]", arg)
}
return get(v)
} | [
"func",
"Info",
"(",
"pkgs",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"Pkg",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"v",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"arg",
":=... | // Info shows info for one or multiple packages. | [
"Info",
"shows",
"info",
"for",
"one",
"or",
"multiple",
"packages",
"."
] | f956f121b3fa2bdaec629d547f3b6ecb8f68996d | https://github.com/mikkeloscar/aur/blob/f956f121b3fa2bdaec629d547f3b6ecb8f68996d/aur.go#L133-L140 |
152,248 | TheCacophonyProject/lepton3 | lepton3.go | New | func New(spiSpeed int64) (*Lepton3, error) {
cciDev, err := openCCI()
if err != nil {
return nil, err
}
// // Enable telemetry (as the header)
if err := cciDev.Init(); err != nil {
cciDev.Close()
return nil, err
}
// The ring buffer is used to avoid memory allocations for SPI
// transfers. We aim to have it big enough to handle all the SPI
// transfers for at least a 3 frames.
ringChunks := 3 * int(math.Ceil(float64(maxPacketsPerFrame)/float64(packetsPerRead)))
return &Lepton3{
cciDev: cciDev,
spiSpeed: spiSpeed,
ring: newRing(ringChunks, transferSize),
frameBuilder: newFrameBuilder(),
log: func(string) {},
}, nil
} | go | func New(spiSpeed int64) (*Lepton3, error) {
cciDev, err := openCCI()
if err != nil {
return nil, err
}
// // Enable telemetry (as the header)
if err := cciDev.Init(); err != nil {
cciDev.Close()
return nil, err
}
// The ring buffer is used to avoid memory allocations for SPI
// transfers. We aim to have it big enough to handle all the SPI
// transfers for at least a 3 frames.
ringChunks := 3 * int(math.Ceil(float64(maxPacketsPerFrame)/float64(packetsPerRead)))
return &Lepton3{
cciDev: cciDev,
spiSpeed: spiSpeed,
ring: newRing(ringChunks, transferSize),
frameBuilder: newFrameBuilder(),
log: func(string) {},
}, nil
} | [
"func",
"New",
"(",
"spiSpeed",
"int64",
")",
"(",
"*",
"Lepton3",
",",
"error",
")",
"{",
"cciDev",
",",
"err",
":=",
"openCCI",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// // Enable telemetry (... | // New returns a new Lepton3 instance. | [
"New",
"returns",
"a",
"new",
"Lepton3",
"instance",
"."
] | 24af961474c7feb0c8f92911c371e18c0fccfb0c | https://github.com/TheCacophonyProject/lepton3/blob/24af961474c7feb0c8f92911c371e18c0fccfb0c/lepton3.go#L62-L85 |
152,249 | TheCacophonyProject/lepton3 | lepton3.go | SetRadiometry | func (d *Lepton3) SetRadiometry(enable bool) error {
if err := d.cciDev.SetRadiometry(enable); err != nil {
return fmt.Errorf("SetRadiometry: %v", err)
}
return nil
} | go | func (d *Lepton3) SetRadiometry(enable bool) error {
if err := d.cciDev.SetRadiometry(enable); err != nil {
return fmt.Errorf("SetRadiometry: %v", err)
}
return nil
} | [
"func",
"(",
"d",
"*",
"Lepton3",
")",
"SetRadiometry",
"(",
"enable",
"bool",
")",
"error",
"{",
"if",
"err",
":=",
"d",
".",
"cciDev",
".",
"SetRadiometry",
"(",
"enable",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\... | // SetRadiometry enables or disables radiometry mode. If enabled, the
// camera will attempt to automatically compensate for ambient
// temperature changes. | [
"SetRadiometry",
"enables",
"or",
"disables",
"radiometry",
"mode",
".",
"If",
"enabled",
"the",
"camera",
"will",
"attempt",
"to",
"automatically",
"compensate",
"for",
"ambient",
"temperature",
"changes",
"."
] | 24af961474c7feb0c8f92911c371e18c0fccfb0c | https://github.com/TheCacophonyProject/lepton3/blob/24af961474c7feb0c8f92911c371e18c0fccfb0c/lepton3.go#L108-L113 |
152,250 | TheCacophonyProject/lepton3 | lepton3.go | Open | func (d *Lepton3) Open() error {
spiPort, err := spireg.Open("")
if err != nil {
return err
}
spiConn, err := spiPort.Connect(d.spiSpeed, spi.Mode3, 8)
if err != nil {
spiPort.Close()
return err
}
d.spiPort = spiPort
d.spiConn = spiConn
return d.startStream()
} | go | func (d *Lepton3) Open() error {
spiPort, err := spireg.Open("")
if err != nil {
return err
}
spiConn, err := spiPort.Connect(d.spiSpeed, spi.Mode3, 8)
if err != nil {
spiPort.Close()
return err
}
d.spiPort = spiPort
d.spiConn = spiConn
return d.startStream()
} | [
"func",
"(",
"d",
"*",
"Lepton3",
")",
"Open",
"(",
")",
"error",
"{",
"spiPort",
",",
"err",
":=",
"spireg",
".",
"Open",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"spiConn",
",",
"err",
":=",... | // Open initialises the SPI connection and starts streaming packets
// from the camera. | [
"Open",
"initialises",
"the",
"SPI",
"connection",
"and",
"starts",
"streaming",
"packets",
"from",
"the",
"camera",
"."
] | 24af961474c7feb0c8f92911c371e18c0fccfb0c | https://github.com/TheCacophonyProject/lepton3/blob/24af961474c7feb0c8f92911c371e18c0fccfb0c/lepton3.go#L123-L138 |
152,251 | jpadilla/ivona-go | ivona.go | New | func New(accessKey string, secretKey string) *Ivona {
return &Ivona{AccessKey: accessKey, SecretKey: secretKey}
} | go | func New(accessKey string, secretKey string) *Ivona {
return &Ivona{AccessKey: accessKey, SecretKey: secretKey}
} | [
"func",
"New",
"(",
"accessKey",
"string",
",",
"secretKey",
"string",
")",
"*",
"Ivona",
"{",
"return",
"&",
"Ivona",
"{",
"AccessKey",
":",
"accessKey",
",",
"SecretKey",
":",
"secretKey",
"}",
"\n",
"}"
] | // New returns a new Ivona client. | [
"New",
"returns",
"a",
"new",
"Ivona",
"client",
"."
] | 4018c8ab5e21e2ae2999322c284c51842fcdc366 | https://github.com/jpadilla/ivona-go/blob/4018c8ab5e21e2ae2999322c284c51842fcdc366/ivona.go#L27-L29 |
152,252 | jpadilla/ivona-go | ivona.go | CreateSpeech | func (client *Ivona) CreateSpeech(options SpeechOptions) (*SpeechResponse, error) {
b, err := json.Marshal(options)
if err != nil {
return nil, err
}
r, _ := http.NewRequest("POST", createSpeechAPI, bytes.NewReader(b))
r.Header.Set("Content-Type", "application/json")
awsClient := aws4.Client{Keys: &aws4.Keys{
AccessKey: client.AccessKey,
SecretKey: client.SecretKey,
}}
resp, err := awsClient.Do(r)
if err != nil {
return nil, err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("Got non 200 status code: %s %q", resp.Status, data)
}
return &SpeechResponse{
Audio: data,
RequestID: resp.Header["X-Amzn-Ivonattsrequestid"][0],
ContentType: resp.Header["Content-Type"][0],
}, nil
} | go | func (client *Ivona) CreateSpeech(options SpeechOptions) (*SpeechResponse, error) {
b, err := json.Marshal(options)
if err != nil {
return nil, err
}
r, _ := http.NewRequest("POST", createSpeechAPI, bytes.NewReader(b))
r.Header.Set("Content-Type", "application/json")
awsClient := aws4.Client{Keys: &aws4.Keys{
AccessKey: client.AccessKey,
SecretKey: client.SecretKey,
}}
resp, err := awsClient.Do(r)
if err != nil {
return nil, err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("Got non 200 status code: %s %q", resp.Status, data)
}
return &SpeechResponse{
Audio: data,
RequestID: resp.Header["X-Amzn-Ivonattsrequestid"][0],
ContentType: resp.Header["Content-Type"][0],
}, nil
} | [
"func",
"(",
"client",
"*",
"Ivona",
")",
"CreateSpeech",
"(",
"options",
"SpeechOptions",
")",
"(",
"*",
"SpeechResponse",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"options",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
... | // CreateSpeech performs a synthesis of the requested text and returns the audio stream containing the speech. | [
"CreateSpeech",
"performs",
"a",
"synthesis",
"of",
"the",
"requested",
"text",
"and",
"returns",
"the",
"audio",
"stream",
"containing",
"the",
"speech",
"."
] | 4018c8ab5e21e2ae2999322c284c51842fcdc366 | https://github.com/jpadilla/ivona-go/blob/4018c8ab5e21e2ae2999322c284c51842fcdc366/ivona.go#L32-L70 |
152,253 | jpadilla/ivona-go | ivona.go | ListVoices | func (client *Ivona) ListVoices(options Voice) (*ListResponse, error) {
b, err := json.Marshal(options)
if err != nil {
return nil, err
}
r, _ := http.NewRequest("POST", listVoicesAPI, bytes.NewReader(b))
r.Header.Set("Content-Type", "application/json")
awsClient := aws4.Client{Keys: &aws4.Keys{
AccessKey: client.AccessKey,
SecretKey: client.SecretKey,
}}
resp, err := awsClient.Do(r)
if err != nil {
return nil, err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("Got non 200 status code: %s %q", resp.Status, data)
}
list := new(ListResponse)
err = json.Unmarshal(data, list)
if err != nil {
return nil, err
}
list.RequestID = resp.Header["X-Amzn-Ivonattsrequestid"][0]
list.ContentType = resp.Header["Content-Type"][0]
return list, nil
} | go | func (client *Ivona) ListVoices(options Voice) (*ListResponse, error) {
b, err := json.Marshal(options)
if err != nil {
return nil, err
}
r, _ := http.NewRequest("POST", listVoicesAPI, bytes.NewReader(b))
r.Header.Set("Content-Type", "application/json")
awsClient := aws4.Client{Keys: &aws4.Keys{
AccessKey: client.AccessKey,
SecretKey: client.SecretKey,
}}
resp, err := awsClient.Do(r)
if err != nil {
return nil, err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("Got non 200 status code: %s %q", resp.Status, data)
}
list := new(ListResponse)
err = json.Unmarshal(data, list)
if err != nil {
return nil, err
}
list.RequestID = resp.Header["X-Amzn-Ivonattsrequestid"][0]
list.ContentType = resp.Header["Content-Type"][0]
return list, nil
} | [
"func",
"(",
"client",
"*",
"Ivona",
")",
"ListVoices",
"(",
"options",
"Voice",
")",
"(",
"*",
"ListResponse",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"options",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return... | // ListVoices retrieves list of voices from the api | [
"ListVoices",
"retrieves",
"list",
"of",
"voices",
"from",
"the",
"api"
] | 4018c8ab5e21e2ae2999322c284c51842fcdc366 | https://github.com/jpadilla/ivona-go/blob/4018c8ab5e21e2ae2999322c284c51842fcdc366/ivona.go#L73-L113 |
152,254 | favclip/jwg | misc/fixture/j/model_json.go | Properties | func (b *FooJSONBuilder) Properties() []*FooPropertyInfo {
return []*FooPropertyInfo{
b.Tmp,
b.Bar,
b.Buzz,
b.Hoge,
b.Fuga,
}
} | go | func (b *FooJSONBuilder) Properties() []*FooPropertyInfo {
return []*FooPropertyInfo{
b.Tmp,
b.Bar,
b.Buzz,
b.Hoge,
b.Fuga,
}
} | [
"func",
"(",
"b",
"*",
"FooJSONBuilder",
")",
"Properties",
"(",
")",
"[",
"]",
"*",
"FooPropertyInfo",
"{",
"return",
"[",
"]",
"*",
"FooPropertyInfo",
"{",
"b",
".",
"Tmp",
",",
"b",
".",
"Bar",
",",
"b",
".",
"Buzz",
",",
"b",
".",
"Hoge",
","... | // Properties returns all properties on FooJSONBuilder. | [
"Properties",
"returns",
"all",
"properties",
"on",
"FooJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L188-L196 |
152,255 | favclip/jwg | misc/fixture/j/model_json.go | AddAll | func (b *FooJSONBuilder) AddAll() *FooJSONBuilder {
b._properties["Tmp"] = b.Tmp
b._properties["Bar"] = b.Bar
b._properties["Buzz"] = b.Buzz
b._properties["Hoge"] = b.Hoge
b._properties["Fuga"] = b.Fuga
return b
} | go | func (b *FooJSONBuilder) AddAll() *FooJSONBuilder {
b._properties["Tmp"] = b.Tmp
b._properties["Bar"] = b.Bar
b._properties["Buzz"] = b.Buzz
b._properties["Hoge"] = b.Hoge
b._properties["Fuga"] = b.Fuga
return b
} | [
"func",
"(",
"b",
"*",
"FooJSONBuilder",
")",
"AddAll",
"(",
")",
"*",
"FooJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"\"",
"\"",
"]",
"=",
"b",
".",
"Tmp",
"\n",
"b",
".",
"_properties",
"[",
"\"",
"\"",
"]",
"=",
"b",
".",
"Bar",
"\n",
... | // AddAll adds all property to FooJSONBuilder. | [
"AddAll",
"adds",
"all",
"property",
"to",
"FooJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L199-L206 |
152,256 | favclip/jwg | misc/fixture/j/model_json.go | Add | func (b *FooJSONBuilder) Add(info *FooPropertyInfo) *FooJSONBuilder {
b._properties[info.fieldName] = info
return b
} | go | func (b *FooJSONBuilder) Add(info *FooPropertyInfo) *FooJSONBuilder {
b._properties[info.fieldName] = info
return b
} | [
"func",
"(",
"b",
"*",
"FooJSONBuilder",
")",
"Add",
"(",
"info",
"*",
"FooPropertyInfo",
")",
"*",
"FooJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"info",
".",
"fieldName",
"]",
"=",
"info",
"\n",
"return",
"b",
"\n",
"}"
] | // Add specified property to FooJSONBuilder. | [
"Add",
"specified",
"property",
"to",
"FooJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L209-L212 |
152,257 | favclip/jwg | misc/fixture/j/model_json.go | Remove | func (b *FooJSONBuilder) Remove(info *FooPropertyInfo) *FooJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | go | func (b *FooJSONBuilder) Remove(info *FooPropertyInfo) *FooJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | [
"func",
"(",
"b",
"*",
"FooJSONBuilder",
")",
"Remove",
"(",
"info",
"*",
"FooPropertyInfo",
")",
"*",
"FooJSONBuilder",
"{",
"delete",
"(",
"b",
".",
"_properties",
",",
"info",
".",
"fieldName",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // Remove specified property to FooJSONBuilder. | [
"Remove",
"specified",
"property",
"to",
"FooJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L239-L242 |
152,258 | favclip/jwg | misc/fixture/j/model_json.go | NewHogeJSONBuilder | func NewHogeJSONBuilder() *HogeJSONBuilder {
jb := &HogeJSONBuilder{
_properties: map[string]*HogePropertyInfo{},
_jsonPropertyMap: map[string]*HogePropertyInfo{},
_structPropertyMap: map[string]*HogePropertyInfo{},
Hoge1: &HogePropertyInfo{
fieldName: "Hoge1",
jsonName: "hoge1",
Encoder: func(src *Hoge, dest *HogeJSON) error {
if src == nil {
return nil
}
dest.Hoge1 = src.Hoge1
return nil
},
Decoder: func(src *HogeJSON, dest *Hoge) error {
if src == nil {
return nil
}
dest.Hoge1 = src.Hoge1
return nil
},
},
}
jb._structPropertyMap["Hoge1"] = jb.Hoge1
jb._jsonPropertyMap["hoge1"] = jb.Hoge1
return jb
} | go | func NewHogeJSONBuilder() *HogeJSONBuilder {
jb := &HogeJSONBuilder{
_properties: map[string]*HogePropertyInfo{},
_jsonPropertyMap: map[string]*HogePropertyInfo{},
_structPropertyMap: map[string]*HogePropertyInfo{},
Hoge1: &HogePropertyInfo{
fieldName: "Hoge1",
jsonName: "hoge1",
Encoder: func(src *Hoge, dest *HogeJSON) error {
if src == nil {
return nil
}
dest.Hoge1 = src.Hoge1
return nil
},
Decoder: func(src *HogeJSON, dest *Hoge) error {
if src == nil {
return nil
}
dest.Hoge1 = src.Hoge1
return nil
},
},
}
jb._structPropertyMap["Hoge1"] = jb.Hoge1
jb._jsonPropertyMap["hoge1"] = jb.Hoge1
return jb
} | [
"func",
"NewHogeJSONBuilder",
"(",
")",
"*",
"HogeJSONBuilder",
"{",
"jb",
":=",
"&",
"HogeJSONBuilder",
"{",
"_properties",
":",
"map",
"[",
"string",
"]",
"*",
"HogePropertyInfo",
"{",
"}",
",",
"_jsonPropertyMap",
":",
"map",
"[",
"string",
"]",
"*",
"H... | // NewHogeJSONBuilder make new HogeJSONBuilder. | [
"NewHogeJSONBuilder",
"make",
"new",
"HogeJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L383-L410 |
152,259 | favclip/jwg | misc/fixture/j/model_json.go | Add | func (b *HogeJSONBuilder) Add(info *HogePropertyInfo) *HogeJSONBuilder {
b._properties[info.fieldName] = info
return b
} | go | func (b *HogeJSONBuilder) Add(info *HogePropertyInfo) *HogeJSONBuilder {
b._properties[info.fieldName] = info
return b
} | [
"func",
"(",
"b",
"*",
"HogeJSONBuilder",
")",
"Add",
"(",
"info",
"*",
"HogePropertyInfo",
")",
"*",
"HogeJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"info",
".",
"fieldName",
"]",
"=",
"info",
"\n",
"return",
"b",
"\n",
"}"
] | // Add specified property to HogeJSONBuilder. | [
"Add",
"specified",
"property",
"to",
"HogeJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L426-L429 |
152,260 | favclip/jwg | misc/fixture/j/model_json.go | AddByJSONNames | func (b *HogeJSONBuilder) AddByJSONNames(names ...string) *HogeJSONBuilder {
for _, name := range names {
info := b._jsonPropertyMap[name]
if info == nil {
continue
}
b._properties[info.fieldName] = info
}
return b
} | go | func (b *HogeJSONBuilder) AddByJSONNames(names ...string) *HogeJSONBuilder {
for _, name := range names {
info := b._jsonPropertyMap[name]
if info == nil {
continue
}
b._properties[info.fieldName] = info
}
return b
} | [
"func",
"(",
"b",
"*",
"HogeJSONBuilder",
")",
"AddByJSONNames",
"(",
"names",
"...",
"string",
")",
"*",
"HogeJSONBuilder",
"{",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"info",
":=",
"b",
".",
"_jsonPropertyMap",
"[",
"name",
"]",
"\n",
... | // AddByJSONNames add properties to HogeJSONBuilder by JSON property name. if name is not in the builder, it will ignore. | [
"AddByJSONNames",
"add",
"properties",
"to",
"HogeJSONBuilder",
"by",
"JSON",
"property",
"name",
".",
"if",
"name",
"is",
"not",
"in",
"the",
"builder",
"it",
"will",
"ignore",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L432-L441 |
152,261 | favclip/jwg | misc/fixture/j/model_json.go | AddByNames | func (b *HogeJSONBuilder) AddByNames(names ...string) *HogeJSONBuilder {
for _, name := range names {
info := b._structPropertyMap[name]
if info == nil {
continue
}
b._properties[info.fieldName] = info
}
return b
} | go | func (b *HogeJSONBuilder) AddByNames(names ...string) *HogeJSONBuilder {
for _, name := range names {
info := b._structPropertyMap[name]
if info == nil {
continue
}
b._properties[info.fieldName] = info
}
return b
} | [
"func",
"(",
"b",
"*",
"HogeJSONBuilder",
")",
"AddByNames",
"(",
"names",
"...",
"string",
")",
"*",
"HogeJSONBuilder",
"{",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"info",
":=",
"b",
".",
"_structPropertyMap",
"[",
"name",
"]",
"\n",
"i... | // AddByNames add properties to HogeJSONBuilder by struct property name. if name is not in the builder, it will ignore. | [
"AddByNames",
"add",
"properties",
"to",
"HogeJSONBuilder",
"by",
"struct",
"property",
"name",
".",
"if",
"name",
"is",
"not",
"in",
"the",
"builder",
"it",
"will",
"ignore",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L444-L453 |
152,262 | favclip/jwg | misc/fixture/j/model_json.go | Remove | func (b *HogeJSONBuilder) Remove(info *HogePropertyInfo) *HogeJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | go | func (b *HogeJSONBuilder) Remove(info *HogePropertyInfo) *HogeJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | [
"func",
"(",
"b",
"*",
"HogeJSONBuilder",
")",
"Remove",
"(",
"info",
"*",
"HogePropertyInfo",
")",
"*",
"HogeJSONBuilder",
"{",
"delete",
"(",
"b",
".",
"_properties",
",",
"info",
".",
"fieldName",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // Remove specified property to HogeJSONBuilder. | [
"Remove",
"specified",
"property",
"to",
"HogeJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L456-L459 |
152,263 | favclip/jwg | misc/fixture/j/model_json.go | RemoveByJSONNames | func (b *HogeJSONBuilder) RemoveByJSONNames(names ...string) *HogeJSONBuilder {
for _, name := range names {
info := b._jsonPropertyMap[name]
if info == nil {
continue
}
delete(b._properties, info.fieldName)
}
return b
} | go | func (b *HogeJSONBuilder) RemoveByJSONNames(names ...string) *HogeJSONBuilder {
for _, name := range names {
info := b._jsonPropertyMap[name]
if info == nil {
continue
}
delete(b._properties, info.fieldName)
}
return b
} | [
"func",
"(",
"b",
"*",
"HogeJSONBuilder",
")",
"RemoveByJSONNames",
"(",
"names",
"...",
"string",
")",
"*",
"HogeJSONBuilder",
"{",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"info",
":=",
"b",
".",
"_jsonPropertyMap",
"[",
"name",
"]",
"\n",... | // RemoveByJSONNames remove properties to HogeJSONBuilder by JSON property name. if name is not in the builder, it will ignore. | [
"RemoveByJSONNames",
"remove",
"properties",
"to",
"HogeJSONBuilder",
"by",
"JSON",
"property",
"name",
".",
"if",
"name",
"is",
"not",
"in",
"the",
"builder",
"it",
"will",
"ignore",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L462-L472 |
152,264 | favclip/jwg | misc/fixture/j/model_json.go | RemoveByNames | func (b *HogeJSONBuilder) RemoveByNames(names ...string) *HogeJSONBuilder {
for _, name := range names {
info := b._structPropertyMap[name]
if info == nil {
continue
}
delete(b._properties, info.fieldName)
}
return b
} | go | func (b *HogeJSONBuilder) RemoveByNames(names ...string) *HogeJSONBuilder {
for _, name := range names {
info := b._structPropertyMap[name]
if info == nil {
continue
}
delete(b._properties, info.fieldName)
}
return b
} | [
"func",
"(",
"b",
"*",
"HogeJSONBuilder",
")",
"RemoveByNames",
"(",
"names",
"...",
"string",
")",
"*",
"HogeJSONBuilder",
"{",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"info",
":=",
"b",
".",
"_structPropertyMap",
"[",
"name",
"]",
"\n",
... | // RemoveByNames remove properties to HogeJSONBuilder by struct property name. if name is not in the builder, it will ignore. | [
"RemoveByNames",
"remove",
"properties",
"to",
"HogeJSONBuilder",
"by",
"struct",
"property",
"name",
".",
"if",
"name",
"is",
"not",
"in",
"the",
"builder",
"it",
"will",
"ignore",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L475-L484 |
152,265 | favclip/jwg | misc/fixture/j/model_json.go | NewFugaJSONBuilder | func NewFugaJSONBuilder() *FugaJSONBuilder {
jb := &FugaJSONBuilder{
_properties: map[string]*FugaPropertyInfo{},
_jsonPropertyMap: map[string]*FugaPropertyInfo{},
_structPropertyMap: map[string]*FugaPropertyInfo{},
Fuga1: &FugaPropertyInfo{
fieldName: "Fuga1",
jsonName: "fuga1",
Encoder: func(src *Fuga, dest *FugaJSON) error {
if src == nil {
return nil
}
dest.Fuga1 = src.Fuga1
return nil
},
Decoder: func(src *FugaJSON, dest *Fuga) error {
if src == nil {
return nil
}
dest.Fuga1 = src.Fuga1
return nil
},
},
}
jb._structPropertyMap["Fuga1"] = jb.Fuga1
jb._jsonPropertyMap["fuga1"] = jb.Fuga1
return jb
} | go | func NewFugaJSONBuilder() *FugaJSONBuilder {
jb := &FugaJSONBuilder{
_properties: map[string]*FugaPropertyInfo{},
_jsonPropertyMap: map[string]*FugaPropertyInfo{},
_structPropertyMap: map[string]*FugaPropertyInfo{},
Fuga1: &FugaPropertyInfo{
fieldName: "Fuga1",
jsonName: "fuga1",
Encoder: func(src *Fuga, dest *FugaJSON) error {
if src == nil {
return nil
}
dest.Fuga1 = src.Fuga1
return nil
},
Decoder: func(src *FugaJSON, dest *Fuga) error {
if src == nil {
return nil
}
dest.Fuga1 = src.Fuga1
return nil
},
},
}
jb._structPropertyMap["Fuga1"] = jb.Fuga1
jb._jsonPropertyMap["fuga1"] = jb.Fuga1
return jb
} | [
"func",
"NewFugaJSONBuilder",
"(",
")",
"*",
"FugaJSONBuilder",
"{",
"jb",
":=",
"&",
"FugaJSONBuilder",
"{",
"_properties",
":",
"map",
"[",
"string",
"]",
"*",
"FugaPropertyInfo",
"{",
"}",
",",
"_jsonPropertyMap",
":",
"map",
"[",
"string",
"]",
"*",
"F... | // NewFugaJSONBuilder make new FugaJSONBuilder. | [
"NewFugaJSONBuilder",
"make",
"new",
"FugaJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L600-L627 |
152,266 | favclip/jwg | misc/fixture/j/model_json.go | Add | func (b *FugaJSONBuilder) Add(info *FugaPropertyInfo) *FugaJSONBuilder {
b._properties[info.fieldName] = info
return b
} | go | func (b *FugaJSONBuilder) Add(info *FugaPropertyInfo) *FugaJSONBuilder {
b._properties[info.fieldName] = info
return b
} | [
"func",
"(",
"b",
"*",
"FugaJSONBuilder",
")",
"Add",
"(",
"info",
"*",
"FugaPropertyInfo",
")",
"*",
"FugaJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"info",
".",
"fieldName",
"]",
"=",
"info",
"\n",
"return",
"b",
"\n",
"}"
] | // Add specified property to FugaJSONBuilder. | [
"Add",
"specified",
"property",
"to",
"FugaJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L643-L646 |
152,267 | favclip/jwg | misc/fixture/j/model_json.go | Remove | func (b *FugaJSONBuilder) Remove(info *FugaPropertyInfo) *FugaJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | go | func (b *FugaJSONBuilder) Remove(info *FugaPropertyInfo) *FugaJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | [
"func",
"(",
"b",
"*",
"FugaJSONBuilder",
")",
"Remove",
"(",
"info",
"*",
"FugaPropertyInfo",
")",
"*",
"FugaJSONBuilder",
"{",
"delete",
"(",
"b",
".",
"_properties",
",",
"info",
".",
"fieldName",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // Remove specified property to FugaJSONBuilder. | [
"Remove",
"specified",
"property",
"to",
"FugaJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/j/model_json.go#L673-L676 |
152,268 | simon-whitehead/relayr | exchange.go | NewExchange | func NewExchange() *Exchange {
e := &Exchange{}
e.groups = make(map[string][]*client)
e.transports = map[string]Transport{
"websocket": newWebSocketTransport(e),
"longpoll": newLongPollTransport(e),
}
return e
} | go | func NewExchange() *Exchange {
e := &Exchange{}
e.groups = make(map[string][]*client)
e.transports = map[string]Transport{
"websocket": newWebSocketTransport(e),
"longpoll": newLongPollTransport(e),
}
return e
} | [
"func",
"NewExchange",
"(",
")",
"*",
"Exchange",
"{",
"e",
":=",
"&",
"Exchange",
"{",
"}",
"\n",
"e",
".",
"groups",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"client",
")",
"\n",
"e",
".",
"transports",
"=",
"map",
"[",
"st... | // NewExchange initializes and returns a new Exchange | [
"NewExchange",
"initializes",
"and",
"returns",
"a",
"new",
"Exchange"
] | 3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5 | https://github.com/simon-whitehead/relayr/blob/3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5/exchange.go#L60-L69 |
152,269 | simon-whitehead/relayr | exchange.go | RegisterRelay | func (e *Exchange) RegisterRelay(x interface{}) {
t := reflect.TypeOf(x)
methods := e.getMethodsForType(t)
e.relays = append(e.relays, Relay{Name: t.Name(), t: t, methods: methods, exchange: e})
} | go | func (e *Exchange) RegisterRelay(x interface{}) {
t := reflect.TypeOf(x)
methods := e.getMethodsForType(t)
e.relays = append(e.relays, Relay{Name: t.Name(), t: t, methods: methods, exchange: e})
} | [
"func",
"(",
"e",
"*",
"Exchange",
")",
"RegisterRelay",
"(",
"x",
"interface",
"{",
"}",
")",
"{",
"t",
":=",
"reflect",
".",
"TypeOf",
"(",
"x",
")",
"\n\n",
"methods",
":=",
"e",
".",
"getMethodsForType",
"(",
"t",
")",
"\n\n",
"e",
".",
"relays... | // RegisterRelay registers a struct as a Relay with the Exchange. This allows clients
// to invoke server methods on a Relay and allows the Exchange to invoke
// methods on a Relay on the server side. | [
"RegisterRelay",
"registers",
"a",
"struct",
"as",
"a",
"Relay",
"with",
"the",
"Exchange",
".",
"This",
"allows",
"clients",
"to",
"invoke",
"server",
"methods",
"on",
"a",
"Relay",
"and",
"allows",
"the",
"Exchange",
"to",
"invoke",
"methods",
"on",
"a",
... | 3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5 | https://github.com/simon-whitehead/relayr/blob/3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5/exchange.go#L189-L195 |
152,270 | simon-whitehead/relayr | exchange.go | Relay | func (e *Exchange) Relay(x interface{}) *Relay {
return e.getRelayByName(reflect.TypeOf(x).Name(), generateConnectionID())
} | go | func (e *Exchange) Relay(x interface{}) *Relay {
return e.getRelayByName(reflect.TypeOf(x).Name(), generateConnectionID())
} | [
"func",
"(",
"e",
"*",
"Exchange",
")",
"Relay",
"(",
"x",
"interface",
"{",
"}",
")",
"*",
"Relay",
"{",
"return",
"e",
".",
"getRelayByName",
"(",
"reflect",
".",
"TypeOf",
"(",
"x",
")",
".",
"Name",
"(",
")",
",",
"generateConnectionID",
"(",
"... | // Relay generates an instance of a Relay, allowing calls to be made to
// it on the server side. It is generated a random ConnectionID for the duration
// of the call and it does not represent an actual client. | [
"Relay",
"generates",
"an",
"instance",
"of",
"a",
"Relay",
"allowing",
"calls",
"to",
"be",
"made",
"to",
"it",
"on",
"the",
"server",
"side",
".",
"It",
"is",
"generated",
"a",
"random",
"ConnectionID",
"for",
"the",
"duration",
"of",
"the",
"call",
"a... | 3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5 | https://github.com/simon-whitehead/relayr/blob/3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5/exchange.go#L253-L255 |
152,271 | simon-whitehead/relayr | groupOps.go | Add | func (g *GroupOperations) Add(connectionID string) {
g.e.addToGroup(g.group, connectionID)
} | go | func (g *GroupOperations) Add(connectionID string) {
g.e.addToGroup(g.group, connectionID)
} | [
"func",
"(",
"g",
"*",
"GroupOperations",
")",
"Add",
"(",
"connectionID",
"string",
")",
"{",
"g",
".",
"e",
".",
"addToGroup",
"(",
"g",
".",
"group",
",",
"connectionID",
")",
"\n",
"}"
] | // Add adds a client to a group via its ConnectionID. It
// is a member of the group for the remainder of its
// connection. At that point, the client must re-negotiate
// its place within the group to be considered a member of it. | [
"Add",
"adds",
"a",
"client",
"to",
"a",
"group",
"via",
"its",
"ConnectionID",
".",
"It",
"is",
"a",
"member",
"of",
"the",
"group",
"for",
"the",
"remainder",
"of",
"its",
"connection",
".",
"At",
"that",
"point",
"the",
"client",
"must",
"re",
"-",
... | 3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5 | https://github.com/simon-whitehead/relayr/blob/3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5/groupOps.go#L16-L18 |
152,272 | simon-whitehead/relayr | groupOps.go | Remove | func (g *GroupOperations) Remove(connectionID string) {
g.e.removeFromGroupByID(g.group, connectionID)
} | go | func (g *GroupOperations) Remove(connectionID string) {
g.e.removeFromGroupByID(g.group, connectionID)
} | [
"func",
"(",
"g",
"*",
"GroupOperations",
")",
"Remove",
"(",
"connectionID",
"string",
")",
"{",
"g",
".",
"e",
".",
"removeFromGroupByID",
"(",
"g",
".",
"group",
",",
"connectionID",
")",
"\n",
"}"
] | // Remove removes a client from a group via its ConnectionID. | [
"Remove",
"removes",
"a",
"client",
"from",
"a",
"group",
"via",
"its",
"ConnectionID",
"."
] | 3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5 | https://github.com/simon-whitehead/relayr/blob/3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5/groupOps.go#L21-L23 |
152,273 | simon-whitehead/relayr | groupOps.go | Call | func (g *GroupOperations) Call(fn string, args ...interface{}) {
g.e.callGroupMethod(g.relay, g.group, fn, args...)
} | go | func (g *GroupOperations) Call(fn string, args ...interface{}) {
g.e.callGroupMethod(g.relay, g.group, fn, args...)
} | [
"func",
"(",
"g",
"*",
"GroupOperations",
")",
"Call",
"(",
"fn",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"g",
".",
"e",
".",
"callGroupMethod",
"(",
"g",
".",
"relay",
",",
"g",
".",
"group",
",",
"fn",
",",
"args",
"...",... | // Call invokes a client-side method across a Group of clients,
// passing args to them. | [
"Call",
"invokes",
"a",
"client",
"-",
"side",
"method",
"across",
"a",
"Group",
"of",
"clients",
"passing",
"args",
"to",
"them",
"."
] | 3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5 | https://github.com/simon-whitehead/relayr/blob/3e5ef072cb350bd883ee7a74d76ec1b5c84e64f5/groupOps.go#L27-L29 |
152,274 | favclip/jwg | misc/fixture/m/model_json.go | Remove | func (b *SampleJSONBuilder) Remove(info *SamplePropertyInfo) *SampleJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | go | func (b *SampleJSONBuilder) Remove(info *SamplePropertyInfo) *SampleJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | [
"func",
"(",
"b",
"*",
"SampleJSONBuilder",
")",
"Remove",
"(",
"info",
"*",
"SamplePropertyInfo",
")",
"*",
"SampleJSONBuilder",
"{",
"delete",
"(",
"b",
".",
"_properties",
",",
"info",
".",
"fieldName",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // Remove specified property to SampleJSONBuilder. | [
"Remove",
"specified",
"property",
"to",
"SampleJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/m/model_json.go#L171-L174 |
152,275 | favclip/jwg | generator.go | WithJWG | func (f *BuildField) WithJWG() bool {
fieldType, err := genbase.ExprToBaseTypeName(f.fieldInfo.Type)
if err != nil {
panic(err)
}
for _, st := range f.parent.parent.Structs {
if fieldType == st.Name() {
return true
}
}
return false
} | go | func (f *BuildField) WithJWG() bool {
fieldType, err := genbase.ExprToBaseTypeName(f.fieldInfo.Type)
if err != nil {
panic(err)
}
for _, st := range f.parent.parent.Structs {
if fieldType == st.Name() {
return true
}
}
return false
} | [
"func",
"(",
"f",
"*",
"BuildField",
")",
"WithJWG",
"(",
")",
"bool",
"{",
"fieldType",
",",
"err",
":=",
"genbase",
".",
"ExprToBaseTypeName",
"(",
"f",
".",
"fieldInfo",
".",
"Type",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
... | // WithJWG returns is field jwg annotated type. | [
"WithJWG",
"returns",
"is",
"field",
"jwg",
"annotated",
"type",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/generator.go#L878-L889 |
152,276 | favclip/jwg | generator.go | TagString | func (tag *BuildTag) TagString() string {
result := tag.Name
if tag.isNoomitempty() {
if tag.OmitEmpty {
result += ",omitempty"
}
} else {
if tag.OmitEmpty || !tag.ShouldEmit {
result += ",omitempty"
}
}
if tag.String { // TODO add special support for int64
result += ",string"
}
return "json:\"" + result + "\""
} | go | func (tag *BuildTag) TagString() string {
result := tag.Name
if tag.isNoomitempty() {
if tag.OmitEmpty {
result += ",omitempty"
}
} else {
if tag.OmitEmpty || !tag.ShouldEmit {
result += ",omitempty"
}
}
if tag.String { // TODO add special support for int64
result += ",string"
}
return "json:\"" + result + "\""
} | [
"func",
"(",
"tag",
"*",
"BuildTag",
")",
"TagString",
"(",
")",
"string",
"{",
"result",
":=",
"tag",
".",
"Name",
"\n",
"if",
"tag",
".",
"isNoomitempty",
"(",
")",
"{",
"if",
"tag",
".",
"OmitEmpty",
"{",
"result",
"+=",
"\"",
"\"",
"\n",
"}",
... | // TagString build tag string. | [
"TagString",
"build",
"tag",
"string",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/generator.go#L917-L932 |
152,277 | favclip/jwg | generator.go | isNoomitempty | func (tag *BuildTag) isNoomitempty() bool {
if tag.field.parent.parent.noOmitempty {
return true
}
typeName, err := genbase.ExprToTypeName(tag.field.fieldInfo.Type)
if err != nil {
return false
}
for _, t := range tag.field.parent.parent.noOmitemptyFieldTypes {
if t == typeName {
return true
}
}
return false
} | go | func (tag *BuildTag) isNoomitempty() bool {
if tag.field.parent.parent.noOmitempty {
return true
}
typeName, err := genbase.ExprToTypeName(tag.field.fieldInfo.Type)
if err != nil {
return false
}
for _, t := range tag.field.parent.parent.noOmitemptyFieldTypes {
if t == typeName {
return true
}
}
return false
} | [
"func",
"(",
"tag",
"*",
"BuildTag",
")",
"isNoomitempty",
"(",
")",
"bool",
"{",
"if",
"tag",
".",
"field",
".",
"parent",
".",
"parent",
".",
"noOmitempty",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"typeName",
",",
"err",
":=",
"genbase",
".",
"Ex... | // isNoomitempty returns whether to suppress omitempty tag | [
"isNoomitempty",
"returns",
"whether",
"to",
"suppress",
"omitempty",
"tag"
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/generator.go#L935-L952 |
152,278 | IBM-Cloud/go-cloudant-example | Godeps/_workspace/src/golang.org/x/net/publicsuffix/gen.go | child | func (n *node) child(label string) *node {
for _, c := range n.children {
if c.label == label {
return c
}
}
c := &node{
label: label,
nodeType: nodeTypeParentOnly,
icann: true,
}
n.children = append(n.children, c)
sort.Sort(byLabel(n.children))
return c
} | go | func (n *node) child(label string) *node {
for _, c := range n.children {
if c.label == label {
return c
}
}
c := &node{
label: label,
nodeType: nodeTypeParentOnly,
icann: true,
}
n.children = append(n.children, c)
sort.Sort(byLabel(n.children))
return c
} | [
"func",
"(",
"n",
"*",
"node",
")",
"child",
"(",
"label",
"string",
")",
"*",
"node",
"{",
"for",
"_",
",",
"c",
":=",
"range",
"n",
".",
"children",
"{",
"if",
"c",
".",
"label",
"==",
"label",
"{",
"return",
"c",
"\n",
"}",
"\n",
"}",
"\n"... | // child returns the child of n with the given label. The child is created if
// it did not exist beforehand. | [
"child",
"returns",
"the",
"child",
"of",
"n",
"with",
"the",
"given",
"label",
".",
"The",
"child",
"is",
"created",
"if",
"it",
"did",
"not",
"exist",
"beforehand",
"."
] | 7bc1d9087cbf90cda1083be2517da1f68909d66c | https://github.com/IBM-Cloud/go-cloudant-example/blob/7bc1d9087cbf90cda1083be2517da1f68909d66c/Godeps/_workspace/src/golang.org/x/net/publicsuffix/gen.go#L410-L424 |
152,279 | favclip/jwg | misc/fixture/i/model_json.go | NewPersonJSONBuilder | func NewPersonJSONBuilder() *PersonJSONBuilder {
jb := &PersonJSONBuilder{
_properties: map[string]*PersonPropertyInfo{},
_jsonPropertyMap: map[string]*PersonPropertyInfo{},
_structPropertyMap: map[string]*PersonPropertyInfo{},
Name: &PersonPropertyInfo{
fieldName: "Name",
jsonName: "name",
Encoder: func(src *Person, dest *PersonJSON) error {
if src == nil {
return nil
}
dest.Name = src.Name
return nil
},
Decoder: func(src *PersonJSON, dest *Person) error {
if src == nil {
return nil
}
dest.Name = src.Name
return nil
},
},
Age: &PersonPropertyInfo{
fieldName: "Age",
jsonName: "age",
Encoder: func(src *Person, dest *PersonJSON) error {
if src == nil {
return nil
}
dest.Age = src.Age
return nil
},
Decoder: func(src *PersonJSON, dest *Person) error {
if src == nil {
return nil
}
dest.Age = src.Age
return nil
},
},
Password: &PersonPropertyInfo{
fieldName: "Password",
jsonName: "password",
Encoder: func(src *Person, dest *PersonJSON) error {
if src == nil {
return nil
}
dest.Password = src.Password
return nil
},
Decoder: func(src *PersonJSON, dest *Person) error {
if src == nil {
return nil
}
dest.Password = src.Password
return nil
},
},
}
jb._structPropertyMap["Name"] = jb.Name
jb._jsonPropertyMap["name"] = jb.Name
jb._structPropertyMap["Age"] = jb.Age
jb._jsonPropertyMap["age"] = jb.Age
jb._structPropertyMap["Password"] = jb.Password
jb._jsonPropertyMap["password"] = jb.Password
return jb
} | go | func NewPersonJSONBuilder() *PersonJSONBuilder {
jb := &PersonJSONBuilder{
_properties: map[string]*PersonPropertyInfo{},
_jsonPropertyMap: map[string]*PersonPropertyInfo{},
_structPropertyMap: map[string]*PersonPropertyInfo{},
Name: &PersonPropertyInfo{
fieldName: "Name",
jsonName: "name",
Encoder: func(src *Person, dest *PersonJSON) error {
if src == nil {
return nil
}
dest.Name = src.Name
return nil
},
Decoder: func(src *PersonJSON, dest *Person) error {
if src == nil {
return nil
}
dest.Name = src.Name
return nil
},
},
Age: &PersonPropertyInfo{
fieldName: "Age",
jsonName: "age",
Encoder: func(src *Person, dest *PersonJSON) error {
if src == nil {
return nil
}
dest.Age = src.Age
return nil
},
Decoder: func(src *PersonJSON, dest *Person) error {
if src == nil {
return nil
}
dest.Age = src.Age
return nil
},
},
Password: &PersonPropertyInfo{
fieldName: "Password",
jsonName: "password",
Encoder: func(src *Person, dest *PersonJSON) error {
if src == nil {
return nil
}
dest.Password = src.Password
return nil
},
Decoder: func(src *PersonJSON, dest *Person) error {
if src == nil {
return nil
}
dest.Password = src.Password
return nil
},
},
}
jb._structPropertyMap["Name"] = jb.Name
jb._jsonPropertyMap["name"] = jb.Name
jb._structPropertyMap["Age"] = jb.Age
jb._jsonPropertyMap["age"] = jb.Age
jb._structPropertyMap["Password"] = jb.Password
jb._jsonPropertyMap["password"] = jb.Password
return jb
} | [
"func",
"NewPersonJSONBuilder",
"(",
")",
"*",
"PersonJSONBuilder",
"{",
"jb",
":=",
"&",
"PersonJSONBuilder",
"{",
"_properties",
":",
"map",
"[",
"string",
"]",
"*",
"PersonPropertyInfo",
"{",
"}",
",",
"_jsonPropertyMap",
":",
"map",
"[",
"string",
"]",
"... | // NewPersonJSONBuilder make new PersonJSONBuilder. | [
"NewPersonJSONBuilder",
"make",
"new",
"PersonJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/i/model_json.go#L54-L121 |
152,280 | favclip/jwg | misc/fixture/i/model_json.go | Properties | func (b *PersonJSONBuilder) Properties() []*PersonPropertyInfo {
return []*PersonPropertyInfo{
b.Name,
b.Age,
b.Password,
}
} | go | func (b *PersonJSONBuilder) Properties() []*PersonPropertyInfo {
return []*PersonPropertyInfo{
b.Name,
b.Age,
b.Password,
}
} | [
"func",
"(",
"b",
"*",
"PersonJSONBuilder",
")",
"Properties",
"(",
")",
"[",
"]",
"*",
"PersonPropertyInfo",
"{",
"return",
"[",
"]",
"*",
"PersonPropertyInfo",
"{",
"b",
".",
"Name",
",",
"b",
".",
"Age",
",",
"b",
".",
"Password",
",",
"}",
"\n",
... | // Properties returns all properties on PersonJSONBuilder. | [
"Properties",
"returns",
"all",
"properties",
"on",
"PersonJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/i/model_json.go#L124-L130 |
152,281 | favclip/jwg | misc/fixture/i/model_json.go | AddAll | func (b *PersonJSONBuilder) AddAll() *PersonJSONBuilder {
b._properties["Name"] = b.Name
b._properties["Age"] = b.Age
b._properties["Password"] = b.Password
return b
} | go | func (b *PersonJSONBuilder) AddAll() *PersonJSONBuilder {
b._properties["Name"] = b.Name
b._properties["Age"] = b.Age
b._properties["Password"] = b.Password
return b
} | [
"func",
"(",
"b",
"*",
"PersonJSONBuilder",
")",
"AddAll",
"(",
")",
"*",
"PersonJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"\"",
"\"",
"]",
"=",
"b",
".",
"Name",
"\n",
"b",
".",
"_properties",
"[",
"\"",
"\"",
"]",
"=",
"b",
".",
"Age",
"... | // AddAll adds all property to PersonJSONBuilder. | [
"AddAll",
"adds",
"all",
"property",
"to",
"PersonJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/i/model_json.go#L133-L138 |
152,282 | favclip/jwg | misc/fixture/i/model_json.go | Add | func (b *PersonJSONBuilder) Add(info *PersonPropertyInfo) *PersonJSONBuilder {
b._properties[info.fieldName] = info
return b
} | go | func (b *PersonJSONBuilder) Add(info *PersonPropertyInfo) *PersonJSONBuilder {
b._properties[info.fieldName] = info
return b
} | [
"func",
"(",
"b",
"*",
"PersonJSONBuilder",
")",
"Add",
"(",
"info",
"*",
"PersonPropertyInfo",
")",
"*",
"PersonJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"info",
".",
"fieldName",
"]",
"=",
"info",
"\n",
"return",
"b",
"\n",
"}"
] | // Add specified property to PersonJSONBuilder. | [
"Add",
"specified",
"property",
"to",
"PersonJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/i/model_json.go#L141-L144 |
152,283 | favclip/jwg | misc/fixture/i/model_json.go | Remove | func (b *PersonJSONBuilder) Remove(info *PersonPropertyInfo) *PersonJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | go | func (b *PersonJSONBuilder) Remove(info *PersonPropertyInfo) *PersonJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | [
"func",
"(",
"b",
"*",
"PersonJSONBuilder",
")",
"Remove",
"(",
"info",
"*",
"PersonPropertyInfo",
")",
"*",
"PersonJSONBuilder",
"{",
"delete",
"(",
"b",
".",
"_properties",
",",
"info",
".",
"fieldName",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // Remove specified property to PersonJSONBuilder. | [
"Remove",
"specified",
"property",
"to",
"PersonJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/i/model_json.go#L171-L174 |
152,284 | favclip/jwg | misc/fixture/i/model_json.go | NewPeopleJSONBuilder | func NewPeopleJSONBuilder() *PeopleJSONBuilder {
jb := &PeopleJSONBuilder{
_properties: map[string]*PeoplePropertyInfo{},
_jsonPropertyMap: map[string]*PeoplePropertyInfo{},
_structPropertyMap: map[string]*PeoplePropertyInfo{},
ShowPrivateInfo: &PeoplePropertyInfo{
fieldName: "ShowPrivateInfo",
jsonName: "showPrivateInfo",
Encoder: func(src *People, dest *PeopleJSON) error {
if src == nil {
return nil
}
dest.ShowPrivateInfo = src.ShowPrivateInfo
return nil
},
Decoder: func(src *PeopleJSON, dest *People) error {
if src == nil {
return nil
}
dest.ShowPrivateInfo = src.ShowPrivateInfo
return nil
},
},
List: &PeoplePropertyInfo{
fieldName: "List",
jsonName: "list",
Encoder: func(src *People, dest *PeopleJSON) error {
if src == nil {
return nil
}
list, err := NewPersonJSONBuilder().AddAll().ConvertList(src.List)
if err != nil {
return err
}
dest.List = ([]*PersonJSON)(list)
return nil
},
Decoder: func(src *PeopleJSON, dest *People) error {
if src == nil {
return nil
}
list := make([]*Person, len(src.List))
for idx, obj := range src.List {
if obj == nil {
continue
}
d, err := obj.Convert()
if err != nil {
return err
}
list[idx] = d
}
dest.List = list
return nil
},
},
}
jb._structPropertyMap["ShowPrivateInfo"] = jb.ShowPrivateInfo
jb._jsonPropertyMap["showPrivateInfo"] = jb.ShowPrivateInfo
jb._structPropertyMap["List"] = jb.List
jb._jsonPropertyMap["list"] = jb.List
return jb
} | go | func NewPeopleJSONBuilder() *PeopleJSONBuilder {
jb := &PeopleJSONBuilder{
_properties: map[string]*PeoplePropertyInfo{},
_jsonPropertyMap: map[string]*PeoplePropertyInfo{},
_structPropertyMap: map[string]*PeoplePropertyInfo{},
ShowPrivateInfo: &PeoplePropertyInfo{
fieldName: "ShowPrivateInfo",
jsonName: "showPrivateInfo",
Encoder: func(src *People, dest *PeopleJSON) error {
if src == nil {
return nil
}
dest.ShowPrivateInfo = src.ShowPrivateInfo
return nil
},
Decoder: func(src *PeopleJSON, dest *People) error {
if src == nil {
return nil
}
dest.ShowPrivateInfo = src.ShowPrivateInfo
return nil
},
},
List: &PeoplePropertyInfo{
fieldName: "List",
jsonName: "list",
Encoder: func(src *People, dest *PeopleJSON) error {
if src == nil {
return nil
}
list, err := NewPersonJSONBuilder().AddAll().ConvertList(src.List)
if err != nil {
return err
}
dest.List = ([]*PersonJSON)(list)
return nil
},
Decoder: func(src *PeopleJSON, dest *People) error {
if src == nil {
return nil
}
list := make([]*Person, len(src.List))
for idx, obj := range src.List {
if obj == nil {
continue
}
d, err := obj.Convert()
if err != nil {
return err
}
list[idx] = d
}
dest.List = list
return nil
},
},
}
jb._structPropertyMap["ShowPrivateInfo"] = jb.ShowPrivateInfo
jb._jsonPropertyMap["showPrivateInfo"] = jb.ShowPrivateInfo
jb._structPropertyMap["List"] = jb.List
jb._jsonPropertyMap["list"] = jb.List
return jb
} | [
"func",
"NewPeopleJSONBuilder",
"(",
")",
"*",
"PeopleJSONBuilder",
"{",
"jb",
":=",
"&",
"PeopleJSONBuilder",
"{",
"_properties",
":",
"map",
"[",
"string",
"]",
"*",
"PeoplePropertyInfo",
"{",
"}",
",",
"_jsonPropertyMap",
":",
"map",
"[",
"string",
"]",
"... | // NewPeopleJSONBuilder make new PeopleJSONBuilder. | [
"NewPeopleJSONBuilder",
"make",
"new",
"PeopleJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/i/model_json.go#L317-L379 |
152,285 | favclip/jwg | misc/fixture/i/model_json.go | AddAll | func (b *PeopleJSONBuilder) AddAll() *PeopleJSONBuilder {
b._properties["ShowPrivateInfo"] = b.ShowPrivateInfo
b._properties["List"] = b.List
return b
} | go | func (b *PeopleJSONBuilder) AddAll() *PeopleJSONBuilder {
b._properties["ShowPrivateInfo"] = b.ShowPrivateInfo
b._properties["List"] = b.List
return b
} | [
"func",
"(",
"b",
"*",
"PeopleJSONBuilder",
")",
"AddAll",
"(",
")",
"*",
"PeopleJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"\"",
"\"",
"]",
"=",
"b",
".",
"ShowPrivateInfo",
"\n",
"b",
".",
"_properties",
"[",
"\"",
"\"",
"]",
"=",
"b",
".",
... | // AddAll adds all property to PeopleJSONBuilder. | [
"AddAll",
"adds",
"all",
"property",
"to",
"PeopleJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/i/model_json.go#L390-L394 |
152,286 | favclip/jwg | misc/fixture/i/model_json.go | Add | func (b *PeopleJSONBuilder) Add(info *PeoplePropertyInfo) *PeopleJSONBuilder {
b._properties[info.fieldName] = info
return b
} | go | func (b *PeopleJSONBuilder) Add(info *PeoplePropertyInfo) *PeopleJSONBuilder {
b._properties[info.fieldName] = info
return b
} | [
"func",
"(",
"b",
"*",
"PeopleJSONBuilder",
")",
"Add",
"(",
"info",
"*",
"PeoplePropertyInfo",
")",
"*",
"PeopleJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"info",
".",
"fieldName",
"]",
"=",
"info",
"\n",
"return",
"b",
"\n",
"}"
] | // Add specified property to PeopleJSONBuilder. | [
"Add",
"specified",
"property",
"to",
"PeopleJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/i/model_json.go#L397-L400 |
152,287 | favclip/jwg | misc/fixture/i/model_json.go | Remove | func (b *PeopleJSONBuilder) Remove(info *PeoplePropertyInfo) *PeopleJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | go | func (b *PeopleJSONBuilder) Remove(info *PeoplePropertyInfo) *PeopleJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | [
"func",
"(",
"b",
"*",
"PeopleJSONBuilder",
")",
"Remove",
"(",
"info",
"*",
"PeoplePropertyInfo",
")",
"*",
"PeopleJSONBuilder",
"{",
"delete",
"(",
"b",
".",
"_properties",
",",
"info",
".",
"fieldName",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // Remove specified property to PeopleJSONBuilder. | [
"Remove",
"specified",
"property",
"to",
"PeopleJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/i/model_json.go#L427-L430 |
152,288 | favclip/jwg | misc/fixture/g/model_json.go | NewInnerJSONBuilder | func NewInnerJSONBuilder() *InnerJSONBuilder {
jb := &InnerJSONBuilder{
_properties: map[string]*InnerPropertyInfo{},
_jsonPropertyMap: map[string]*InnerPropertyInfo{},
_structPropertyMap: map[string]*InnerPropertyInfo{},
A: &InnerPropertyInfo{
fieldName: "A",
jsonName: "a",
Encoder: func(src *Inner, dest *InnerJSON) error {
if src == nil {
return nil
}
dest.A = src.A
return nil
},
Decoder: func(src *InnerJSON, dest *Inner) error {
if src == nil {
return nil
}
dest.A = src.A
return nil
},
},
}
jb._structPropertyMap["A"] = jb.A
jb._jsonPropertyMap["a"] = jb.A
return jb
} | go | func NewInnerJSONBuilder() *InnerJSONBuilder {
jb := &InnerJSONBuilder{
_properties: map[string]*InnerPropertyInfo{},
_jsonPropertyMap: map[string]*InnerPropertyInfo{},
_structPropertyMap: map[string]*InnerPropertyInfo{},
A: &InnerPropertyInfo{
fieldName: "A",
jsonName: "a",
Encoder: func(src *Inner, dest *InnerJSON) error {
if src == nil {
return nil
}
dest.A = src.A
return nil
},
Decoder: func(src *InnerJSON, dest *Inner) error {
if src == nil {
return nil
}
dest.A = src.A
return nil
},
},
}
jb._structPropertyMap["A"] = jb.A
jb._jsonPropertyMap["a"] = jb.A
return jb
} | [
"func",
"NewInnerJSONBuilder",
"(",
")",
"*",
"InnerJSONBuilder",
"{",
"jb",
":=",
"&",
"InnerJSONBuilder",
"{",
"_properties",
":",
"map",
"[",
"string",
"]",
"*",
"InnerPropertyInfo",
"{",
"}",
",",
"_jsonPropertyMap",
":",
"map",
"[",
"string",
"]",
"*",
... | // NewInnerJSONBuilder make new InnerJSONBuilder. | [
"NewInnerJSONBuilder",
"make",
"new",
"InnerJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/g/model_json.go#L50-L77 |
152,289 | favclip/jwg | misc/fixture/g/model_json.go | Add | func (b *InnerJSONBuilder) Add(infos ...*InnerPropertyInfo) *InnerJSONBuilder {
for _, info := range infos {
b._properties[info.fieldName] = info
}
return b
} | go | func (b *InnerJSONBuilder) Add(infos ...*InnerPropertyInfo) *InnerJSONBuilder {
for _, info := range infos {
b._properties[info.fieldName] = info
}
return b
} | [
"func",
"(",
"b",
"*",
"InnerJSONBuilder",
")",
"Add",
"(",
"infos",
"...",
"*",
"InnerPropertyInfo",
")",
"*",
"InnerJSONBuilder",
"{",
"for",
"_",
",",
"info",
":=",
"range",
"infos",
"{",
"b",
".",
"_properties",
"[",
"info",
".",
"fieldName",
"]",
... | // Add specified property to InnerJSONBuilder. | [
"Add",
"specified",
"property",
"to",
"InnerJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/g/model_json.go#L93-L98 |
152,290 | favclip/jwg | misc/fixture/g/model_json.go | Remove | func (b *InnerJSONBuilder) Remove(infos ...*InnerPropertyInfo) *InnerJSONBuilder {
for _, info := range infos {
delete(b._properties, info.fieldName)
}
return b
} | go | func (b *InnerJSONBuilder) Remove(infos ...*InnerPropertyInfo) *InnerJSONBuilder {
for _, info := range infos {
delete(b._properties, info.fieldName)
}
return b
} | [
"func",
"(",
"b",
"*",
"InnerJSONBuilder",
")",
"Remove",
"(",
"infos",
"...",
"*",
"InnerPropertyInfo",
")",
"*",
"InnerJSONBuilder",
"{",
"for",
"_",
",",
"info",
":=",
"range",
"infos",
"{",
"delete",
"(",
"b",
".",
"_properties",
",",
"info",
".",
... | // Remove specified property to InnerJSONBuilder. | [
"Remove",
"specified",
"property",
"to",
"InnerJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/g/model_json.go#L125-L130 |
152,291 | favclip/jwg | misc/fixture/k/model_json.go | NewBarJSONBuilder | func NewBarJSONBuilder() *BarJSONBuilder {
jb := &BarJSONBuilder{
_properties: map[string]*BarPropertyInfo{},
_jsonPropertyMap: map[string]*BarPropertyInfo{},
_structPropertyMap: map[string]*BarPropertyInfo{},
Tests: &BarPropertyInfo{
fieldName: "Tests",
jsonName: "tests",
Encoder: func(src *Bar, dest *BarJSON) error {
if src == nil {
return nil
}
dest.Tests = src.Tests
return nil
},
Decoder: func(src *BarJSON, dest *Bar) error {
if src == nil {
return nil
}
dest.Tests = src.Tests
return nil
},
},
}
jb._structPropertyMap["Tests"] = jb.Tests
jb._jsonPropertyMap["tests"] = jb.Tests
return jb
} | go | func NewBarJSONBuilder() *BarJSONBuilder {
jb := &BarJSONBuilder{
_properties: map[string]*BarPropertyInfo{},
_jsonPropertyMap: map[string]*BarPropertyInfo{},
_structPropertyMap: map[string]*BarPropertyInfo{},
Tests: &BarPropertyInfo{
fieldName: "Tests",
jsonName: "tests",
Encoder: func(src *Bar, dest *BarJSON) error {
if src == nil {
return nil
}
dest.Tests = src.Tests
return nil
},
Decoder: func(src *BarJSON, dest *Bar) error {
if src == nil {
return nil
}
dest.Tests = src.Tests
return nil
},
},
}
jb._structPropertyMap["Tests"] = jb.Tests
jb._jsonPropertyMap["tests"] = jb.Tests
return jb
} | [
"func",
"NewBarJSONBuilder",
"(",
")",
"*",
"BarJSONBuilder",
"{",
"jb",
":=",
"&",
"BarJSONBuilder",
"{",
"_properties",
":",
"map",
"[",
"string",
"]",
"*",
"BarPropertyInfo",
"{",
"}",
",",
"_jsonPropertyMap",
":",
"map",
"[",
"string",
"]",
"*",
"BarPr... | // NewBarJSONBuilder make new BarJSONBuilder. | [
"NewBarJSONBuilder",
"make",
"new",
"BarJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/k/model_json.go#L269-L296 |
152,292 | favclip/jwg | misc/fixture/k/model_json.go | Add | func (b *BarJSONBuilder) Add(info *BarPropertyInfo) *BarJSONBuilder {
b._properties[info.fieldName] = info
return b
} | go | func (b *BarJSONBuilder) Add(info *BarPropertyInfo) *BarJSONBuilder {
b._properties[info.fieldName] = info
return b
} | [
"func",
"(",
"b",
"*",
"BarJSONBuilder",
")",
"Add",
"(",
"info",
"*",
"BarPropertyInfo",
")",
"*",
"BarJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"info",
".",
"fieldName",
"]",
"=",
"info",
"\n",
"return",
"b",
"\n",
"}"
] | // Add specified property to BarJSONBuilder. | [
"Add",
"specified",
"property",
"to",
"BarJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/k/model_json.go#L312-L315 |
152,293 | favclip/jwg | misc/fixture/k/model_json.go | Remove | func (b *BarJSONBuilder) Remove(info *BarPropertyInfo) *BarJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | go | func (b *BarJSONBuilder) Remove(info *BarPropertyInfo) *BarJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | [
"func",
"(",
"b",
"*",
"BarJSONBuilder",
")",
"Remove",
"(",
"info",
"*",
"BarPropertyInfo",
")",
"*",
"BarJSONBuilder",
"{",
"delete",
"(",
"b",
".",
"_properties",
",",
"info",
".",
"fieldName",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // Remove specified property to BarJSONBuilder. | [
"Remove",
"specified",
"property",
"to",
"BarJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/k/model_json.go#L342-L345 |
152,294 | favclip/jwg | misc/fixture/f/model_json.go | NewSampleFJSONBuilder | func NewSampleFJSONBuilder() *SampleFJSONBuilder {
jb := &SampleFJSONBuilder{
_properties: map[string]*SampleFPropertyInfo{},
_jsonPropertyMap: map[string]*SampleFPropertyInfo{},
_structPropertyMap: map[string]*SampleFPropertyInfo{},
A: &SampleFPropertyInfo{
fieldName: "A",
jsonName: "a",
Encoder: func(src *SampleF, dest *SampleFJSON) error {
if src == nil {
return nil
}
dest.A = src.A
return nil
},
Decoder: func(src *SampleFJSON, dest *SampleF) error {
if src == nil {
return nil
}
dest.A = src.A
return nil
},
},
B: &SampleFPropertyInfo{
fieldName: "B",
jsonName: "b",
Encoder: func(src *SampleF, dest *SampleFJSON) error {
if src == nil {
return nil
}
dest.B = src.B
return nil
},
Decoder: func(src *SampleFJSON, dest *SampleF) error {
if src == nil {
return nil
}
dest.B = src.B
return nil
},
},
}
jb._structPropertyMap["A"] = jb.A
jb._jsonPropertyMap["a"] = jb.A
jb._structPropertyMap["B"] = jb.B
jb._jsonPropertyMap["b"] = jb.B
return jb
} | go | func NewSampleFJSONBuilder() *SampleFJSONBuilder {
jb := &SampleFJSONBuilder{
_properties: map[string]*SampleFPropertyInfo{},
_jsonPropertyMap: map[string]*SampleFPropertyInfo{},
_structPropertyMap: map[string]*SampleFPropertyInfo{},
A: &SampleFPropertyInfo{
fieldName: "A",
jsonName: "a",
Encoder: func(src *SampleF, dest *SampleFJSON) error {
if src == nil {
return nil
}
dest.A = src.A
return nil
},
Decoder: func(src *SampleFJSON, dest *SampleF) error {
if src == nil {
return nil
}
dest.A = src.A
return nil
},
},
B: &SampleFPropertyInfo{
fieldName: "B",
jsonName: "b",
Encoder: func(src *SampleF, dest *SampleFJSON) error {
if src == nil {
return nil
}
dest.B = src.B
return nil
},
Decoder: func(src *SampleFJSON, dest *SampleF) error {
if src == nil {
return nil
}
dest.B = src.B
return nil
},
},
}
jb._structPropertyMap["A"] = jb.A
jb._jsonPropertyMap["a"] = jb.A
jb._structPropertyMap["B"] = jb.B
jb._jsonPropertyMap["b"] = jb.B
return jb
} | [
"func",
"NewSampleFJSONBuilder",
"(",
")",
"*",
"SampleFJSONBuilder",
"{",
"jb",
":=",
"&",
"SampleFJSONBuilder",
"{",
"_properties",
":",
"map",
"[",
"string",
"]",
"*",
"SampleFPropertyInfo",
"{",
"}",
",",
"_jsonPropertyMap",
":",
"map",
"[",
"string",
"]",... | // NewSampleFJSONBuilder make new SampleFJSONBuilder. | [
"NewSampleFJSONBuilder",
"make",
"new",
"SampleFJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/f/model_json.go#L54-L101 |
152,295 | favclip/jwg | misc/fixture/f/model_json.go | AddAll | func (b *SampleFJSONBuilder) AddAll() *SampleFJSONBuilder {
b._properties["A"] = b.A
b._properties["B"] = b.B
return b
} | go | func (b *SampleFJSONBuilder) AddAll() *SampleFJSONBuilder {
b._properties["A"] = b.A
b._properties["B"] = b.B
return b
} | [
"func",
"(",
"b",
"*",
"SampleFJSONBuilder",
")",
"AddAll",
"(",
")",
"*",
"SampleFJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"\"",
"\"",
"]",
"=",
"b",
".",
"A",
"\n",
"b",
".",
"_properties",
"[",
"\"",
"\"",
"]",
"=",
"b",
".",
"B",
"\n"... | // AddAll adds all property to SampleFJSONBuilder. | [
"AddAll",
"adds",
"all",
"property",
"to",
"SampleFJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/f/model_json.go#L112-L116 |
152,296 | favclip/jwg | misc/fixture/f/model_json.go | Add | func (b *SampleFJSONBuilder) Add(info *SampleFPropertyInfo) *SampleFJSONBuilder {
b._properties[info.fieldName] = info
return b
} | go | func (b *SampleFJSONBuilder) Add(info *SampleFPropertyInfo) *SampleFJSONBuilder {
b._properties[info.fieldName] = info
return b
} | [
"func",
"(",
"b",
"*",
"SampleFJSONBuilder",
")",
"Add",
"(",
"info",
"*",
"SampleFPropertyInfo",
")",
"*",
"SampleFJSONBuilder",
"{",
"b",
".",
"_properties",
"[",
"info",
".",
"fieldName",
"]",
"=",
"info",
"\n",
"return",
"b",
"\n",
"}"
] | // Add specified property to SampleFJSONBuilder. | [
"Add",
"specified",
"property",
"to",
"SampleFJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/f/model_json.go#L119-L122 |
152,297 | favclip/jwg | misc/fixture/f/model_json.go | Remove | func (b *SampleFJSONBuilder) Remove(info *SampleFPropertyInfo) *SampleFJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | go | func (b *SampleFJSONBuilder) Remove(info *SampleFPropertyInfo) *SampleFJSONBuilder {
delete(b._properties, info.fieldName)
return b
} | [
"func",
"(",
"b",
"*",
"SampleFJSONBuilder",
")",
"Remove",
"(",
"info",
"*",
"SampleFPropertyInfo",
")",
"*",
"SampleFJSONBuilder",
"{",
"delete",
"(",
"b",
".",
"_properties",
",",
"info",
".",
"fieldName",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // Remove specified property to SampleFJSONBuilder. | [
"Remove",
"specified",
"property",
"to",
"SampleFJSONBuilder",
"."
] | 7e80df75dc7371766a7b1337000acaea44687b29 | https://github.com/favclip/jwg/blob/7e80df75dc7371766a7b1337000acaea44687b29/misc/fixture/f/model_json.go#L149-L152 |
152,298 | IBM-Cloud/go-cloudant-example | Godeps/_workspace/src/golang.org/x/net/publicsuffix/list.go | find | func find(label string, lo, hi uint32) uint32 {
for lo < hi {
mid := lo + (hi-lo)/2
s := nodeLabel(mid)
if s < label {
lo = mid + 1
} else if s == label {
return mid
} else {
hi = mid
}
}
return notFound
} | go | func find(label string, lo, hi uint32) uint32 {
for lo < hi {
mid := lo + (hi-lo)/2
s := nodeLabel(mid)
if s < label {
lo = mid + 1
} else if s == label {
return mid
} else {
hi = mid
}
}
return notFound
} | [
"func",
"find",
"(",
"label",
"string",
",",
"lo",
",",
"hi",
"uint32",
")",
"uint32",
"{",
"for",
"lo",
"<",
"hi",
"{",
"mid",
":=",
"lo",
"+",
"(",
"hi",
"-",
"lo",
")",
"/",
"2",
"\n",
"s",
":=",
"nodeLabel",
"(",
"mid",
")",
"\n",
"if",
... | // find returns the index of the node in the range [lo, hi) whose label equals
// label, or notFound if there is no such node. The range is assumed to be in
// strictly increasing node label order. | [
"find",
"returns",
"the",
"index",
"of",
"the",
"node",
"in",
"the",
"range",
"[",
"lo",
"hi",
")",
"whose",
"label",
"equals",
"label",
"or",
"notFound",
"if",
"there",
"is",
"no",
"such",
"node",
".",
"The",
"range",
"is",
"assumed",
"to",
"be",
"i... | 7bc1d9087cbf90cda1083be2517da1f68909d66c | https://github.com/IBM-Cloud/go-cloudant-example/blob/7bc1d9087cbf90cda1083be2517da1f68909d66c/Godeps/_workspace/src/golang.org/x/net/publicsuffix/list.go#L97-L110 |
152,299 | IBM-Cloud/go-cloudant-example | Godeps/_workspace/src/golang.org/x/net/publicsuffix/list.go | nodeLabel | func nodeLabel(i uint32) string {
x := nodes[i]
length := x & (1<<nodesBitsTextLength - 1)
x >>= nodesBitsTextLength
offset := x & (1<<nodesBitsTextOffset - 1)
return text[offset : offset+length]
} | go | func nodeLabel(i uint32) string {
x := nodes[i]
length := x & (1<<nodesBitsTextLength - 1)
x >>= nodesBitsTextLength
offset := x & (1<<nodesBitsTextOffset - 1)
return text[offset : offset+length]
} | [
"func",
"nodeLabel",
"(",
"i",
"uint32",
")",
"string",
"{",
"x",
":=",
"nodes",
"[",
"i",
"]",
"\n",
"length",
":=",
"x",
"&",
"(",
"1",
"<<",
"nodesBitsTextLength",
"-",
"1",
")",
"\n",
"x",
">>=",
"nodesBitsTextLength",
"\n",
"offset",
":=",
"x",
... | // nodeLabel returns the label for the i'th node. | [
"nodeLabel",
"returns",
"the",
"label",
"for",
"the",
"i",
"th",
"node",
"."
] | 7bc1d9087cbf90cda1083be2517da1f68909d66c | https://github.com/IBM-Cloud/go-cloudant-example/blob/7bc1d9087cbf90cda1083be2517da1f68909d66c/Godeps/_workspace/src/golang.org/x/net/publicsuffix/list.go#L113-L119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.