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
140,500
signalfx/gateway
protocol/collectd/collectd.go
NewEvent
func NewEvent(e *JSONWriteFormat, defaultDimensions map[string]string) *event.Event { // if you add another dimension that we read from the json update this number const MaxCollectDDims = 6 dimensions := make(map[string]string, len(defaultDimensions)+MaxCollectDDims) for k, v := range defaultDimensions { dimensi...
go
func NewEvent(e *JSONWriteFormat, defaultDimensions map[string]string) *event.Event { // if you add another dimension that we read from the json update this number const MaxCollectDDims = 6 dimensions := make(map[string]string, len(defaultDimensions)+MaxCollectDDims) for k, v := range defaultDimensions { dimensi...
[ "func", "NewEvent", "(", "e", "*", "JSONWriteFormat", ",", "defaultDimensions", "map", "[", "string", "]", "string", ")", "*", "event", ".", "Event", "{", "// if you add another dimension that we read from the json update this number", "const", "MaxCollectDDims", "=", ...
// NewEvent creates a new event from collectd's write_http endpoint JSON format // defaultDimensions are added to the event created, but will be overridden by any dimension // values in the JSON
[ "NewEvent", "creates", "a", "new", "event", "from", "collectd", "s", "write_http", "endpoint", "JSON", "format", "defaultDimensions", "are", "added", "to", "the", "event", "created", "but", "will", "be", "overridden", "by", "any", "dimension", "values", "in", ...
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/protocol/collectd/collectd.go#L177-L204
140,501
signalfx/gateway
config/config.go
DefaultGatewayConfig
func DefaultGatewayConfig() *GatewayConfig { return &GatewayConfig{ PidFilename: pointer.String("/var/run/gateway.pid"), LogDir: pointer.String(os.TempDir()), LogMaxSize: pointer.Int(100), LogMaxBackups: pointer.Int(10), LogFormat: ...
go
func DefaultGatewayConfig() *GatewayConfig { return &GatewayConfig{ PidFilename: pointer.String("/var/run/gateway.pid"), LogDir: pointer.String(os.TempDir()), LogMaxSize: pointer.Int(100), LogMaxBackups: pointer.Int(10), LogFormat: ...
[ "func", "DefaultGatewayConfig", "(", ")", "*", "GatewayConfig", "{", "return", "&", "GatewayConfig", "{", "PidFilename", ":", "pointer", ".", "String", "(", "\"", "\"", ")", ",", "LogDir", ":", "pointer", ".", "String", "(", "os", ".", "TempDir", "(", ")...
// DefaultGatewayConfig returns default gateway config
[ "DefaultGatewayConfig", "returns", "default", "gateway", "config" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/config/config.go#L311-L346
140,502
signalfx/gateway
config/config.go
Load
func Load(configFile string, logger log.Logger) (*GatewayConfig, error) { p, err := loadNoDefault(configFile, logger) if err == nil { c := pointer.FillDefaultFrom(p, DefaultGatewayConfig()).(*GatewayConfig) if err = os.Setenv("gatewayServerName", *c.ServerName); err == nil { if c.ClusterName == nil || *c.Clust...
go
func Load(configFile string, logger log.Logger) (*GatewayConfig, error) { p, err := loadNoDefault(configFile, logger) if err == nil { c := pointer.FillDefaultFrom(p, DefaultGatewayConfig()).(*GatewayConfig) if err = os.Setenv("gatewayServerName", *c.ServerName); err == nil { if c.ClusterName == nil || *c.Clust...
[ "func", "Load", "(", "configFile", "string", ",", "logger", "log", ".", "Logger", ")", "(", "*", "GatewayConfig", ",", "error", ")", "{", "p", ",", "err", ":=", "loadNoDefault", "(", "configFile", ",", "logger", ")", "\n", "if", "err", "==", "nil", "...
// Load loads gateway configuration from a filename that is in an xdg configuration location
[ "Load", "loads", "gateway", "configuration", "from", "a", "filename", "that", "is", "in", "an", "xdg", "configuration", "location" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/config/config.go#L469-L483
140,503
signalfx/gateway
config/config.go
getStringEnvVar
func getStringEnvVar(envVar string, def *string) *string { if val := os.Getenv(envVar); val != "" { return &val } return def }
go
func getStringEnvVar(envVar string, def *string) *string { if val := os.Getenv(envVar); val != "" { return &val } return def }
[ "func", "getStringEnvVar", "(", "envVar", "string", ",", "def", "*", "string", ")", "*", "string", "{", "if", "val", ":=", "os", ".", "Getenv", "(", "envVar", ")", ";", "val", "!=", "\"", "\"", "{", "return", "&", "val", "\n", "}", "\n", "return", ...
// getStringEnvVar returns the given env var key's value or the default value
[ "getStringEnvVar", "returns", "the", "given", "env", "var", "key", "s", "value", "or", "the", "default", "value" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/config/config.go#L506-L511
140,504
signalfx/gateway
config/config.go
getDurationEnvVar
func getDurationEnvVar(envVar string, def *time.Duration) *time.Duration { if strVal := os.Getenv(envVar); strVal != "" { if dur, err := time.ParseDuration(strVal); err == nil { return &dur } } return def }
go
func getDurationEnvVar(envVar string, def *time.Duration) *time.Duration { if strVal := os.Getenv(envVar); strVal != "" { if dur, err := time.ParseDuration(strVal); err == nil { return &dur } } return def }
[ "func", "getDurationEnvVar", "(", "envVar", "string", ",", "def", "*", "time", ".", "Duration", ")", "*", "time", ".", "Duration", "{", "if", "strVal", ":=", "os", ".", "Getenv", "(", "envVar", ")", ";", "strVal", "!=", "\"", "\"", "{", "if", "dur", ...
// getDurationEnvVar returns the given env var key's value or the default value
[ "getDurationEnvVar", "returns", "the", "given", "env", "var", "key", "s", "value", "or", "the", "default", "value" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/config/config.go#L514-L521
140,505
signalfx/gateway
config/config.go
getUintEnvVar
func getUintEnvVar(envVar string, def *uint) *uint { if strVal := os.Getenv(envVar); strVal != "" { if parsedVal, err := strconv.ParseUint(strVal, 10, 16); err == nil { val := uint(parsedVal) return &val } } return def }
go
func getUintEnvVar(envVar string, def *uint) *uint { if strVal := os.Getenv(envVar); strVal != "" { if parsedVal, err := strconv.ParseUint(strVal, 10, 16); err == nil { val := uint(parsedVal) return &val } } return def }
[ "func", "getUintEnvVar", "(", "envVar", "string", ",", "def", "*", "uint", ")", "*", "uint", "{", "if", "strVal", ":=", "os", ".", "Getenv", "(", "envVar", ")", ";", "strVal", "!=", "\"", "\"", "{", "if", "parsedVal", ",", "err", ":=", "strconv", "...
// getUintEnvVar returns the given env var key's value or the default value
[ "getUintEnvVar", "returns", "the", "given", "env", "var", "key", "s", "value", "or", "the", "default", "value" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/config/config.go#L524-L532
140,506
signalfx/gateway
config/config.go
getUint64EnvVar
func getUint64EnvVar(envVar string, def *uint64) *uint64 { if strVal := os.Getenv(envVar); strVal != "" { if parsedVal, err := strconv.ParseUint(strVal, 10, 64); err == nil { return &parsedVal } } return def }
go
func getUint64EnvVar(envVar string, def *uint64) *uint64 { if strVal := os.Getenv(envVar); strVal != "" { if parsedVal, err := strconv.ParseUint(strVal, 10, 64); err == nil { return &parsedVal } } return def }
[ "func", "getUint64EnvVar", "(", "envVar", "string", ",", "def", "*", "uint64", ")", "*", "uint64", "{", "if", "strVal", ":=", "os", ".", "Getenv", "(", "envVar", ")", ";", "strVal", "!=", "\"", "\"", "{", "if", "parsedVal", ",", "err", ":=", "strconv...
// getUint64EnvVar returns the given env var key's value or the default value
[ "getUint64EnvVar", "returns", "the", "given", "env", "var", "key", "s", "value", "or", "the", "default", "value" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/config/config.go#L535-L542
140,507
signalfx/gateway
config/config.go
getCommaSeparatedStringEnvVar
func getCommaSeparatedStringEnvVar(envVar string, def []string) []string { if val := os.Getenv(envVar); val != "" { def = def[:0] for _, addr := range strings.Split(strings.Replace(val, " ", "", -1), ",") { def = append(def, addr) } } return def }
go
func getCommaSeparatedStringEnvVar(envVar string, def []string) []string { if val := os.Getenv(envVar); val != "" { def = def[:0] for _, addr := range strings.Split(strings.Replace(val, " ", "", -1), ",") { def = append(def, addr) } } return def }
[ "func", "getCommaSeparatedStringEnvVar", "(", "envVar", "string", ",", "def", "[", "]", "string", ")", "[", "]", "string", "{", "if", "val", ":=", "os", ".", "Getenv", "(", "envVar", ")", ";", "val", "!=", "\"", "\"", "{", "def", "=", "def", "[", "...
// getCommaSeparatedStringEnvVar returns the given env var key's value split by comma or the default values
[ "getCommaSeparatedStringEnvVar", "returns", "the", "given", "env", "var", "key", "s", "value", "split", "by", "comma", "or", "the", "default", "values" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/config/config.go#L545-L553
140,508
signalfx/gateway
config/config.go
loadFromEnv
func loadFromEnv(conf *GatewayConfig) { // general configs conf.ServerName = getStringEnvVar("SFX_SERVER_NAME", conf.ServerName) conf.ClusterName = getStringEnvVar("SFX_GATEWAY_CLUSTER_NAME", conf.ClusterName) conf.ClusterOperation = getStringEnvVar("SFX_CLUSTER_OPERATION", conf.ClusterOperation) conf.ClusterDataD...
go
func loadFromEnv(conf *GatewayConfig) { // general configs conf.ServerName = getStringEnvVar("SFX_SERVER_NAME", conf.ServerName) conf.ClusterName = getStringEnvVar("SFX_GATEWAY_CLUSTER_NAME", conf.ClusterName) conf.ClusterOperation = getStringEnvVar("SFX_CLUSTER_OPERATION", conf.ClusterOperation) conf.ClusterDataD...
[ "func", "loadFromEnv", "(", "conf", "*", "GatewayConfig", ")", "{", "// general configs", "conf", ".", "ServerName", "=", "getStringEnvVar", "(", "\"", "\"", ",", "conf", ".", "ServerName", ")", "\n", "conf", ".", "ClusterName", "=", "getStringEnvVar", "(", ...
// loadFromEnv loads environment variables to override values in the gateway config file
[ "loadFromEnv", "loads", "environment", "variables", "to", "override", "values", "in", "the", "gateway", "config", "file" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/config/config.go#L556-L596
140,509
signalfx/gateway
protocol/carbon/metricdeconstructor/metricdeconstructor.go
Load
func Load(name string, options string) (MetricDeconstructor, error) { loader, exists := knownLoaders[name] if !exists { return nil, fmt.Errorf("unable to load metric deconstructor by the name of %s", name) } return loader(options) }
go
func Load(name string, options string) (MetricDeconstructor, error) { loader, exists := knownLoaders[name] if !exists { return nil, fmt.Errorf("unable to load metric deconstructor by the name of %s", name) } return loader(options) }
[ "func", "Load", "(", "name", "string", ",", "options", "string", ")", "(", "MetricDeconstructor", ",", "error", ")", "{", "loader", ",", "exists", ":=", "knownLoaders", "[", "name", "]", "\n", "if", "!", "exists", "{", "return", "nil", ",", "fmt", ".",...
// Load will load a MetricDeconstructor of the given name, with the given options
[ "Load", "will", "load", "a", "MetricDeconstructor", "of", "the", "given", "name", "with", "the", "given", "options" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/protocol/carbon/metricdeconstructor/metricdeconstructor.go#L27-L33
140,510
signalfx/gateway
protocol/carbon/metricdeconstructor/metricdeconstructor.go
LoadJSON
func LoadJSON(name string, options map[string]interface{}) (MetricDeconstructor, error) { loader, exists := knownJSONLoaders[name] if !exists { return nil, fmt.Errorf("unable to load from json metric deconstructor by the name of %s", name) } return loader(options) }
go
func LoadJSON(name string, options map[string]interface{}) (MetricDeconstructor, error) { loader, exists := knownJSONLoaders[name] if !exists { return nil, fmt.Errorf("unable to load from json metric deconstructor by the name of %s", name) } return loader(options) }
[ "func", "LoadJSON", "(", "name", "string", ",", "options", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "MetricDeconstructor", ",", "error", ")", "{", "loader", ",", "exists", ":=", "knownJSONLoaders", "[", "name", "]", "\n", "if", "!", ...
// LoadJSON will load a MetricDeconstructor of the given name, with the given JSON object
[ "LoadJSON", "will", "load", "a", "MetricDeconstructor", "of", "the", "given", "name", "with", "the", "given", "JSON", "object" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/protocol/carbon/metricdeconstructor/metricdeconstructor.go#L41-L47
140,511
signalfx/gateway
protocol/zipper/zipper.go
GzipHandler
func (z *ReadZipper) GzipHandler(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var err error if "gzip" == r.Header.Get("Content-Encoding") { gzi := z.zippers.Get() if gzi != nil { gz := gzi.(*gzip.Reader) // put it back defer z.zippers.Put(g...
go
func (z *ReadZipper) GzipHandler(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var err error if "gzip" == r.Header.Get("Content-Encoding") { gzi := z.zippers.Get() if gzi != nil { gz := gzi.(*gzip.Reader) // put it back defer z.zippers.Put(g...
[ "func", "(", "z", "*", "ReadZipper", ")", "GzipHandler", "(", "h", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Requ...
// GzipHandler transparently decodes your possibly gzipped request
[ "GzipHandler", "transparently", "decodes", "your", "possibly", "gzipped", "request" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/protocol/zipper/zipper.go#L26-L56
140,512
signalfx/gateway
protocol/zipper/zipper.go
Datapoints
func (z *ReadZipper) Datapoints() []*datapoint.Datapoint { return []*datapoint.Datapoint{ sfxclient.CumulativeP("zipper.hitCount", nil, &z.HitCount), sfxclient.CumulativeP("zipper.missCount", nil, &z.MissCount), sfxclient.CumulativeP("zipper.newCount", nil, &z.NewCount), sfxclient.CumulativeP("zipper.errCount"...
go
func (z *ReadZipper) Datapoints() []*datapoint.Datapoint { return []*datapoint.Datapoint{ sfxclient.CumulativeP("zipper.hitCount", nil, &z.HitCount), sfxclient.CumulativeP("zipper.missCount", nil, &z.MissCount), sfxclient.CumulativeP("zipper.newCount", nil, &z.NewCount), sfxclient.CumulativeP("zipper.errCount"...
[ "func", "(", "z", "*", "ReadZipper", ")", "Datapoints", "(", ")", "[", "]", "*", "datapoint", ".", "Datapoint", "{", "return", "[", "]", "*", "datapoint", ".", "Datapoint", "{", "sfxclient", ".", "CumulativeP", "(", "\"", "\"", ",", "nil", ",", "&", ...
// Datapoints implements Collector interface and returns metrics
[ "Datapoints", "implements", "Collector", "interface", "and", "returns", "metrics" ]
60f8886d9dbf529d974d8f3c0b9e932d8a7570a0
https://github.com/signalfx/gateway/blob/60f8886d9dbf529d974d8f3c0b9e932d8a7570a0/protocol/zipper/zipper.go#L59-L66
140,513
containerd/go-runc
io.go
Set
func (i *pipeIO) Set(cmd *exec.Cmd) { if i.in != nil { cmd.Stdin = i.in.r } if i.out != nil { cmd.Stdout = i.out.w } if i.err != nil { cmd.Stderr = i.err.w } }
go
func (i *pipeIO) Set(cmd *exec.Cmd) { if i.in != nil { cmd.Stdin = i.in.r } if i.out != nil { cmd.Stdout = i.out.w } if i.err != nil { cmd.Stderr = i.err.w } }
[ "func", "(", "i", "*", "pipeIO", ")", "Set", "(", "cmd", "*", "exec", ".", "Cmd", ")", "{", "if", "i", ".", "in", "!=", "nil", "{", "cmd", ".", "Stdin", "=", "i", ".", "in", ".", "r", "\n", "}", "\n", "if", "i", ".", "out", "!=", "nil", ...
// Set sets the io to the exec.Cmd
[ "Set", "sets", "the", "io", "to", "the", "exec", ".", "Cmd" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/io.go#L135-L145
140,514
containerd/go-runc
console.go
NewConsoleSocket
func NewConsoleSocket(path string) (*Socket, error) { abs, err := filepath.Abs(path) if err != nil { return nil, err } addr, err := net.ResolveUnixAddr("unix", abs) if err != nil { return nil, err } l, err := net.ListenUnix("unix", addr) if err != nil { return nil, err } return &Socket{ l: l, }, nil ...
go
func NewConsoleSocket(path string) (*Socket, error) { abs, err := filepath.Abs(path) if err != nil { return nil, err } addr, err := net.ResolveUnixAddr("unix", abs) if err != nil { return nil, err } l, err := net.ListenUnix("unix", addr) if err != nil { return nil, err } return &Socket{ l: l, }, nil ...
[ "func", "NewConsoleSocket", "(", "path", "string", ")", "(", "*", "Socket", ",", "error", ")", "{", "abs", ",", "err", ":=", "filepath", ".", "Abs", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\...
// NewConsoleSocket creates a new unix socket at the provided path to accept a // pty master created by runc for use by the container
[ "NewConsoleSocket", "creates", "a", "new", "unix", "socket", "at", "the", "provided", "path", "to", "accept", "a", "pty", "master", "created", "by", "runc", "for", "use", "by", "the", "container" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/console.go#L34-L50
140,515
containerd/go-runc
console.go
ReceiveMaster
func (c *Socket) ReceiveMaster() (console.Console, error) { conn, err := c.l.Accept() if err != nil { return nil, err } defer conn.Close() uc, ok := conn.(*net.UnixConn) if !ok { return nil, fmt.Errorf("received connection which was not a unix socket") } f, err := recvFd(uc) if err != nil { return nil, e...
go
func (c *Socket) ReceiveMaster() (console.Console, error) { conn, err := c.l.Accept() if err != nil { return nil, err } defer conn.Close() uc, ok := conn.(*net.UnixConn) if !ok { return nil, fmt.Errorf("received connection which was not a unix socket") } f, err := recvFd(uc) if err != nil { return nil, e...
[ "func", "(", "c", "*", "Socket", ")", "ReceiveMaster", "(", ")", "(", "console", ".", "Console", ",", "error", ")", "{", "conn", ",", "err", ":=", "c", ".", "l", ".", "Accept", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ","...
// ReceiveMaster blocks until the socket receives the pty master
[ "ReceiveMaster", "blocks", "until", "the", "socket", "receives", "the", "pty", "master" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/console.go#L139-L154
140,516
containerd/go-runc
console.go
Close
func (c *Socket) Close() error { err := c.l.Close() if c.rmdir { if rerr := os.RemoveAll(filepath.Dir(c.Path())); err == nil { err = rerr } } return err }
go
func (c *Socket) Close() error { err := c.l.Close() if c.rmdir { if rerr := os.RemoveAll(filepath.Dir(c.Path())); err == nil { err = rerr } } return err }
[ "func", "(", "c", "*", "Socket", ")", "Close", "(", ")", "error", "{", "err", ":=", "c", ".", "l", ".", "Close", "(", ")", "\n", "if", "c", ".", "rmdir", "{", "if", "rerr", ":=", "os", ".", "RemoveAll", "(", "filepath", ".", "Dir", "(", "c", ...
// Close closes the unix socket
[ "Close", "closes", "the", "unix", "socket" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/console.go#L157-L165
140,517
containerd/go-runc
runc.go
List
func (r *Runc) List(context context.Context) ([]*Container, error) { data, err := cmdOutput(r.command(context, "list", "--format=json"), false) if err != nil { return nil, err } var out []*Container if err := json.Unmarshal(data, &out); err != nil { return nil, err } return out, nil }
go
func (r *Runc) List(context context.Context) ([]*Container, error) { data, err := cmdOutput(r.command(context, "list", "--format=json"), false) if err != nil { return nil, err } var out []*Container if err := json.Unmarshal(data, &out); err != nil { return nil, err } return out, nil }
[ "func", "(", "r", "*", "Runc", ")", "List", "(", "context", "context", ".", "Context", ")", "(", "[", "]", "*", "Container", ",", "error", ")", "{", "data", ",", "err", ":=", "cmdOutput", "(", "r", ".", "command", "(", "context", ",", "\"", "\"",...
// List returns all containers created inside the provided runc root directory
[ "List", "returns", "all", "containers", "created", "inside", "the", "provided", "runc", "root", "directory" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L73-L83
140,518
containerd/go-runc
runc.go
State
func (r *Runc) State(context context.Context, id string) (*Container, error) { data, err := cmdOutput(r.command(context, "state", id), true) if err != nil { return nil, fmt.Errorf("%s: %s", err, data) } var c Container if err := json.Unmarshal(data, &c); err != nil { return nil, err } return &c, nil }
go
func (r *Runc) State(context context.Context, id string) (*Container, error) { data, err := cmdOutput(r.command(context, "state", id), true) if err != nil { return nil, fmt.Errorf("%s: %s", err, data) } var c Container if err := json.Unmarshal(data, &c); err != nil { return nil, err } return &c, nil }
[ "func", "(", "r", "*", "Runc", ")", "State", "(", "context", "context", ".", "Context", ",", "id", "string", ")", "(", "*", "Container", ",", "error", ")", "{", "data", ",", "err", ":=", "cmdOutput", "(", "r", ".", "command", "(", "context", ",", ...
// State returns the state for the container provided by id
[ "State", "returns", "the", "state", "for", "the", "container", "provided", "by", "id" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L86-L96
140,519
containerd/go-runc
runc.go
Create
func (r *Runc) Create(context context.Context, id, bundle string, opts *CreateOpts) error { args := []string{"create", "--bundle", bundle} if opts != nil { oargs, err := opts.args() if err != nil { return err } args = append(args, oargs...) } cmd := r.command(context, append(args, id)...) if opts != nil...
go
func (r *Runc) Create(context context.Context, id, bundle string, opts *CreateOpts) error { args := []string{"create", "--bundle", bundle} if opts != nil { oargs, err := opts.args() if err != nil { return err } args = append(args, oargs...) } cmd := r.command(context, append(args, id)...) if opts != nil...
[ "func", "(", "r", "*", "Runc", ")", "Create", "(", "context", "context", ".", "Context", ",", "id", ",", "bundle", "string", ",", "opts", "*", "CreateOpts", ")", "error", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",...
// Create creates a new container and returns its pid if it was created successfully
[ "Create", "creates", "a", "new", "container", "and", "returns", "its", "pid", "if", "it", "was", "created", "successfully" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L140-L178
140,520
containerd/go-runc
runc.go
Start
func (r *Runc) Start(context context.Context, id string) error { return r.runOrError(r.command(context, "start", id)) }
go
func (r *Runc) Start(context context.Context, id string) error { return r.runOrError(r.command(context, "start", id)) }
[ "func", "(", "r", "*", "Runc", ")", "Start", "(", "context", "context", ".", "Context", ",", "id", "string", ")", "error", "{", "return", "r", ".", "runOrError", "(", "r", ".", "command", "(", "context", ",", "\"", "\"", ",", "id", ")", ")", "\n"...
// Start will start an already created container
[ "Start", "will", "start", "an", "already", "created", "container" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L181-L183
140,521
containerd/go-runc
runc.go
Exec
func (r *Runc) Exec(context context.Context, id string, spec specs.Process, opts *ExecOpts) error { f, err := ioutil.TempFile(os.Getenv("XDG_RUNTIME_DIR"), "runc-process") if err != nil { return err } defer os.Remove(f.Name()) err = json.NewEncoder(f).Encode(spec) f.Close() if err != nil { return err } arg...
go
func (r *Runc) Exec(context context.Context, id string, spec specs.Process, opts *ExecOpts) error { f, err := ioutil.TempFile(os.Getenv("XDG_RUNTIME_DIR"), "runc-process") if err != nil { return err } defer os.Remove(f.Name()) err = json.NewEncoder(f).Encode(spec) f.Close() if err != nil { return err } arg...
[ "func", "(", "r", "*", "Runc", ")", "Exec", "(", "context", "context", ".", "Context", ",", "id", "string", ",", "spec", "specs", ".", "Process", ",", "opts", "*", "ExecOpts", ")", "error", "{", "f", ",", "err", ":=", "ioutil", ".", "TempFile", "("...
// Exec executres and additional process inside the container based on a full // OCI Process specification
[ "Exec", "executres", "and", "additional", "process", "inside", "the", "container", "based", "on", "a", "full", "OCI", "Process", "specification" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L211-L257
140,522
containerd/go-runc
runc.go
Run
func (r *Runc) Run(context context.Context, id, bundle string, opts *CreateOpts) (int, error) { args := []string{"run", "--bundle", bundle} if opts != nil { oargs, err := opts.args() if err != nil { return -1, err } args = append(args, oargs...) } cmd := r.command(context, append(args, id)...) if opts !...
go
func (r *Runc) Run(context context.Context, id, bundle string, opts *CreateOpts) (int, error) { args := []string{"run", "--bundle", bundle} if opts != nil { oargs, err := opts.args() if err != nil { return -1, err } args = append(args, oargs...) } cmd := r.command(context, append(args, id)...) if opts !...
[ "func", "(", "r", "*", "Runc", ")", "Run", "(", "context", "context", ".", "Context", ",", "id", ",", "bundle", "string", ",", "opts", "*", "CreateOpts", ")", "(", "int", ",", "error", ")", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ...
// Run runs the create, start, delete lifecycle of the container // and returns its exit status after it has exited
[ "Run", "runs", "the", "create", "start", "delete", "lifecycle", "of", "the", "container", "and", "returns", "its", "exit", "status", "after", "it", "has", "exited" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L261-L279
140,523
containerd/go-runc
runc.go
Delete
func (r *Runc) Delete(context context.Context, id string, opts *DeleteOpts) error { args := []string{"delete"} if opts != nil { args = append(args, opts.args()...) } return r.runOrError(r.command(context, append(args, id)...)) }
go
func (r *Runc) Delete(context context.Context, id string, opts *DeleteOpts) error { args := []string{"delete"} if opts != nil { args = append(args, opts.args()...) } return r.runOrError(r.command(context, append(args, id)...)) }
[ "func", "(", "r", "*", "Runc", ")", "Delete", "(", "context", "context", ".", "Context", ",", "id", "string", ",", "opts", "*", "DeleteOpts", ")", "error", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "if", "opts", "!=", "ni...
// Delete deletes the container
[ "Delete", "deletes", "the", "container" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L293-L299
140,524
containerd/go-runc
runc.go
Kill
func (r *Runc) Kill(context context.Context, id string, sig int, opts *KillOpts) error { args := []string{ "kill", } if opts != nil { args = append(args, opts.args()...) } return r.runOrError(r.command(context, append(args, id, strconv.Itoa(sig))...)) }
go
func (r *Runc) Kill(context context.Context, id string, sig int, opts *KillOpts) error { args := []string{ "kill", } if opts != nil { args = append(args, opts.args()...) } return r.runOrError(r.command(context, append(args, id, strconv.Itoa(sig))...)) }
[ "func", "(", "r", "*", "Runc", ")", "Kill", "(", "context", "context", ".", "Context", ",", "id", "string", ",", "sig", "int", ",", "opts", "*", "KillOpts", ")", "error", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "}", "\n", "...
// Kill sends the specified signal to the container
[ "Kill", "sends", "the", "specified", "signal", "to", "the", "container" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L314-L322
140,525
containerd/go-runc
runc.go
Stats
func (r *Runc) Stats(context context.Context, id string) (*Stats, error) { cmd := r.command(context, "events", "--stats", id) rd, err := cmd.StdoutPipe() if err != nil { return nil, err } ec, err := Monitor.Start(cmd) if err != nil { return nil, err } defer func() { rd.Close() Monitor.Wait(cmd, ec) }()...
go
func (r *Runc) Stats(context context.Context, id string) (*Stats, error) { cmd := r.command(context, "events", "--stats", id) rd, err := cmd.StdoutPipe() if err != nil { return nil, err } ec, err := Monitor.Start(cmd) if err != nil { return nil, err } defer func() { rd.Close() Monitor.Wait(cmd, ec) }()...
[ "func", "(", "r", "*", "Runc", ")", "Stats", "(", "context", "context", ".", "Context", ",", "id", "string", ")", "(", "*", "Stats", ",", "error", ")", "{", "cmd", ":=", "r", ".", "command", "(", "context", ",", "\"", "\"", ",", "\"", "\"", ","...
// Stats return the stats for a container like cpu, memory, and io
[ "Stats", "return", "the", "stats", "for", "a", "container", "like", "cpu", "memory", "and", "io" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L325-L344
140,526
containerd/go-runc
runc.go
Events
func (r *Runc) Events(context context.Context, id string, interval time.Duration) (chan *Event, error) { cmd := r.command(context, "events", fmt.Sprintf("--interval=%ds", int(interval.Seconds())), id) rd, err := cmd.StdoutPipe() if err != nil { return nil, err } ec, err := Monitor.Start(cmd) if err != nil { r...
go
func (r *Runc) Events(context context.Context, id string, interval time.Duration) (chan *Event, error) { cmd := r.command(context, "events", fmt.Sprintf("--interval=%ds", int(interval.Seconds())), id) rd, err := cmd.StdoutPipe() if err != nil { return nil, err } ec, err := Monitor.Start(cmd) if err != nil { r...
[ "func", "(", "r", "*", "Runc", ")", "Events", "(", "context", "context", ".", "Context", ",", "id", "string", ",", "interval", "time", ".", "Duration", ")", "(", "chan", "*", "Event", ",", "error", ")", "{", "cmd", ":=", "r", ".", "command", "(", ...
// Events returns an event stream from runc for a container with stats and OOM notifications
[ "Events", "returns", "an", "event", "stream", "from", "runc", "for", "a", "container", "with", "stats", "and", "OOM", "notifications" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L347-L383
140,527
containerd/go-runc
runc.go
Top
func (r *Runc) Top(context context.Context, id string, psOptions string) (*TopResults, error) { data, err := cmdOutput(r.command(context, "ps", "--format", "table", id, psOptions), true) if err != nil { return nil, fmt.Errorf("%s: %s", err, data) } topResults, err := ParsePSOutput(data) if err != nil { return...
go
func (r *Runc) Top(context context.Context, id string, psOptions string) (*TopResults, error) { data, err := cmdOutput(r.command(context, "ps", "--format", "table", id, psOptions), true) if err != nil { return nil, fmt.Errorf("%s: %s", err, data) } topResults, err := ParsePSOutput(data) if err != nil { return...
[ "func", "(", "r", "*", "Runc", ")", "Top", "(", "context", "context", ".", "Context", ",", "id", "string", ",", "psOptions", "string", ")", "(", "*", "TopResults", ",", "error", ")", "{", "data", ",", "err", ":=", "cmdOutput", "(", "r", ".", "comma...
// Top lists all the processes inside the container returning the full ps data
[ "Top", "lists", "all", "the", "processes", "inside", "the", "container", "returning", "the", "full", "ps", "data" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L409-L420
140,528
containerd/go-runc
runc.go
Checkpoint
func (r *Runc) Checkpoint(context context.Context, id string, opts *CheckpointOpts, actions ...CheckpointAction) error { args := []string{"checkpoint"} if opts != nil { args = append(args, opts.args()...) } for _, a := range actions { args = a(args) } return r.runOrError(r.command(context, append(args, id)......
go
func (r *Runc) Checkpoint(context context.Context, id string, opts *CheckpointOpts, actions ...CheckpointAction) error { args := []string{"checkpoint"} if opts != nil { args = append(args, opts.args()...) } for _, a := range actions { args = a(args) } return r.runOrError(r.command(context, append(args, id)......
[ "func", "(", "r", "*", "Runc", ")", "Checkpoint", "(", "context", "context", ".", "Context", ",", "id", "string", ",", "opts", "*", "CheckpointOpts", ",", "actions", "...", "CheckpointAction", ")", "error", "{", "args", ":=", "[", "]", "string", "{", "...
// Checkpoint allows you to checkpoint a container using criu
[ "Checkpoint", "allows", "you", "to", "checkpoint", "a", "container", "using", "criu" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L501-L510
140,529
containerd/go-runc
runc.go
Restore
func (r *Runc) Restore(context context.Context, id, bundle string, opts *RestoreOpts) (int, error) { args := []string{"restore"} if opts != nil { oargs, err := opts.args() if err != nil { return -1, err } args = append(args, oargs...) } args = append(args, "--bundle", bundle) cmd := r.command(context, a...
go
func (r *Runc) Restore(context context.Context, id, bundle string, opts *RestoreOpts) (int, error) { args := []string{"restore"} if opts != nil { oargs, err := opts.args() if err != nil { return -1, err } args = append(args, oargs...) } args = append(args, "--bundle", bundle) cmd := r.command(context, a...
[ "func", "(", "r", "*", "Runc", ")", "Restore", "(", "context", "context", ".", "Context", ",", "id", ",", "bundle", "string", ",", "opts", "*", "RestoreOpts", ")", "(", "int", ",", "error", ")", "{", "args", ":=", "[", "]", "string", "{", "\"", "...
// Restore restores a container with the provide id from an existing checkpoint
[ "Restore", "restores", "a", "container", "with", "the", "provide", "id", "from", "an", "existing", "checkpoint" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L548-L574
140,530
containerd/go-runc
runc.go
Update
func (r *Runc) Update(context context.Context, id string, resources *specs.LinuxResources) error { buf := getBuf() defer putBuf(buf) if err := json.NewEncoder(buf).Encode(resources); err != nil { return err } args := []string{"update", "--resources", "-", id} cmd := r.command(context, args...) cmd.Stdin = buf...
go
func (r *Runc) Update(context context.Context, id string, resources *specs.LinuxResources) error { buf := getBuf() defer putBuf(buf) if err := json.NewEncoder(buf).Encode(resources); err != nil { return err } args := []string{"update", "--resources", "-", id} cmd := r.command(context, args...) cmd.Stdin = buf...
[ "func", "(", "r", "*", "Runc", ")", "Update", "(", "context", "context", ".", "Context", ",", "id", "string", ",", "resources", "*", "specs", ".", "LinuxResources", ")", "error", "{", "buf", ":=", "getBuf", "(", ")", "\n", "defer", "putBuf", "(", "bu...
// Update updates the current container with the provided resource spec
[ "Update", "updates", "the", "current", "container", "with", "the", "provided", "resource", "spec" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L577-L588
140,531
containerd/go-runc
runc.go
Version
func (r *Runc) Version(context context.Context) (Version, error) { data, err := cmdOutput(r.command(context, "--version"), false) if err != nil { return Version{}, err } return parseVersion(data) }
go
func (r *Runc) Version(context context.Context) (Version, error) { data, err := cmdOutput(r.command(context, "--version"), false) if err != nil { return Version{}, err } return parseVersion(data) }
[ "func", "(", "r", "*", "Runc", ")", "Version", "(", "context", "context", ".", "Context", ")", "(", "Version", ",", "error", ")", "{", "data", ",", "err", ":=", "cmdOutput", "(", "r", ".", "command", "(", "context", ",", "\"", "\"", ")", ",", "fa...
// Version returns the runc and runtime-spec versions
[ "Version", "returns", "the", "runc", "and", "runtime", "-", "spec", "versions" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/runc.go#L599-L605
140,532
containerd/go-runc
utils.go
ReadPidFile
func ReadPidFile(path string) (int, error) { data, err := ioutil.ReadFile(path) if err != nil { return -1, err } return strconv.Atoi(string(data)) }
go
func ReadPidFile(path string) (int, error) { data, err := ioutil.ReadFile(path) if err != nil { return -1, err } return strconv.Atoi(string(data)) }
[ "func", "ReadPidFile", "(", "path", "string", ")", "(", "int", ",", "error", ")", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "err", "\n", "}", "\n", ...
// ReadPidFile reads the pid file at the provided path and returns // the pid or an error if the read and conversion is unsuccessful
[ "ReadPidFile", "reads", "the", "pid", "file", "at", "the", "provided", "path", "and", "returns", "the", "pid", "or", "an", "error", "if", "the", "read", "and", "conversion", "is", "unsuccessful" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/utils.go#L30-L36
140,533
containerd/go-runc
utils.go
ParsePSOutput
func ParsePSOutput(output []byte) (*TopResults, error) { topResults := &TopResults{} lines := strings.Split(string(output), "\n") topResults.Headers = fieldsASCII(lines[0]) pidIndex := -1 for i, name := range topResults.Headers { if name == "PID" { pidIndex = i } } for _, line := range lines[1:] { if...
go
func ParsePSOutput(output []byte) (*TopResults, error) { topResults := &TopResults{} lines := strings.Split(string(output), "\n") topResults.Headers = fieldsASCII(lines[0]) pidIndex := -1 for i, name := range topResults.Headers { if name == "PID" { pidIndex = i } } for _, line := range lines[1:] { if...
[ "func", "ParsePSOutput", "(", "output", "[", "]", "byte", ")", "(", "*", "TopResults", ",", "error", ")", "{", "topResults", ":=", "&", "TopResults", "{", "}", "\n\n", "lines", ":=", "strings", ".", "Split", "(", "string", "(", "output", ")", ",", "\...
// ParsePSOutput parses the runtime's ps raw output and returns a TopResults
[ "ParsePSOutput", "parses", "the", "runtime", "s", "ps", "raw", "output", "and", "returns", "a", "TopResults" ]
7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
https://github.com/containerd/go-runc/blob/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad/utils.go#L77-L107
140,534
goadesign/goa-cellar
app/media_types.go
Validate
func (mt *Account) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } if mt.Name == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "name")) } if mt.CreatedBy == "" { err = goa.MergeErrors(err, goa.MissingAttributeEr...
go
func (mt *Account) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } if mt.Name == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "name")) } if mt.CreatedBy == "" { err = goa.MergeErrors(err, goa.MissingAttributeEr...
[ "func", "(", "mt", "*", "Account", ")", "Validate", "(", ")", "(", "err", "error", ")", "{", "if", "mt", ".", "Href", "==", "\"", "\"", "{", "err", "=", "goa", ".", "MergeErrors", "(", "err", ",", "goa", ".", "MissingAttributeError", "(", "`respons...
// Validate validates the Account media type instance.
[ "Validate", "validates", "the", "Account", "media", "type", "instance", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/media_types.go#L36-L52
140,535
goadesign/goa-cellar
app/media_types.go
Validate
func (mt *AccountLink) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } return }
go
func (mt *AccountLink) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } return }
[ "func", "(", "mt", "*", "AccountLink", ")", "Validate", "(", ")", "(", "err", "error", ")", "{", "if", "mt", ".", "Href", "==", "\"", "\"", "{", "err", "=", "goa", ".", "MergeErrors", "(", "err", ",", "goa", ".", "MissingAttributeError", "(", "`res...
// Validate validates the AccountLink media type instance.
[ "Validate", "validates", "the", "AccountLink", "media", "type", "instance", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/media_types.go#L65-L71
140,536
goadesign/goa-cellar
app/media_types.go
Validate
func (mt *AccountTiny) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } if mt.Name == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "name")) } return }
go
func (mt *AccountTiny) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } if mt.Name == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "name")) } return }
[ "func", "(", "mt", "*", "AccountTiny", ")", "Validate", "(", ")", "(", "err", "error", ")", "{", "if", "mt", ".", "Href", "==", "\"", "\"", "{", "err", "=", "goa", ".", "MergeErrors", "(", "err", ",", "goa", ".", "MissingAttributeError", "(", "`res...
// Validate validates the AccountTiny media type instance.
[ "Validate", "validates", "the", "AccountTiny", "media", "type", "instance", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/media_types.go#L86-L95
140,537
goadesign/goa-cellar
app/media_types.go
Validate
func (mt AccountCollection) Validate() (err error) { for _, e := range mt { if e != nil { if err2 := e.Validate(); err2 != nil { err = goa.MergeErrors(err, err2) } } } return }
go
func (mt AccountCollection) Validate() (err error) { for _, e := range mt { if e != nil { if err2 := e.Validate(); err2 != nil { err = goa.MergeErrors(err, err2) } } } return }
[ "func", "(", "mt", "AccountCollection", ")", "Validate", "(", ")", "(", "err", "error", ")", "{", "for", "_", ",", "e", ":=", "range", "mt", "{", "if", "e", "!=", "nil", "{", "if", "err2", ":=", "e", ".", "Validate", "(", ")", ";", "err2", "!="...
// Validate validates the AccountCollection media type instance.
[ "Validate", "validates", "the", "AccountCollection", "media", "type", "instance", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/media_types.go#L103-L112
140,538
goadesign/goa-cellar
app/media_types.go
Validate
func (mt *Bottle) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } if mt.Name == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "name")) } if mt.Vineyard == "" { err = goa.MergeErrors(err, goa.MissingAttributeError...
go
func (mt *Bottle) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } if mt.Name == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "name")) } if mt.Vineyard == "" { err = goa.MergeErrors(err, goa.MissingAttributeError...
[ "func", "(", "mt", "*", "Bottle", ")", "Validate", "(", ")", "(", "err", "error", ")", "{", "if", "mt", ".", "Href", "==", "\"", "\"", "{", "err", "=", "goa", ".", "MergeErrors", "(", "err", ",", "goa", ".", "MissingAttributeError", "(", "`response...
// Validate validates the Bottle media type instance.
[ "Validate", "validates", "the", "Bottle", "media", "type", "instance", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/media_types.go#L169-L220
140,539
goadesign/goa-cellar
app/media_types.go
Validate
func (mt *BottleTiny) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } if mt.Name == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "name")) } if mt.Links != nil { if err2 := mt.Links.Validate(); err2 != nil { e...
go
func (mt *BottleTiny) Validate() (err error) { if mt.Href == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href")) } if mt.Name == "" { err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "name")) } if mt.Links != nil { if err2 := mt.Links.Validate(); err2 != nil { e...
[ "func", "(", "mt", "*", "BottleTiny", ")", "Validate", "(", ")", "(", "err", "error", ")", "{", "if", "mt", ".", "Href", "==", "\"", "\"", "{", "err", "=", "goa", ".", "MergeErrors", "(", "err", ",", "goa", ".", "MissingAttributeError", "(", "`resp...
// Validate validates the BottleTiny media type instance.
[ "Validate", "validates", "the", "BottleTiny", "media", "type", "instance", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/media_types.go#L353-L380
140,540
goadesign/goa-cellar
app/media_types.go
Validate
func (ut *BottleLinks) Validate() (err error) { if ut.Account != nil { if err2 := ut.Account.Validate(); err2 != nil { err = goa.MergeErrors(err, err2) } } return }
go
func (ut *BottleLinks) Validate() (err error) { if ut.Account != nil { if err2 := ut.Account.Validate(); err2 != nil { err = goa.MergeErrors(err, err2) } } return }
[ "func", "(", "ut", "*", "BottleLinks", ")", "Validate", "(", ")", "(", "err", "error", ")", "{", "if", "ut", ".", "Account", "!=", "nil", "{", "if", "err2", ":=", "ut", ".", "Account", ".", "Validate", "(", ")", ";", "err2", "!=", "nil", "{", "...
// Validate validates the BottleLinks type instance.
[ "Validate", "validates", "the", "BottleLinks", "type", "instance", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/media_types.go#L388-L395
140,541
goadesign/goa-cellar
app/media_types.go
Validate
func (ut BottleLinksArray) Validate() (err error) { for _, e := range ut { if e != nil { if err2 := e.Validate(); err2 != nil { err = goa.MergeErrors(err, err2) } } } return }
go
func (ut BottleLinksArray) Validate() (err error) { for _, e := range ut { if e != nil { if err2 := e.Validate(); err2 != nil { err = goa.MergeErrors(err, err2) } } } return }
[ "func", "(", "ut", "BottleLinksArray", ")", "Validate", "(", ")", "(", "err", "error", ")", "{", "for", "_", ",", "e", ":=", "range", "ut", "{", "if", "e", "!=", "nil", "{", "if", "err2", ":=", "e", ".", "Validate", "(", ")", ";", "err2", "!=",...
// Validate validates the BottleLinksArray type instance.
[ "Validate", "validates", "the", "BottleLinksArray", "type", "instance", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/media_types.go#L435-L444
140,542
goadesign/goa-cellar
client/account.go
CreateAccount
func (c *Client) CreateAccount(ctx context.Context, path string, payload *CreateAccountPayload, contentType string) (*http.Response, error) { req, err := c.NewCreateAccountRequest(ctx, path, payload, contentType) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
go
func (c *Client) CreateAccount(ctx context.Context, path string, payload *CreateAccountPayload, contentType string) (*http.Response, error) { req, err := c.NewCreateAccountRequest(ctx, path, payload, contentType) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
[ "func", "(", "c", "*", "Client", ")", "CreateAccount", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "payload", "*", "CreateAccountPayload", ",", "contentType", "string", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{"...
// Create new account
[ "Create", "new", "account" ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/account.go#L35-L41
140,543
goadesign/goa-cellar
client/account.go
NewCreateAccountRequest
func (c *Client) NewCreateAccountRequest(ctx context.Context, path string, payload *CreateAccountPayload, contentType string) (*http.Request, error) { var body bytes.Buffer if contentType == "" { contentType = "*/*" // Use default encoder } err := c.Encoder.Encode(payload, &body, contentType) if err != nil { r...
go
func (c *Client) NewCreateAccountRequest(ctx context.Context, path string, payload *CreateAccountPayload, contentType string) (*http.Request, error) { var body bytes.Buffer if contentType == "" { contentType = "*/*" // Use default encoder } err := c.Encoder.Encode(payload, &body, contentType) if err != nil { r...
[ "func", "(", "c", "*", "Client", ")", "NewCreateAccountRequest", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "payload", "*", "CreateAccountPayload", ",", "contentType", "string", ")", "(", "*", "http", ".", "Request", ",", "error", "...
// NewCreateAccountRequest create the request corresponding to the create action endpoint of the account resource.
[ "NewCreateAccountRequest", "create", "the", "request", "corresponding", "to", "the", "create", "action", "endpoint", "of", "the", "account", "resource", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/account.go#L44-L69
140,544
goadesign/goa-cellar
client/account.go
DeleteAccountPath
func DeleteAccountPath(accountID int) string { param0 := strconv.Itoa(accountID) return fmt.Sprintf("/cellar/accounts/%s", param0) }
go
func DeleteAccountPath(accountID int) string { param0 := strconv.Itoa(accountID) return fmt.Sprintf("/cellar/accounts/%s", param0) }
[ "func", "DeleteAccountPath", "(", "accountID", "int", ")", "string", "{", "param0", ":=", "strconv", ".", "Itoa", "(", "accountID", ")", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "param0", ")", "\n", "}" ]
// DeleteAccountPath computes a request path to the delete action of account.
[ "DeleteAccountPath", "computes", "a", "request", "path", "to", "the", "delete", "action", "of", "account", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/account.go#L72-L76
140,545
goadesign/goa-cellar
client/account.go
DeleteAccount
func (c *Client) DeleteAccount(ctx context.Context, path string) (*http.Response, error) { req, err := c.NewDeleteAccountRequest(ctx, path) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
go
func (c *Client) DeleteAccount(ctx context.Context, path string) (*http.Response, error) { req, err := c.NewDeleteAccountRequest(ctx, path) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
[ "func", "(", "c", "*", "Client", ")", "DeleteAccount", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "req", ",", "err", ":=", "c", ".", "NewDeleteAccountRequest", "(", "c...
// DeleteAccount makes a request to the delete action endpoint of the account resource
[ "DeleteAccount", "makes", "a", "request", "to", "the", "delete", "action", "endpoint", "of", "the", "account", "resource" ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/account.go#L79-L85
140,546
goadesign/goa-cellar
client/account.go
NewDeleteAccountRequest
func (c *Client) NewDeleteAccountRequest(ctx context.Context, path string) (*http.Request, error) { scheme := c.Scheme if scheme == "" { scheme = "http" } u := url.URL{Host: c.Host, Scheme: scheme, Path: path} req, err := http.NewRequest("DELETE", u.String(), nil) if err != nil { return nil, err } return re...
go
func (c *Client) NewDeleteAccountRequest(ctx context.Context, path string) (*http.Request, error) { scheme := c.Scheme if scheme == "" { scheme = "http" } u := url.URL{Host: c.Host, Scheme: scheme, Path: path} req, err := http.NewRequest("DELETE", u.String(), nil) if err != nil { return nil, err } return re...
[ "func", "(", "c", "*", "Client", ")", "NewDeleteAccountRequest", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "scheme", ":=", "c", ".", "Scheme", "\n", "if", "scheme", "=...
// NewDeleteAccountRequest create the request corresponding to the delete action endpoint of the account resource.
[ "NewDeleteAccountRequest", "create", "the", "request", "corresponding", "to", "the", "delete", "action", "endpoint", "of", "the", "account", "resource", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/account.go#L88-L99
140,547
goadesign/goa-cellar
client/account.go
ListAccount
func (c *Client) ListAccount(ctx context.Context, path string) (*http.Response, error) { req, err := c.NewListAccountRequest(ctx, path) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
go
func (c *Client) ListAccount(ctx context.Context, path string) (*http.Response, error) { req, err := c.NewListAccountRequest(ctx, path) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
[ "func", "(", "c", "*", "Client", ")", "ListAccount", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "req", ",", "err", ":=", "c", ".", "NewListAccountRequest", "(", "ctx",...
// Retrieve all accounts.
[ "Retrieve", "all", "accounts", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/account.go#L108-L114
140,548
goadesign/goa-cellar
client/account.go
ShowAccount
func (c *Client) ShowAccount(ctx context.Context, path string) (*http.Response, error) { req, err := c.NewShowAccountRequest(ctx, path) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
go
func (c *Client) ShowAccount(ctx context.Context, path string) (*http.Response, error) { req, err := c.NewShowAccountRequest(ctx, path) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
[ "func", "(", "c", "*", "Client", ")", "ShowAccount", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "req", ",", "err", ":=", "c", ".", "NewShowAccountRequest", "(", "ctx",...
// Retrieve account with given id. IDs 1 and 2 pre-exist in the system.
[ "Retrieve", "account", "with", "given", "id", ".", "IDs", "1", "and", "2", "pre", "-", "exist", "in", "the", "system", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/account.go#L138-L144
140,549
goadesign/goa-cellar
client/account.go
UpdateAccount
func (c *Client) UpdateAccount(ctx context.Context, path string, payload *UpdateAccountPayload, contentType string) (*http.Response, error) { req, err := c.NewUpdateAccountRequest(ctx, path, payload, contentType) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
go
func (c *Client) UpdateAccount(ctx context.Context, path string, payload *UpdateAccountPayload, contentType string) (*http.Response, error) { req, err := c.NewUpdateAccountRequest(ctx, path, payload, contentType) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
[ "func", "(", "c", "*", "Client", ")", "UpdateAccount", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "payload", "*", "UpdateAccountPayload", ",", "contentType", "string", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{"...
// Change account name
[ "Change", "account", "name" ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/account.go#L174-L180
140,550
goadesign/goa-cellar
app/contexts.go
Publicize
func (payload *createAccountPayload) Publicize() *CreateAccountPayload { var pub CreateAccountPayload if payload.Name != nil { pub.Name = *payload.Name } return &pub }
go
func (payload *createAccountPayload) Publicize() *CreateAccountPayload { var pub CreateAccountPayload if payload.Name != nil { pub.Name = *payload.Name } return &pub }
[ "func", "(", "payload", "*", "createAccountPayload", ")", "Publicize", "(", ")", "*", "CreateAccountPayload", "{", "var", "pub", "CreateAccountPayload", "\n", "if", "payload", ".", "Name", "!=", "nil", "{", "pub", ".", "Name", "=", "*", "payload", ".", "Na...
// Publicize creates CreateAccountPayload from createAccountPayload
[ "Publicize", "creates", "CreateAccountPayload", "from", "createAccountPayload" ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/contexts.go#L56-L62
140,551
goadesign/goa-cellar
app/contexts.go
NewListAccountContext
func NewListAccountContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListAccountContext, error) { var err error resp := goa.ContextResponse(ctx) resp.Service = service req := goa.ContextRequest(ctx) req.Request = r rctx := ListAccountContext{Context: ctx, ResponseData: resp, RequestData: req} ...
go
func NewListAccountContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListAccountContext, error) { var err error resp := goa.ContextResponse(ctx) resp.Service = service req := goa.ContextRequest(ctx) req.Request = r rctx := ListAccountContext{Context: ctx, ResponseData: resp, RequestData: req} ...
[ "func", "NewListAccountContext", "(", "ctx", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ",", "service", "*", "goa", ".", "Service", ")", "(", "*", "ListAccountContext", ",", "error", ")", "{", "var", "err", "error", "\n", "resp", ...
// NewListAccountContext parses the incoming request URL and body, performs validations and creates the // context used by the account controller list action.
[ "NewListAccountContext", "parses", "the", "incoming", "request", "URL", "and", "body", "performs", "validations", "and", "creates", "the", "context", "used", "by", "the", "account", "controller", "list", "action", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/contexts.go#L150-L158
140,552
goadesign/goa-cellar
app/contexts.go
BadRequest
func (ctx *ShowAccountContext) BadRequest(r error) error { if ctx.ResponseData.Header().Get("Content-Type") == "" { ctx.ResponseData.Header().Set("Content-Type", "application/vnd.goa.error") } return ctx.ResponseData.Service.Send(ctx.Context, 400, r) }
go
func (ctx *ShowAccountContext) BadRequest(r error) error { if ctx.ResponseData.Header().Get("Content-Type") == "" { ctx.ResponseData.Header().Set("Content-Type", "application/vnd.goa.error") } return ctx.ResponseData.Service.Send(ctx.Context, 400, r) }
[ "func", "(", "ctx", "*", "ShowAccountContext", ")", "BadRequest", "(", "r", "error", ")", "error", "{", "if", "ctx", ".", "ResponseData", ".", "Header", "(", ")", ".", "Get", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "ctx", ".", "ResponseData", ...
// BadRequest sends a HTTP response with status code 400.
[ "BadRequest", "sends", "a", "HTTP", "response", "with", "status", "code", "400", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/contexts.go#L250-L255
140,553
goadesign/goa-cellar
app/contexts.go
Publicize
func (payload *updateAccountPayload) Publicize() *UpdateAccountPayload { var pub UpdateAccountPayload if payload.Name != nil { pub.Name = *payload.Name } return &pub }
go
func (payload *updateAccountPayload) Publicize() *UpdateAccountPayload { var pub UpdateAccountPayload if payload.Name != nil { pub.Name = *payload.Name } return &pub }
[ "func", "(", "payload", "*", "updateAccountPayload", ")", "Publicize", "(", ")", "*", "UpdateAccountPayload", "{", "var", "pub", "UpdateAccountPayload", "\n", "if", "payload", ".", "Name", "!=", "nil", "{", "pub", ".", "Name", "=", "*", "payload", ".", "Na...
// Publicize creates UpdateAccountPayload from updateAccountPayload
[ "Publicize", "creates", "UpdateAccountPayload", "from", "updateAccountPayload" ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/contexts.go#L308-L314
140,554
goadesign/goa-cellar
app/contexts.go
Publicize
func (payload *createBottlePayload) Publicize() *CreateBottlePayload { var pub CreateBottlePayload if payload.Color != nil { pub.Color = *payload.Color } if payload.Country != nil { pub.Country = payload.Country } if payload.Name != nil { pub.Name = *payload.Name } if payload.Region != nil { pub.Region ...
go
func (payload *createBottlePayload) Publicize() *CreateBottlePayload { var pub CreateBottlePayload if payload.Color != nil { pub.Color = *payload.Color } if payload.Country != nil { pub.Country = payload.Country } if payload.Name != nil { pub.Name = *payload.Name } if payload.Region != nil { pub.Region ...
[ "func", "(", "payload", "*", "createBottlePayload", ")", "Publicize", "(", ")", "*", "CreateBottlePayload", "{", "var", "pub", "CreateBottlePayload", "\n", "if", "payload", ".", "Color", "!=", "nil", "{", "pub", ".", "Color", "=", "*", "payload", ".", "Col...
// Publicize creates CreateBottlePayload from createBottlePayload
[ "Publicize", "creates", "CreateBottlePayload", "from", "createBottlePayload" ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/contexts.go#L472-L502
140,555
goadesign/goa-cellar
app/contexts.go
NewListBottleContext
func NewListBottleContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListBottleContext, error) { var err error resp := goa.ContextResponse(ctx) resp.Service = service req := goa.ContextRequest(ctx) req.Request = r rctx := ListBottleContext{Context: ctx, ResponseData: resp, RequestData: req} pa...
go
func NewListBottleContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListBottleContext, error) { var err error resp := goa.ContextResponse(ctx) resp.Service = service req := goa.ContextRequest(ctx) req.Request = r rctx := ListBottleContext{Context: ctx, ResponseData: resp, RequestData: req} pa...
[ "func", "NewListBottleContext", "(", "ctx", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ",", "service", "*", "goa", ".", "Service", ")", "(", "*", "ListBottleContext", ",", "error", ")", "{", "var", "err", "error", "\n", "resp", "...
// NewListBottleContext parses the incoming request URL and body, performs validations and creates the // context used by the bottle controller list action.
[ "NewListBottleContext", "parses", "the", "incoming", "request", "URL", "and", "body", "performs", "validations", "and", "creates", "the", "context", "used", "by", "the", "bottle", "controller", "list", "action", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/contexts.go#L671-L703
140,556
goadesign/goa-cellar
app/contexts.go
Publicize
func (payload *rateBottlePayload) Publicize() *RateBottlePayload { var pub RateBottlePayload if payload.Rating != nil { pub.Rating = *payload.Rating } return &pub }
go
func (payload *rateBottlePayload) Publicize() *RateBottlePayload { var pub RateBottlePayload if payload.Rating != nil { pub.Rating = *payload.Rating } return &pub }
[ "func", "(", "payload", "*", "rateBottlePayload", ")", "Publicize", "(", ")", "*", "RateBottlePayload", "{", "var", "pub", "RateBottlePayload", "\n", "if", "payload", ".", "Rating", "!=", "nil", "{", "pub", ".", "Rating", "=", "*", "payload", ".", "Rating"...
// Publicize creates RateBottlePayload from rateBottlePayload
[ "Publicize", "creates", "RateBottlePayload", "from", "rateBottlePayload" ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/contexts.go#L809-L815
140,557
goadesign/goa-cellar
app/contexts.go
NewShowBottleContext
func NewShowBottleContext(ctx context.Context, r *http.Request, service *goa.Service) (*ShowBottleContext, error) { var err error resp := goa.ContextResponse(ctx) resp.Service = service req := goa.ContextRequest(ctx) req.Request = r rctx := ShowBottleContext{Context: ctx, ResponseData: resp, RequestData: req} pa...
go
func NewShowBottleContext(ctx context.Context, r *http.Request, service *goa.Service) (*ShowBottleContext, error) { var err error resp := goa.ContextResponse(ctx) resp.Service = service req := goa.ContextRequest(ctx) req.Request = r rctx := ShowBottleContext{Context: ctx, ResponseData: resp, RequestData: req} pa...
[ "func", "NewShowBottleContext", "(", "ctx", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ",", "service", "*", "goa", ".", "Service", ")", "(", "*", "ShowBottleContext", ",", "error", ")", "{", "var", "err", "error", "\n", "resp", "...
// NewShowBottleContext parses the incoming request URL and body, performs validations and creates the // context used by the bottle controller show action.
[ "NewShowBottleContext", "parses", "the", "incoming", "request", "URL", "and", "body", "performs", "validations", "and", "creates", "the", "context", "used", "by", "the", "bottle", "controller", "show", "action", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/contexts.go#L865-L894
140,558
goadesign/goa-cellar
app/contexts.go
OKFull
func (ctx *ShowBottleContext) OKFull(r *BottleFull) error { if ctx.ResponseData.Header().Get("Content-Type") == "" { ctx.ResponseData.Header().Set("Content-Type", "application/vnd.bottle+json") } return ctx.ResponseData.Service.Send(ctx.Context, 200, r) }
go
func (ctx *ShowBottleContext) OKFull(r *BottleFull) error { if ctx.ResponseData.Header().Get("Content-Type") == "" { ctx.ResponseData.Header().Set("Content-Type", "application/vnd.bottle+json") } return ctx.ResponseData.Service.Send(ctx.Context, 200, r) }
[ "func", "(", "ctx", "*", "ShowBottleContext", ")", "OKFull", "(", "r", "*", "BottleFull", ")", "error", "{", "if", "ctx", ".", "ResponseData", ".", "Header", "(", ")", ".", "Get", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "ctx", ".", "ResponseDa...
// OKFull sends a HTTP response with status code 200.
[ "OKFull", "sends", "a", "HTTP", "response", "with", "status", "code", "200", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/contexts.go#L905-L910
140,559
goadesign/goa-cellar
app/user_types.go
Publicize
func (ut *bottlePayload) Publicize() *BottlePayload { var pub BottlePayload if ut.Color != nil { pub.Color = ut.Color } if ut.Country != nil { pub.Country = ut.Country } if ut.Name != nil { pub.Name = ut.Name } if ut.Region != nil { pub.Region = ut.Region } if ut.Review != nil { pub.Review = ut.Revi...
go
func (ut *bottlePayload) Publicize() *BottlePayload { var pub BottlePayload if ut.Color != nil { pub.Color = ut.Color } if ut.Country != nil { pub.Country = ut.Country } if ut.Name != nil { pub.Name = ut.Name } if ut.Region != nil { pub.Region = ut.Region } if ut.Review != nil { pub.Review = ut.Revi...
[ "func", "(", "ut", "*", "bottlePayload", ")", "Publicize", "(", ")", "*", "BottlePayload", "{", "var", "pub", "BottlePayload", "\n", "if", "ut", ".", "Color", "!=", "nil", "{", "pub", ".", "Color", "=", "ut", ".", "Color", "\n", "}", "\n", "if", "u...
// Publicize creates BottlePayload from bottlePayload
[ "Publicize", "creates", "BottlePayload", "from", "bottlePayload" ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/user_types.go#L92-L122
140,560
goadesign/goa-cellar
controllers/health.go
NewHealth
func NewHealth(service *goa.Service, db *store.DB) *HealthController { return &HealthController{ Controller: service.NewController("Health"), db: db, } }
go
func NewHealth(service *goa.Service, db *store.DB) *HealthController { return &HealthController{ Controller: service.NewController("Health"), db: db, } }
[ "func", "NewHealth", "(", "service", "*", "goa", ".", "Service", ",", "db", "*", "store", ".", "DB", ")", "*", "HealthController", "{", "return", "&", "HealthController", "{", "Controller", ":", "service", ".", "NewController", "(", "\"", "\"", ")", ",",...
// NewHealth creates a account controller.
[ "NewHealth", "creates", "a", "account", "controller", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/health.go#L18-L23
140,561
goadesign/goa-cellar
controllers/health.go
Health
func (b *HealthController) Health(c *app.HealthHealthContext) error { if _, ok := b.db.GetAccount(1); !ok { return fmt.Errorf("failed to connect to DB") } return c.OK([]byte("ok")) }
go
func (b *HealthController) Health(c *app.HealthHealthContext) error { if _, ok := b.db.GetAccount(1); !ok { return fmt.Errorf("failed to connect to DB") } return c.OK([]byte("ok")) }
[ "func", "(", "b", "*", "HealthController", ")", "Health", "(", "c", "*", "app", ".", "HealthHealthContext", ")", "error", "{", "if", "_", ",", "ok", ":=", "b", ".", "db", ".", "GetAccount", "(", "1", ")", ";", "!", "ok", "{", "return", "fmt", "."...
// Health performs the health-check.
[ "Health", "performs", "the", "health", "-", "check", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/health.go#L26-L31
140,562
goadesign/goa-cellar
client/client.go
New
func New(c goaclient.Doer) *Client { client := &Client{ Client: goaclient.New(c), Encoder: goa.NewHTTPEncoder(), Decoder: goa.NewHTTPDecoder(), } // Setup encoders and decoders client.Encoder.Register(goa.NewJSONEncoder, "application/json") client.Encoder.Register(goa.NewGobEncoder, "application/gob", "app...
go
func New(c goaclient.Doer) *Client { client := &Client{ Client: goaclient.New(c), Encoder: goa.NewHTTPEncoder(), Decoder: goa.NewHTTPDecoder(), } // Setup encoders and decoders client.Encoder.Register(goa.NewJSONEncoder, "application/json") client.Encoder.Register(goa.NewGobEncoder, "application/gob", "app...
[ "func", "New", "(", "c", "goaclient", ".", "Doer", ")", "*", "Client", "{", "client", ":=", "&", "Client", "{", "Client", ":", "goaclient", ".", "New", "(", "c", ")", ",", "Encoder", ":", "goa", ".", "NewHTTPEncoder", "(", ")", ",", "Decoder", ":",...
// New instantiates the client.
[ "New", "instantiates", "the", "client", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/client.go#L26-L46
140,563
goadesign/goa-cellar
client/health.go
HealthHealth
func (c *Client) HealthHealth(ctx context.Context, path string) (*http.Response, error) { req, err := c.NewHealthHealthRequest(ctx, path) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
go
func (c *Client) HealthHealth(ctx context.Context, path string) (*http.Response, error) { req, err := c.NewHealthHealthRequest(ctx, path) if err != nil { return nil, err } return c.Client.Do(ctx, req) }
[ "func", "(", "c", "*", "Client", ")", "HealthHealth", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "req", ",", "err", ":=", "c", ".", "NewHealthHealthRequest", "(", "ctx...
// Perform health check.
[ "Perform", "health", "check", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/client/health.go#L27-L33
140,564
goadesign/goa-cellar
store/db.go
NewDB
func NewDB() *DB { account := &AccountModel{ID: 1, Name: "account 1"} account2 := &AccountModel{ID: 2, Name: "account 2"} bottles := map[int][]*BottleModel{ 1: []*BottleModel{ &BottleModel{ ID: 100, AccountID: 1, Name: "Number 8", Kind: "wine", Vineyard: "Asti Winery", ...
go
func NewDB() *DB { account := &AccountModel{ID: 1, Name: "account 1"} account2 := &AccountModel{ID: 2, Name: "account 2"} bottles := map[int][]*BottleModel{ 1: []*BottleModel{ &BottleModel{ ID: 100, AccountID: 1, Name: "Number 8", Kind: "wine", Vineyard: "Asti Winery", ...
[ "func", "NewDB", "(", ")", "*", "DB", "{", "account", ":=", "&", "AccountModel", "{", "ID", ":", "1", ",", "Name", ":", "\"", "\"", "}", "\n", "account2", ":=", "&", "AccountModel", "{", "ID", ":", "2", ",", "Name", ":", "\"", "\"", "}", "\n", ...
// NewDB initializes a new "DB" with dummy data.
[ "NewDB", "initializes", "a", "new", "DB", "with", "dummy", "data", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L61-L146
140,565
goadesign/goa-cellar
store/db.go
Reset
func (db *DB) Reset() { db.maxAccountModelID = 0 db.accounts = make(map[int]*AccountModel) db.bottles = make(map[int][]*BottleModel) }
go
func (db *DB) Reset() { db.maxAccountModelID = 0 db.accounts = make(map[int]*AccountModel) db.bottles = make(map[int][]*BottleModel) }
[ "func", "(", "db", "*", "DB", ")", "Reset", "(", ")", "{", "db", ".", "maxAccountModelID", "=", "0", "\n", "db", ".", "accounts", "=", "make", "(", "map", "[", "int", "]", "*", "AccountModel", ")", "\n", "db", ".", "bottles", "=", "make", "(", ...
// Reset removes all entries from the database. Mainly intended for tests.
[ "Reset", "removes", "all", "entries", "from", "the", "database", ".", "Mainly", "intended", "for", "tests", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L149-L153
140,566
goadesign/goa-cellar
store/db.go
GetAccounts
func (db *DB) GetAccounts() []AccountModel { db.Lock() defer db.Unlock() ids := make([]int, len(db.accounts)) i := 0 for id := range db.accounts { ids[i] = id i++ } sort.Ints(ids) list := make([]AccountModel, len(ids)) for i, id := range ids { list[i] = *db.accounts[id] } return list }
go
func (db *DB) GetAccounts() []AccountModel { db.Lock() defer db.Unlock() ids := make([]int, len(db.accounts)) i := 0 for id := range db.accounts { ids[i] = id i++ } sort.Ints(ids) list := make([]AccountModel, len(ids)) for i, id := range ids { list[i] = *db.accounts[id] } return list }
[ "func", "(", "db", "*", "DB", ")", "GetAccounts", "(", ")", "[", "]", "AccountModel", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n", "ids", ":=", "make", "(", "[", "]", "int", ",", "len", "(", "db", ".",...
// GetAccounts returns all the accounts.
[ "GetAccounts", "returns", "all", "the", "accounts", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L156-L171
140,567
goadesign/goa-cellar
store/db.go
GetAccount
func (db *DB) GetAccount(id int) (model AccountModel, ok bool) { db.Lock() defer db.Unlock() var p *AccountModel if p, ok = db.accounts[id]; ok { model = *p ok = true } return }
go
func (db *DB) GetAccount(id int) (model AccountModel, ok bool) { db.Lock() defer db.Unlock() var p *AccountModel if p, ok = db.accounts[id]; ok { model = *p ok = true } return }
[ "func", "(", "db", "*", "DB", ")", "GetAccount", "(", "id", "int", ")", "(", "model", "AccountModel", ",", "ok", "bool", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n", "var", "p", "*", "AccountModel", ...
// GetAccount returns the account with given id if any, nil otherwise.
[ "GetAccount", "returns", "the", "account", "with", "given", "id", "if", "any", "nil", "otherwise", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L174-L183
140,568
goadesign/goa-cellar
store/db.go
NewAccount
func (db *DB) NewAccount() (model AccountModel) { db.Lock() defer db.Unlock() db.maxAccountModelID++ model = AccountModel{ID: db.maxAccountModelID} db.accounts[db.maxAccountModelID] = &model return }
go
func (db *DB) NewAccount() (model AccountModel) { db.Lock() defer db.Unlock() db.maxAccountModelID++ model = AccountModel{ID: db.maxAccountModelID} db.accounts[db.maxAccountModelID] = &model return }
[ "func", "(", "db", "*", "DB", ")", "NewAccount", "(", ")", "(", "model", "AccountModel", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n", "db", ".", "maxAccountModelID", "++", "\n", "model", "=", "AccountMo...
// NewAccount creates a new blank account resource.
[ "NewAccount", "creates", "a", "new", "blank", "account", "resource", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L186-L193
140,569
goadesign/goa-cellar
store/db.go
SaveAccount
func (db *DB) SaveAccount(model AccountModel) { db.Lock() defer db.Unlock() db.accounts[model.ID] = &model }
go
func (db *DB) SaveAccount(model AccountModel) { db.Lock() defer db.Unlock() db.accounts[model.ID] = &model }
[ "func", "(", "db", "*", "DB", ")", "SaveAccount", "(", "model", "AccountModel", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n", "db", ".", "accounts", "[", "model", ".", "ID", "]", "=", "&", "model", "...
// SaveAccount "persists" the account.
[ "SaveAccount", "persists", "the", "account", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L196-L200
140,570
goadesign/goa-cellar
store/db.go
DeleteAccount
func (db *DB) DeleteAccount(model AccountModel) { db.Lock() defer db.Unlock() delete(db.bottles, model.ID) delete(db.accounts, model.ID) }
go
func (db *DB) DeleteAccount(model AccountModel) { db.Lock() defer db.Unlock() delete(db.bottles, model.ID) delete(db.accounts, model.ID) }
[ "func", "(", "db", "*", "DB", ")", "DeleteAccount", "(", "model", "AccountModel", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n", "delete", "(", "db", ".", "bottles", ",", "model", ".", "ID", ")", "\n", ...
// DeleteAccount deletes the account.
[ "DeleteAccount", "deletes", "the", "account", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L203-L208
140,571
goadesign/goa-cellar
store/db.go
GetBottle
func (db *DB) GetBottle(account, id int) (model BottleModel, ok bool) { db.Lock() defer db.Unlock() bottles, found := db.bottles[account] if !found { return } for _, b := range bottles { if b.ID == id { model = *b ok = true break } } return }
go
func (db *DB) GetBottle(account, id int) (model BottleModel, ok bool) { db.Lock() defer db.Unlock() bottles, found := db.bottles[account] if !found { return } for _, b := range bottles { if b.ID == id { model = *b ok = true break } } return }
[ "func", "(", "db", "*", "DB", ")", "GetBottle", "(", "account", ",", "id", "int", ")", "(", "model", "BottleModel", ",", "ok", "bool", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n", "bottles", ",", "f...
// GetBottle returns the bottle with the given id from the given account or nil if not found.
[ "GetBottle", "returns", "the", "bottle", "with", "the", "given", "id", "from", "the", "given", "account", "or", "nil", "if", "not", "found", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L211-L226
140,572
goadesign/goa-cellar
store/db.go
GetBottles
func (db *DB) GetBottles(account int) ([]BottleModel, error) { db.Lock() defer db.Unlock() bottles, ok := db.bottles[account] if !ok { return nil, fmt.Errorf("unknown account %d", account) } list := make([]BottleModel, len(bottles)) for i, b := range bottles { list[i] = *b } return list, nil }
go
func (db *DB) GetBottles(account int) ([]BottleModel, error) { db.Lock() defer db.Unlock() bottles, ok := db.bottles[account] if !ok { return nil, fmt.Errorf("unknown account %d", account) } list := make([]BottleModel, len(bottles)) for i, b := range bottles { list[i] = *b } return list, nil }
[ "func", "(", "db", "*", "DB", ")", "GetBottles", "(", "account", "int", ")", "(", "[", "]", "BottleModel", ",", "error", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n", "bottles", ",", "ok", ":=", "db"...
// GetBottles return the bottles from the given account.
[ "GetBottles", "return", "the", "bottles", "from", "the", "given", "account", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L229-L241
140,573
goadesign/goa-cellar
store/db.go
GetBottlesByYears
func (db *DB) GetBottlesByYears(account int, years []int) ([]BottleModel, error) { db.Lock() defer db.Unlock() bottles, ok := db.bottles[account] if !ok { return nil, fmt.Errorf("unknown account %d", account) } var res []BottleModel for _, b := range bottles { for _, y := range years { if y == b.Vintage {...
go
func (db *DB) GetBottlesByYears(account int, years []int) ([]BottleModel, error) { db.Lock() defer db.Unlock() bottles, ok := db.bottles[account] if !ok { return nil, fmt.Errorf("unknown account %d", account) } var res []BottleModel for _, b := range bottles { for _, y := range years { if y == b.Vintage {...
[ "func", "(", "db", "*", "DB", ")", "GetBottlesByYears", "(", "account", "int", ",", "years", "[", "]", "int", ")", "(", "[", "]", "BottleModel", ",", "error", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", ...
// GetBottlesByYears returns the bottles with the vintage in the given array from the given account.
[ "GetBottlesByYears", "returns", "the", "bottles", "with", "the", "vintage", "in", "the", "given", "array", "from", "the", "given", "account", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L244-L263
140,574
goadesign/goa-cellar
store/db.go
NewBottle
func (db *DB) NewBottle(account int) (model BottleModel, err error) { db.Lock() defer db.Unlock() if _, ok := db.accounts[account]; !ok { return model, fmt.Errorf("unknown account %d", account) } bottles, _ := db.bottles[account] newID := 0 for { // newID has to be incremented in the loop, not // in the fo...
go
func (db *DB) NewBottle(account int) (model BottleModel, err error) { db.Lock() defer db.Unlock() if _, ok := db.accounts[account]; !ok { return model, fmt.Errorf("unknown account %d", account) } bottles, _ := db.bottles[account] newID := 0 for { // newID has to be incremented in the loop, not // in the fo...
[ "func", "(", "db", "*", "DB", ")", "NewBottle", "(", "account", "int", ")", "(", "model", "BottleModel", ",", "err", "error", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "ok", ":=",...
// NewBottle creates a new bottle resource.
[ "NewBottle", "creates", "a", "new", "bottle", "resource", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L266-L294
140,575
goadesign/goa-cellar
store/db.go
SaveBottle
func (db *DB) SaveBottle(model BottleModel) { db.Lock() defer db.Unlock() bottles, found := db.bottles[model.AccountID] if found { for i := 0; i < len(bottles); i++ { if bottles[i].ID == model.ID { bottles[i] = &model break } } } else { db.bottles[model.AccountID] = append(db.bottles[model.Acc...
go
func (db *DB) SaveBottle(model BottleModel) { db.Lock() defer db.Unlock() bottles, found := db.bottles[model.AccountID] if found { for i := 0; i < len(bottles); i++ { if bottles[i].ID == model.ID { bottles[i] = &model break } } } else { db.bottles[model.AccountID] = append(db.bottles[model.Acc...
[ "func", "(", "db", "*", "DB", ")", "SaveBottle", "(", "model", "BottleModel", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n\n", "bottles", ",", "found", ":=", "db", ".", "bottles", "[", "model", ".", "Ac...
// SaveBottle persists bottle to bottlesbase.
[ "SaveBottle", "persists", "bottle", "to", "bottlesbase", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L297-L312
140,576
goadesign/goa-cellar
store/db.go
DeleteBottle
func (db *DB) DeleteBottle(model BottleModel) { db.Lock() defer db.Unlock() id, accountID := model.ID, model.AccountID if bs, ok := db.bottles[accountID]; ok { idx := -1 for i, b := range bs { if b.ID == id { idx = i break } } if idx > -1 { bs = append(bs[:idx], bs[idx+1:]...) db.bottles...
go
func (db *DB) DeleteBottle(model BottleModel) { db.Lock() defer db.Unlock() id, accountID := model.ID, model.AccountID if bs, ok := db.bottles[accountID]; ok { idx := -1 for i, b := range bs { if b.ID == id { idx = i break } } if idx > -1 { bs = append(bs[:idx], bs[idx+1:]...) db.bottles...
[ "func", "(", "db", "*", "DB", ")", "DeleteBottle", "(", "model", "BottleModel", ")", "{", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n", "id", ",", "accountID", ":=", "model", ".", "ID", ",", "model", ".", "Accou...
// DeleteBottle deletes bottle from bottlesbase.
[ "DeleteBottle", "deletes", "bottle", "from", "bottlesbase", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/store/db.go#L315-L332
140,577
goadesign/goa-cellar
app/hrefs.go
AccountHref
func AccountHref(accountID interface{}) string { paramaccountID := strings.TrimLeftFunc(fmt.Sprintf("%v", accountID), func(r rune) bool { return r == '/' }) return fmt.Sprintf("/cellar/accounts/%v", paramaccountID) }
go
func AccountHref(accountID interface{}) string { paramaccountID := strings.TrimLeftFunc(fmt.Sprintf("%v", accountID), func(r rune) bool { return r == '/' }) return fmt.Sprintf("/cellar/accounts/%v", paramaccountID) }
[ "func", "AccountHref", "(", "accountID", "interface", "{", "}", ")", "string", "{", "paramaccountID", ":=", "strings", ".", "TrimLeftFunc", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "accountID", ")", ",", "func", "(", "r", "rune", ")", "bool", ...
// AccountHref returns the resource href.
[ "AccountHref", "returns", "the", "resource", "href", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/hrefs.go#L19-L22
140,578
goadesign/goa-cellar
app/hrefs.go
BottleHref
func BottleHref(accountID, bottleID interface{}) string { paramaccountID := strings.TrimLeftFunc(fmt.Sprintf("%v", accountID), func(r rune) bool { return r == '/' }) parambottleID := strings.TrimLeftFunc(fmt.Sprintf("%v", bottleID), func(r rune) bool { return r == '/' }) return fmt.Sprintf("/cellar/accounts/%v/bottl...
go
func BottleHref(accountID, bottleID interface{}) string { paramaccountID := strings.TrimLeftFunc(fmt.Sprintf("%v", accountID), func(r rune) bool { return r == '/' }) parambottleID := strings.TrimLeftFunc(fmt.Sprintf("%v", bottleID), func(r rune) bool { return r == '/' }) return fmt.Sprintf("/cellar/accounts/%v/bottl...
[ "func", "BottleHref", "(", "accountID", ",", "bottleID", "interface", "{", "}", ")", "string", "{", "paramaccountID", ":=", "strings", ".", "TrimLeftFunc", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "accountID", ")", ",", "func", "(", "r", "rune",...
// BottleHref returns the resource href.
[ "BottleHref", "returns", "the", "resource", "href", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/app/hrefs.go#L25-L29
140,579
goadesign/goa-cellar
tool/cli/commands.go
Run
func (cmd *DownloadCommand) Run(c *client.Client, args []string) error { var ( fnf func(context.Context, string) (int64, error) fnd func(context.Context, string, string) (int64, error) rpath = args[0] outfile = cmd.OutFile logger = goa.NewLogger(log.New(os.Stderr, "", log.LstdFlags)) ctx = goa.With...
go
func (cmd *DownloadCommand) Run(c *client.Client, args []string) error { var ( fnf func(context.Context, string) (int64, error) fnd func(context.Context, string, string) (int64, error) rpath = args[0] outfile = cmd.OutFile logger = goa.NewLogger(log.New(os.Stderr, "", log.LstdFlags)) ctx = goa.With...
[ "func", "(", "cmd", "*", "DownloadCommand", ")", "Run", "(", "c", "*", "client", ".", "Client", ",", "args", "[", "]", "string", ")", "error", "{", "var", "(", "fnf", "func", "(", "context", ".", "Context", ",", "string", ")", "(", "int64", ",", ...
// Run downloads files with given paths.
[ "Run", "downloads", "files", "with", "given", "paths", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/tool/cli/commands.go#L518-L569
140,580
goadesign/goa-cellar
tool/cli/commands.go
Run
func (cmd *ShowAccountCommand) Run(c *client.Client, args []string) error { var path string if len(args) > 0 { path = args[0] } else { path = fmt.Sprintf("/cellar/accounts/%v", cmd.AccountID) } logger := goa.NewLogger(log.New(os.Stderr, "", log.LstdFlags)) ctx := goa.WithLogger(context.Background(), logger) ...
go
func (cmd *ShowAccountCommand) Run(c *client.Client, args []string) error { var path string if len(args) > 0 { path = args[0] } else { path = fmt.Sprintf("/cellar/accounts/%v", cmd.AccountID) } logger := goa.NewLogger(log.New(os.Stderr, "", log.LstdFlags)) ctx := goa.WithLogger(context.Background(), logger) ...
[ "func", "(", "cmd", "*", "ShowAccountCommand", ")", "Run", "(", "c", "*", "client", ".", "Client", ",", "args", "[", "]", "string", ")", "error", "{", "var", "path", "string", "\n", "if", "len", "(", "args", ")", ">", "0", "{", "path", "=", "args...
// Run makes the HTTP request corresponding to the ShowAccountCommand command.
[ "Run", "makes", "the", "HTTP", "request", "corresponding", "to", "the", "ShowAccountCommand", "command", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/tool/cli/commands.go#L655-L672
140,581
goadesign/goa-cellar
tool/cli/commands.go
Run
func (cmd *UpdateAccountCommand) Run(c *client.Client, args []string) error { var path string if len(args) > 0 { path = args[0] } else { path = fmt.Sprintf("/cellar/accounts/%v", cmd.AccountID) } var payload client.UpdateAccountPayload if cmd.Payload != "" { err := json.Unmarshal([]byte(cmd.Payload), &paylo...
go
func (cmd *UpdateAccountCommand) Run(c *client.Client, args []string) error { var path string if len(args) > 0 { path = args[0] } else { path = fmt.Sprintf("/cellar/accounts/%v", cmd.AccountID) } var payload client.UpdateAccountPayload if cmd.Payload != "" { err := json.Unmarshal([]byte(cmd.Payload), &paylo...
[ "func", "(", "cmd", "*", "UpdateAccountCommand", ")", "Run", "(", "c", "*", "client", ".", "Client", ",", "args", "[", "]", "string", ")", "error", "{", "var", "path", "string", "\n", "if", "len", "(", "args", ")", ">", "0", "{", "path", "=", "ar...
// Run makes the HTTP request corresponding to the UpdateAccountCommand command.
[ "Run", "makes", "the", "HTTP", "request", "corresponding", "to", "the", "UpdateAccountCommand", "command", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/tool/cli/commands.go#L681-L705
140,582
goadesign/goa-cellar
tool/cli/commands.go
Run
func (cmd *WatchBottleCommand) Run(c *client.Client, args []string) error { var path string if len(args) > 0 { path = args[0] } else { path = fmt.Sprintf("/cellar/accounts/%v/bottles/%v/watch", cmd.AccountID, cmd.BottleID) } logger := goa.NewLogger(log.New(os.Stderr, "", log.LstdFlags)) ctx := goa.WithLogger(...
go
func (cmd *WatchBottleCommand) Run(c *client.Client, args []string) error { var path string if len(args) > 0 { path = args[0] } else { path = fmt.Sprintf("/cellar/accounts/%v/bottles/%v/watch", cmd.AccountID, cmd.BottleID) } logger := goa.NewLogger(log.New(os.Stderr, "", log.LstdFlags)) ctx := goa.WithLogger(...
[ "func", "(", "cmd", "*", "WatchBottleCommand", ")", "Run", "(", "c", "*", "client", ".", "Client", ",", "args", "[", "]", "string", ")", "error", "{", "var", "path", "string", "\n", "if", "len", "(", "args", ")", ">", "0", "{", "path", "=", "args...
// Run establishes a websocket connection for the WatchBottleCommand command.
[ "Run", "establishes", "a", "websocket", "connection", "for", "the", "WatchBottleCommand", "command", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/tool/cli/commands.go#L909-L927
140,583
goadesign/goa-cellar
controllers/account.go
ToAccountMedia
func ToAccountMedia(account *store.AccountModel) *app.Account { return &app.Account{ ID: account.ID, Href: app.AccountHref(account.ID), Name: account.Name, CreatedAt: account.CreatedAt, CreatedBy: account.CreatedBy, } }
go
func ToAccountMedia(account *store.AccountModel) *app.Account { return &app.Account{ ID: account.ID, Href: app.AccountHref(account.ID), Name: account.Name, CreatedAt: account.CreatedAt, CreatedBy: account.CreatedBy, } }
[ "func", "ToAccountMedia", "(", "account", "*", "store", ".", "AccountModel", ")", "*", "app", ".", "Account", "{", "return", "&", "app", ".", "Account", "{", "ID", ":", "account", ".", "ID", ",", "Href", ":", "app", ".", "AccountHref", "(", "account", ...
// ToAccountMedia builds an account media type from an account model.
[ "ToAccountMedia", "builds", "an", "account", "media", "type", "from", "an", "account", "model", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/account.go#L12-L20
140,584
goadesign/goa-cellar
controllers/account.go
ToAccountMediaTiny
func ToAccountMediaTiny(account *store.AccountModel) *app.AccountTiny { return &app.AccountTiny{ ID: account.ID, Href: app.AccountHref(account.ID), Name: account.Name, } }
go
func ToAccountMediaTiny(account *store.AccountModel) *app.AccountTiny { return &app.AccountTiny{ ID: account.ID, Href: app.AccountHref(account.ID), Name: account.Name, } }
[ "func", "ToAccountMediaTiny", "(", "account", "*", "store", ".", "AccountModel", ")", "*", "app", ".", "AccountTiny", "{", "return", "&", "app", ".", "AccountTiny", "{", "ID", ":", "account", ".", "ID", ",", "Href", ":", "app", ".", "AccountHref", "(", ...
// ToAccountMediaTiny builds an account media type with tiny view from an account model.
[ "ToAccountMediaTiny", "builds", "an", "account", "media", "type", "with", "tiny", "view", "from", "an", "account", "model", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/account.go#L23-L29
140,585
goadesign/goa-cellar
controllers/account.go
ToAccountLink
func ToAccountLink(accountID int) *app.AccountLink { return &app.AccountLink{ ID: accountID, Href: app.AccountHref(accountID), } }
go
func ToAccountLink(accountID int) *app.AccountLink { return &app.AccountLink{ ID: accountID, Href: app.AccountHref(accountID), } }
[ "func", "ToAccountLink", "(", "accountID", "int", ")", "*", "app", ".", "AccountLink", "{", "return", "&", "app", ".", "AccountLink", "{", "ID", ":", "accountID", ",", "Href", ":", "app", ".", "AccountHref", "(", "accountID", ")", ",", "}", "\n", "}" ]
// ToAccountLink builds an account link from an account model.
[ "ToAccountLink", "builds", "an", "account", "link", "from", "an", "account", "model", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/account.go#L32-L37
140,586
goadesign/goa-cellar
controllers/account.go
NewAccount
func NewAccount(service *goa.Service, db *store.DB) *AccountController { return &AccountController{ Controller: service.NewController("Account"), db: db, } }
go
func NewAccount(service *goa.Service, db *store.DB) *AccountController { return &AccountController{ Controller: service.NewController("Account"), db: db, } }
[ "func", "NewAccount", "(", "service", "*", "goa", ".", "Service", ",", "db", "*", "store", ".", "DB", ")", "*", "AccountController", "{", "return", "&", "AccountController", "{", "Controller", ":", "service", ".", "NewController", "(", "\"", "\"", ")", "...
// NewAccount creates a account controller.
[ "NewAccount", "creates", "a", "account", "controller", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/account.go#L46-L51
140,587
goadesign/goa-cellar
controllers/account.go
List
func (b *AccountController) List(c *app.ListAccountContext) error { accounts := b.db.GetAccounts() res := make(app.AccountTinyCollection, len(accounts)) for i, account := range accounts { a := &app.AccountTiny{ ID: account.ID, Href: app.AccountHref(account.ID), Name: account.Name, } res[i] = a } r...
go
func (b *AccountController) List(c *app.ListAccountContext) error { accounts := b.db.GetAccounts() res := make(app.AccountTinyCollection, len(accounts)) for i, account := range accounts { a := &app.AccountTiny{ ID: account.ID, Href: app.AccountHref(account.ID), Name: account.Name, } res[i] = a } r...
[ "func", "(", "b", "*", "AccountController", ")", "List", "(", "c", "*", "app", ".", "ListAccountContext", ")", "error", "{", "accounts", ":=", "b", ".", "db", ".", "GetAccounts", "(", ")", "\n", "res", ":=", "make", "(", "app", ".", "AccountTinyCollect...
// List retrieves all the accounts.
[ "List", "retrieves", "all", "the", "accounts", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/account.go#L54-L66
140,588
goadesign/goa-cellar
controllers/account.go
Show
func (b *AccountController) Show(c *app.ShowAccountContext) error { account, ok := b.db.GetAccount(c.AccountID) if !ok { return c.NotFound() } return c.OK(ToAccountMedia(&account)) }
go
func (b *AccountController) Show(c *app.ShowAccountContext) error { account, ok := b.db.GetAccount(c.AccountID) if !ok { return c.NotFound() } return c.OK(ToAccountMedia(&account)) }
[ "func", "(", "b", "*", "AccountController", ")", "Show", "(", "c", "*", "app", ".", "ShowAccountContext", ")", "error", "{", "account", ",", "ok", ":=", "b", ".", "db", ".", "GetAccount", "(", "c", ".", "AccountID", ")", "\n", "if", "!", "ok", "{",...
// Show retrieves the account with the given id.
[ "Show", "retrieves", "the", "account", "with", "the", "given", "id", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/account.go#L69-L75
140,589
goadesign/goa-cellar
controllers/account.go
Create
func (b *AccountController) Create(c *app.CreateAccountContext) error { account := b.db.NewAccount() payload := c.Payload account.Name = payload.Name account.CreatedAt = time.Now() b.db.SaveAccount(account) c.ResponseData.Header().Set("Location", app.AccountHref(account.ID)) return c.Created() }
go
func (b *AccountController) Create(c *app.CreateAccountContext) error { account := b.db.NewAccount() payload := c.Payload account.Name = payload.Name account.CreatedAt = time.Now() b.db.SaveAccount(account) c.ResponseData.Header().Set("Location", app.AccountHref(account.ID)) return c.Created() }
[ "func", "(", "b", "*", "AccountController", ")", "Create", "(", "c", "*", "app", ".", "CreateAccountContext", ")", "error", "{", "account", ":=", "b", ".", "db", ".", "NewAccount", "(", ")", "\n", "payload", ":=", "c", ".", "Payload", "\n", "account", ...
// Create records a new account.
[ "Create", "records", "a", "new", "account", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/account.go#L78-L86
140,590
goadesign/goa-cellar
controllers/account.go
Delete
func (b *AccountController) Delete(c *app.DeleteAccountContext) error { account, ok := b.db.GetAccount(c.AccountID) if !ok { return c.NotFound() } b.db.DeleteAccount(account) return c.NoContent() }
go
func (b *AccountController) Delete(c *app.DeleteAccountContext) error { account, ok := b.db.GetAccount(c.AccountID) if !ok { return c.NotFound() } b.db.DeleteAccount(account) return c.NoContent() }
[ "func", "(", "b", "*", "AccountController", ")", "Delete", "(", "c", "*", "app", ".", "DeleteAccountContext", ")", "error", "{", "account", ",", "ok", ":=", "b", ".", "db", ".", "GetAccount", "(", "c", ".", "AccountID", ")", "\n", "if", "!", "ok", ...
// Delete removes a account from the database.
[ "Delete", "removes", "a", "account", "from", "the", "database", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/account.go#L103-L110
140,591
goadesign/goa-cellar
controllers/bottle.go
ToBottleMedia
func ToBottleMedia(a *store.AccountModel, b *store.BottleModel) *app.Bottle { account := ToAccountMediaTiny(a) link := ToAccountLink(a.ID) return &app.Bottle{ Account: account, Href: app.BottleHref(b.AccountID, b.ID), ID: b.ID, Links: &app.BottleLinks{Account: link}, Name: b.Name, Ratin...
go
func ToBottleMedia(a *store.AccountModel, b *store.BottleModel) *app.Bottle { account := ToAccountMediaTiny(a) link := ToAccountLink(a.ID) return &app.Bottle{ Account: account, Href: app.BottleHref(b.AccountID, b.ID), ID: b.ID, Links: &app.BottleLinks{Account: link}, Name: b.Name, Ratin...
[ "func", "ToBottleMedia", "(", "a", "*", "store", ".", "AccountModel", ",", "b", "*", "store", ".", "BottleModel", ")", "*", "app", ".", "Bottle", "{", "account", ":=", "ToAccountMediaTiny", "(", "a", ")", "\n", "link", ":=", "ToAccountLink", "(", "a", ...
// ToBottleMedia converts a bottle model into a bottle media type
[ "ToBottleMedia", "converts", "a", "bottle", "model", "into", "a", "bottle", "media", "type" ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/bottle.go#L15-L29
140,592
goadesign/goa-cellar
controllers/bottle.go
ToBottleMediaTiny
func ToBottleMediaTiny(bottle *store.BottleModel) *app.BottleTiny { link := ToAccountLink(bottle.AccountID) return &app.BottleTiny{ ID: bottle.ID, Href: app.BottleHref(bottle.AccountID, bottle.ID), Links: &app.BottleLinks{Account: link}, Name: bottle.Name, Rating: bottle.Rating, } }
go
func ToBottleMediaTiny(bottle *store.BottleModel) *app.BottleTiny { link := ToAccountLink(bottle.AccountID) return &app.BottleTiny{ ID: bottle.ID, Href: app.BottleHref(bottle.AccountID, bottle.ID), Links: &app.BottleLinks{Account: link}, Name: bottle.Name, Rating: bottle.Rating, } }
[ "func", "ToBottleMediaTiny", "(", "bottle", "*", "store", ".", "BottleModel", ")", "*", "app", ".", "BottleTiny", "{", "link", ":=", "ToAccountLink", "(", "bottle", ".", "AccountID", ")", "\n\n", "return", "&", "app", ".", "BottleTiny", "{", "ID", ":", "...
// ToBottleMediaTiny builds an bottle media type with tiny view from an bottle model.
[ "ToBottleMediaTiny", "builds", "an", "bottle", "media", "type", "with", "tiny", "view", "from", "an", "bottle", "model", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/bottle.go#L32-L42
140,593
goadesign/goa-cellar
controllers/bottle.go
NewBottle
func NewBottle(service *goa.Service, db *store.DB) *BottleController { return &BottleController{ Controller: service.NewController("Bottle"), db: db, } }
go
func NewBottle(service *goa.Service, db *store.DB) *BottleController { return &BottleController{ Controller: service.NewController("Bottle"), db: db, } }
[ "func", "NewBottle", "(", "service", "*", "goa", ".", "Service", ",", "db", "*", "store", ".", "DB", ")", "*", "BottleController", "{", "return", "&", "BottleController", "{", "Controller", ":", "service", ".", "NewController", "(", "\"", "\"", ")", ",",...
// NewBottle creates a bottle controller.
[ "NewBottle", "creates", "a", "bottle", "controller", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/bottle.go#L51-L56
140,594
goadesign/goa-cellar
controllers/bottle.go
List
func (b *BottleController) List(ctx *app.ListBottleContext) error { var bottles []store.BottleModel var err error if ctx.Years != nil { bottles, err = b.db.GetBottlesByYears(ctx.AccountID, ctx.Years) } else { bottles, err = b.db.GetBottles(ctx.AccountID) } if err != nil { return ctx.NotFound() } bs := mak...
go
func (b *BottleController) List(ctx *app.ListBottleContext) error { var bottles []store.BottleModel var err error if ctx.Years != nil { bottles, err = b.db.GetBottlesByYears(ctx.AccountID, ctx.Years) } else { bottles, err = b.db.GetBottles(ctx.AccountID) } if err != nil { return ctx.NotFound() } bs := mak...
[ "func", "(", "b", "*", "BottleController", ")", "List", "(", "ctx", "*", "app", ".", "ListBottleContext", ")", "error", "{", "var", "bottles", "[", "]", "store", ".", "BottleModel", "\n", "var", "err", "error", "\n", "if", "ctx", ".", "Years", "!=", ...
// List lists all the bottles in the account optionally filtering by year.
[ "List", "lists", "all", "the", "bottles", "in", "the", "account", "optionally", "filtering", "by", "year", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/bottle.go#L59-L79
140,595
goadesign/goa-cellar
controllers/bottle.go
Show
func (b *BottleController) Show(ctx *app.ShowBottleContext) error { account, ok := b.db.GetAccount(ctx.AccountID) if !ok { return ctx.NotFound() } bottle, ok := b.db.GetBottle(account.ID, ctx.BottleID) if !ok { return ctx.NotFound() } return ctx.OK(ToBottleMedia(&account, &bottle)) }
go
func (b *BottleController) Show(ctx *app.ShowBottleContext) error { account, ok := b.db.GetAccount(ctx.AccountID) if !ok { return ctx.NotFound() } bottle, ok := b.db.GetBottle(account.ID, ctx.BottleID) if !ok { return ctx.NotFound() } return ctx.OK(ToBottleMedia(&account, &bottle)) }
[ "func", "(", "b", "*", "BottleController", ")", "Show", "(", "ctx", "*", "app", ".", "ShowBottleContext", ")", "error", "{", "account", ",", "ok", ":=", "b", ".", "db", ".", "GetAccount", "(", "ctx", ".", "AccountID", ")", "\n", "if", "!", "ok", "{...
// Show retrieves the bottle with the given id.
[ "Show", "retrieves", "the", "bottle", "with", "the", "given", "id", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/bottle.go#L82-L92
140,596
goadesign/goa-cellar
controllers/bottle.go
Watch
func (b *BottleController) Watch(ctx *app.WatchBottleContext) error { Watcher(ctx.AccountID, ctx.BottleID).ServeHTTP(ctx.ResponseWriter, ctx.Request) return nil }
go
func (b *BottleController) Watch(ctx *app.WatchBottleContext) error { Watcher(ctx.AccountID, ctx.BottleID).ServeHTTP(ctx.ResponseWriter, ctx.Request) return nil }
[ "func", "(", "b", "*", "BottleController", ")", "Watch", "(", "ctx", "*", "app", ".", "WatchBottleContext", ")", "error", "{", "Watcher", "(", "ctx", ".", "AccountID", ",", "ctx", ".", "BottleID", ")", ".", "ServeHTTP", "(", "ctx", ".", "ResponseWriter",...
// Watch watches the bottle with the given id.
[ "Watch", "watches", "the", "bottle", "with", "the", "given", "id", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/bottle.go#L95-L98
140,597
goadesign/goa-cellar
controllers/bottle.go
Watcher
func Watcher(accountID, bottleID int) websocket.Handler { return func(ws *websocket.Conn) { watched := fmt.Sprintf("Account: %d, Bottle: %d", accountID, bottleID) ws.Write([]byte(watched)) io.Copy(ws, ws) } }
go
func Watcher(accountID, bottleID int) websocket.Handler { return func(ws *websocket.Conn) { watched := fmt.Sprintf("Account: %d, Bottle: %d", accountID, bottleID) ws.Write([]byte(watched)) io.Copy(ws, ws) } }
[ "func", "Watcher", "(", "accountID", ",", "bottleID", "int", ")", "websocket", ".", "Handler", "{", "return", "func", "(", "ws", "*", "websocket", ".", "Conn", ")", "{", "watched", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "accountID", ",", ...
// Watcher echos the data received on the WebSocket.
[ "Watcher", "echos", "the", "data", "received", "on", "the", "WebSocket", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/bottle.go#L101-L107
140,598
goadesign/goa-cellar
controllers/bottle.go
Create
func (b *BottleController) Create(ctx *app.CreateBottleContext) error { bottle, err := b.db.NewBottle(ctx.AccountID) if err != nil { return ctx.NotFound() } payload := ctx.Payload bottle.Name = payload.Name bottle.Vintage = payload.Vintage bottle.Vineyard = payload.Vineyard bottle.CreatedAt = time.Now() bott...
go
func (b *BottleController) Create(ctx *app.CreateBottleContext) error { bottle, err := b.db.NewBottle(ctx.AccountID) if err != nil { return ctx.NotFound() } payload := ctx.Payload bottle.Name = payload.Name bottle.Vintage = payload.Vintage bottle.Vineyard = payload.Vineyard bottle.CreatedAt = time.Now() bott...
[ "func", "(", "b", "*", "BottleController", ")", "Create", "(", "ctx", "*", "app", ".", "CreateBottleContext", ")", "error", "{", "bottle", ",", "err", ":=", "b", ".", "db", ".", "NewBottle", "(", "ctx", ".", "AccountID", ")", "\n", "if", "err", "!=",...
// Create records a new bottle.
[ "Create", "records", "a", "new", "bottle", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/bottle.go#L110-L142
140,599
goadesign/goa-cellar
controllers/bottle.go
Delete
func (b *BottleController) Delete(ctx *app.DeleteBottleContext) error { bottle, ok := b.db.GetBottle(ctx.AccountID, ctx.BottleID) if !ok { return ctx.NotFound() } b.db.DeleteBottle(bottle) return ctx.NoContent() }
go
func (b *BottleController) Delete(ctx *app.DeleteBottleContext) error { bottle, ok := b.db.GetBottle(ctx.AccountID, ctx.BottleID) if !ok { return ctx.NotFound() } b.db.DeleteBottle(bottle) return ctx.NoContent() }
[ "func", "(", "b", "*", "BottleController", ")", "Delete", "(", "ctx", "*", "app", ".", "DeleteBottleContext", ")", "error", "{", "bottle", ",", "ok", ":=", "b", ".", "db", ".", "GetBottle", "(", "ctx", ".", "AccountID", ",", "ctx", ".", "BottleID", "...
// Delete removes a bottle from the database.
[ "Delete", "removes", "a", "bottle", "from", "the", "database", "." ]
88979d5a1ca553aae0e62797eef31108d9302bfa
https://github.com/goadesign/goa-cellar/blob/88979d5a1ca553aae0e62797eef31108d9302bfa/controllers/bottle.go#L185-L192