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
133,800
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
Load
func (r *Registry) Load(req *plugin.CodeGeneratorRequest) error { for _, file := range req.GetProtoFile() { r.loadFile(file) } var targetPkg string for _, name := range req.FileToGenerate { target := r.files[name] if target == nil { return fmt.Errorf("no such file: %s", name) } name := r.packageIdenti...
go
func (r *Registry) Load(req *plugin.CodeGeneratorRequest) error { for _, file := range req.GetProtoFile() { r.loadFile(file) } var targetPkg string for _, name := range req.FileToGenerate { target := r.files[name] if target == nil { return fmt.Errorf("no such file: %s", name) } name := r.packageIdenti...
[ "func", "(", "r", "*", "Registry", ")", "Load", "(", "req", "*", "plugin", ".", "CodeGeneratorRequest", ")", "error", "{", "for", "_", ",", "file", ":=", "range", "req", ".", "GetProtoFile", "(", ")", "{", "r", ".", "loadFile", "(", "file", ")", "\...
// Load loads definitions of services, methods, messages, enumerations and fields from "req".
[ "Load", "loads", "definitions", "of", "services", "methods", "messages", "enumerations", "and", "fields", "from", "req", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L94-L119
133,801
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
LookupMsg
func (r *Registry) LookupMsg(location, name string) (*Message, error) { glog.V(1).Infof("lookup %s from %s", name, location) if strings.HasPrefix(name, ".") { m, ok := r.msgs[name] if !ok { return nil, fmt.Errorf("no message found: %s", name) } return m, nil } if !strings.HasPrefix(location, ".") { lo...
go
func (r *Registry) LookupMsg(location, name string) (*Message, error) { glog.V(1).Infof("lookup %s from %s", name, location) if strings.HasPrefix(name, ".") { m, ok := r.msgs[name] if !ok { return nil, fmt.Errorf("no message found: %s", name) } return m, nil } if !strings.HasPrefix(location, ".") { lo...
[ "func", "(", "r", "*", "Registry", ")", "LookupMsg", "(", "location", ",", "name", "string", ")", "(", "*", "Message", ",", "error", ")", "{", "glog", ".", "V", "(", "1", ")", ".", "Infof", "(", "\"", "\"", ",", "name", ",", "location", ")", "\...
// LookupMsg looks up a message type by "name". // It tries to resolve "name" from "location" if "name" is a relative message name.
[ "LookupMsg", "looks", "up", "a", "message", "type", "by", "name", ".", "It", "tries", "to", "resolve", "name", "from", "location", "if", "name", "is", "a", "relative", "message", "name", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L190-L212
133,802
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
LookupEnum
func (r *Registry) LookupEnum(location, name string) (*Enum, error) { glog.V(1).Infof("lookup enum %s from %s", name, location) if strings.HasPrefix(name, ".") { e, ok := r.enums[name] if !ok { return nil, fmt.Errorf("no enum found: %s", name) } return e, nil } if !strings.HasPrefix(location, ".") { l...
go
func (r *Registry) LookupEnum(location, name string) (*Enum, error) { glog.V(1).Infof("lookup enum %s from %s", name, location) if strings.HasPrefix(name, ".") { e, ok := r.enums[name] if !ok { return nil, fmt.Errorf("no enum found: %s", name) } return e, nil } if !strings.HasPrefix(location, ".") { l...
[ "func", "(", "r", "*", "Registry", ")", "LookupEnum", "(", "location", ",", "name", "string", ")", "(", "*", "Enum", ",", "error", ")", "{", "glog", ".", "V", "(", "1", ")", ".", "Infof", "(", "\"", "\"", ",", "name", ",", "location", ")", "\n"...
// LookupEnum looks up a enum type by "name". // It tries to resolve "name" from "location" if "name" is a relative enum name.
[ "LookupEnum", "looks", "up", "a", "enum", "type", "by", "name", ".", "It", "tries", "to", "resolve", "name", "from", "location", "if", "name", "is", "a", "relative", "enum", "name", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L216-L238
133,803
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
LookupFile
func (r *Registry) LookupFile(name string) (*File, error) { f, ok := r.files[name] if !ok { return nil, fmt.Errorf("no such file given: %s", name) } return f, nil }
go
func (r *Registry) LookupFile(name string) (*File, error) { f, ok := r.files[name] if !ok { return nil, fmt.Errorf("no such file given: %s", name) } return f, nil }
[ "func", "(", "r", "*", "Registry", ")", "LookupFile", "(", "name", "string", ")", "(", "*", "File", ",", "error", ")", "{", "f", ",", "ok", ":=", "r", ".", "files", "[", "name", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", "....
// LookupFile looks up a file by name.
[ "LookupFile", "looks", "up", "a", "file", "by", "name", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L241-L247
133,804
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
LookupExternalHTTPRules
func (r *Registry) LookupExternalHTTPRules(qualifiedMethodName string) []*annotations.HttpRule { return r.externalHTTPRules[qualifiedMethodName] }
go
func (r *Registry) LookupExternalHTTPRules(qualifiedMethodName string) []*annotations.HttpRule { return r.externalHTTPRules[qualifiedMethodName] }
[ "func", "(", "r", "*", "Registry", ")", "LookupExternalHTTPRules", "(", "qualifiedMethodName", "string", ")", "[", "]", "*", "annotations", ".", "HttpRule", "{", "return", "r", ".", "externalHTTPRules", "[", "qualifiedMethodName", "]", "\n", "}" ]
// LookupExternalHTTPRules looks up external http rules by fully qualified service method name
[ "LookupExternalHTTPRules", "looks", "up", "external", "http", "rules", "by", "fully", "qualified", "service", "method", "name" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L250-L252
133,805
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
AddExternalHTTPRule
func (r *Registry) AddExternalHTTPRule(qualifiedMethodName string, rule *annotations.HttpRule) { r.externalHTTPRules[qualifiedMethodName] = append(r.externalHTTPRules[qualifiedMethodName], rule) }
go
func (r *Registry) AddExternalHTTPRule(qualifiedMethodName string, rule *annotations.HttpRule) { r.externalHTTPRules[qualifiedMethodName] = append(r.externalHTTPRules[qualifiedMethodName], rule) }
[ "func", "(", "r", "*", "Registry", ")", "AddExternalHTTPRule", "(", "qualifiedMethodName", "string", ",", "rule", "*", "annotations", ".", "HttpRule", ")", "{", "r", ".", "externalHTTPRules", "[", "qualifiedMethodName", "]", "=", "append", "(", "r", ".", "ex...
// AddExternalHTTPRule adds an external http rule for the given fully qualified service method name
[ "AddExternalHTTPRule", "adds", "an", "external", "http", "rule", "for", "the", "given", "fully", "qualified", "service", "method", "name" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L255-L257
133,806
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
AddPkgMap
func (r *Registry) AddPkgMap(file, protoPkg string) { r.pkgMap[file] = protoPkg }
go
func (r *Registry) AddPkgMap(file, protoPkg string) { r.pkgMap[file] = protoPkg }
[ "func", "(", "r", "*", "Registry", ")", "AddPkgMap", "(", "file", ",", "protoPkg", "string", ")", "{", "r", ".", "pkgMap", "[", "file", "]", "=", "protoPkg", "\n", "}" ]
// AddPkgMap adds a mapping from a .proto file to proto package name.
[ "AddPkgMap", "adds", "a", "mapping", "from", "a", ".", "proto", "file", "to", "proto", "package", "name", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L260-L262
133,807
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
ReserveGoPackageAlias
func (r *Registry) ReserveGoPackageAlias(alias, pkgpath string) error { if taken, ok := r.pkgAliases[alias]; ok { if taken == pkgpath { return nil } return fmt.Errorf("package name %s is already taken. Use another alias", alias) } r.pkgAliases[alias] = pkgpath return nil }
go
func (r *Registry) ReserveGoPackageAlias(alias, pkgpath string) error { if taken, ok := r.pkgAliases[alias]; ok { if taken == pkgpath { return nil } return fmt.Errorf("package name %s is already taken. Use another alias", alias) } r.pkgAliases[alias] = pkgpath return nil }
[ "func", "(", "r", "*", "Registry", ")", "ReserveGoPackageAlias", "(", "alias", ",", "pkgpath", "string", ")", "error", "{", "if", "taken", ",", "ok", ":=", "r", ".", "pkgAliases", "[", "alias", "]", ";", "ok", "{", "if", "taken", "==", "pkgpath", "{"...
// ReserveGoPackageAlias reserves the unique alias of go package. // If succeeded, the alias will be never used for other packages in generated go files. // If failed, the alias is already taken by another package, so you need to use another // alias for the package in your go files.
[ "ReserveGoPackageAlias", "reserves", "the", "unique", "alias", "of", "go", "package", ".", "If", "succeeded", "the", "alias", "will", "be", "never", "used", "for", "other", "packages", "in", "generated", "go", "files", ".", "If", "failed", "the", "alias", "i...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L280-L289
133,808
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
goPackagePath
func (r *Registry) goPackagePath(f *descriptor.FileDescriptorProto) string { name := f.GetName() if pkg, ok := r.pkgMap[name]; ok { return path.Join(r.prefix, pkg) } gopkg := f.Options.GetGoPackage() idx := strings.LastIndex(gopkg, "/") if idx >= 0 { if sc := strings.LastIndex(gopkg, ";"); sc > 0 { gopkg ...
go
func (r *Registry) goPackagePath(f *descriptor.FileDescriptorProto) string { name := f.GetName() if pkg, ok := r.pkgMap[name]; ok { return path.Join(r.prefix, pkg) } gopkg := f.Options.GetGoPackage() idx := strings.LastIndex(gopkg, "/") if idx >= 0 { if sc := strings.LastIndex(gopkg, ";"); sc > 0 { gopkg ...
[ "func", "(", "r", "*", "Registry", ")", "goPackagePath", "(", "f", "*", "descriptor", ".", "FileDescriptorProto", ")", "string", "{", "name", ":=", "f", ".", "GetName", "(", ")", "\n", "if", "pkg", ",", "ok", ":=", "r", ".", "pkgMap", "[", "name", ...
// goPackagePath returns the go package path which go files generated from "f" should have. // It respects the mapping registered by AddPkgMap if exists. Or use go_package as import path // if it includes a slash, Otherwide, it generates a path from the file name of "f".
[ "goPackagePath", "returns", "the", "go", "package", "path", "which", "go", "files", "generated", "from", "f", "should", "have", ".", "It", "respects", "the", "mapping", "registered", "by", "AddPkgMap", "if", "exists", ".", "Or", "use", "go_package", "as", "i...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L294-L310
133,809
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
GetAllFQMNs
func (r *Registry) GetAllFQMNs() []string { var keys []string for k := range r.msgs { keys = append(keys, k) } return keys }
go
func (r *Registry) GetAllFQMNs() []string { var keys []string for k := range r.msgs { keys = append(keys, k) } return keys }
[ "func", "(", "r", "*", "Registry", ")", "GetAllFQMNs", "(", ")", "[", "]", "string", "{", "var", "keys", "[", "]", "string", "\n", "for", "k", ":=", "range", "r", ".", "msgs", "{", "keys", "=", "append", "(", "keys", ",", "k", ")", "\n", "}", ...
// GetAllFQMNs returns a list of all FQMNs
[ "GetAllFQMNs", "returns", "a", "list", "of", "all", "FQMNs" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L313-L319
133,810
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
GetAllFQENs
func (r *Registry) GetAllFQENs() []string { var keys []string for k := range r.enums { keys = append(keys, k) } return keys }
go
func (r *Registry) GetAllFQENs() []string { var keys []string for k := range r.enums { keys = append(keys, k) } return keys }
[ "func", "(", "r", "*", "Registry", ")", "GetAllFQENs", "(", ")", "[", "]", "string", "{", "var", "keys", "[", "]", "string", "\n", "for", "k", ":=", "range", "r", ".", "enums", "{", "keys", "=", "append", "(", "keys", ",", "k", ")", "\n", "}", ...
// GetAllFQENs returns a list of all FQENs
[ "GetAllFQENs", "returns", "a", "list", "of", "all", "FQENs" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L322-L328
133,811
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
SetRepeatedPathParamSeparator
func (r *Registry) SetRepeatedPathParamSeparator(name string) error { var sep rune switch name { case "csv": sep = ',' case "pipes": sep = '|' case "ssv": sep = ' ' case "tsv": sep = '\t' default: return fmt.Errorf("unknown repeated path parameter separator: %s", name) } r.repeatedPathParamSeparator ...
go
func (r *Registry) SetRepeatedPathParamSeparator(name string) error { var sep rune switch name { case "csv": sep = ',' case "pipes": sep = '|' case "ssv": sep = ' ' case "tsv": sep = '\t' default: return fmt.Errorf("unknown repeated path parameter separator: %s", name) } r.repeatedPathParamSeparator ...
[ "func", "(", "r", "*", "Registry", ")", "SetRepeatedPathParamSeparator", "(", "name", "string", ")", "error", "{", "var", "sep", "rune", "\n", "switch", "name", "{", "case", "\"", "\"", ":", "sep", "=", "','", "\n", "case", "\"", "\"", ":", "sep", "=...
// SetRepeatedPathParamSeparator sets how path parameter repeated fields are // separated. Allowed names are 'csv', 'pipe', 'ssv' and 'tsv'.
[ "SetRepeatedPathParamSeparator", "sets", "how", "path", "parameter", "repeated", "fields", "are", "separated", ".", "Allowed", "names", "are", "csv", "pipe", "ssv", "and", "tsv", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L389-L408
133,812
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/registry.go
sanitizePackageName
func sanitizePackageName(pkgName string) string { pkgName = strings.Replace(pkgName, ".", "_", -1) pkgName = strings.Replace(pkgName, "-", "_", -1) return pkgName }
go
func sanitizePackageName(pkgName string) string { pkgName = strings.Replace(pkgName, ".", "_", -1) pkgName = strings.Replace(pkgName, "-", "_", -1) return pkgName }
[ "func", "sanitizePackageName", "(", "pkgName", "string", ")", "string", "{", "pkgName", "=", "strings", ".", "Replace", "(", "pkgName", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "pkgName", "=", "strings", ".", "Replace", "(", "pkgName...
// sanitizePackageName replaces unallowed character in package name // with allowed character.
[ "sanitizePackageName", "replaces", "unallowed", "character", "in", "package", "name", "with", "allowed", "character", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/registry.go#L437-L441
133,813
grpc-ecosystem/grpc-gateway
examples/gateway/gateway.go
dialTCP
func dialTCP(ctx context.Context, addr string) (*grpc.ClientConn, error) { return grpc.DialContext(ctx, addr, grpc.WithInsecure()) }
go
func dialTCP(ctx context.Context, addr string) (*grpc.ClientConn, error) { return grpc.DialContext(ctx, addr, grpc.WithInsecure()) }
[ "func", "dialTCP", "(", "ctx", "context", ".", "Context", ",", "addr", "string", ")", "(", "*", "grpc", ".", "ClientConn", ",", "error", ")", "{", "return", "grpc", ".", "DialContext", "(", "ctx", ",", "addr", ",", "grpc", ".", "WithInsecure", "(", "...
// dialTCP creates a client connection via TCP. // "addr" must be a valid TCP address with a port number.
[ "dialTCP", "creates", "a", "client", "connection", "via", "TCP", ".", "addr", "must", "be", "a", "valid", "TCP", "address", "with", "a", "port", "number", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/gateway/gateway.go#L47-L49
133,814
grpc-ecosystem/grpc-gateway
examples/gateway/gateway.go
dialUnix
func dialUnix(ctx context.Context, addr string) (*grpc.ClientConn, error) { d := func(addr string, timeout time.Duration) (net.Conn, error) { return net.DialTimeout("unix", addr, timeout) } return grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(d)) }
go
func dialUnix(ctx context.Context, addr string) (*grpc.ClientConn, error) { d := func(addr string, timeout time.Duration) (net.Conn, error) { return net.DialTimeout("unix", addr, timeout) } return grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(d)) }
[ "func", "dialUnix", "(", "ctx", "context", ".", "Context", ",", "addr", "string", ")", "(", "*", "grpc", ".", "ClientConn", ",", "error", ")", "{", "d", ":=", "func", "(", "addr", "string", ",", "timeout", "time", ".", "Duration", ")", "(", "net", ...
// dialUnix creates a client connection via a unix domain socket. // "addr" must be a valid path to the socket.
[ "dialUnix", "creates", "a", "client", "connection", "via", "a", "unix", "domain", "socket", ".", "addr", "must", "be", "a", "valid", "path", "to", "the", "socket", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/gateway/gateway.go#L53-L58
133,815
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/main.go
parseReqParam
func parseReqParam(param string, f *flag.FlagSet, pkgMap map[string]string) error { if param == "" { return nil } for _, p := range strings.Split(param, ",") { spec := strings.SplitN(p, "=", 2) if len(spec) == 1 { if spec[0] == "allow_delete_body" { err := f.Set(spec[0], "true") if err != nil { ...
go
func parseReqParam(param string, f *flag.FlagSet, pkgMap map[string]string) error { if param == "" { return nil } for _, p := range strings.Split(param, ",") { spec := strings.SplitN(p, "=", 2) if len(spec) == 1 { if spec[0] == "allow_delete_body" { err := f.Set(spec[0], "true") if err != nil { ...
[ "func", "parseReqParam", "(", "param", "string", ",", "f", "*", "flag", ".", "FlagSet", ",", "pkgMap", "map", "[", "string", "]", "string", ")", "error", "{", "if", "param", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "for", "_", ",", ...
// parseReqParam parses a CodeGeneratorRequest parameter and adds the // extracted values to the given FlagSet and pkgMap. Returns a non-nil // error if setting a flag failed.
[ "parseReqParam", "parses", "a", "CodeGeneratorRequest", "parameter", "and", "adds", "the", "extracted", "values", "to", "the", "given", "FlagSet", "and", "pkgMap", ".", "Returns", "a", "non", "-", "nil", "error", "if", "setting", "a", "flag", "failed", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/main.go#L147-L198
133,816
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/gengateway/generator.go
New
func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix, pathTypeString string, allowPatchFeature bool) gen.Generator { var imports []descriptor.GoPackage for _, pkgpath := range []string{ "context", "io", "net/http", "github.com/grpc-ecosystem/grpc-gateway/runtime", "github.com/grpc-e...
go
func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix, pathTypeString string, allowPatchFeature bool) gen.Generator { var imports []descriptor.GoPackage for _, pkgpath := range []string{ "context", "io", "net/http", "github.com/grpc-ecosystem/grpc-gateway/runtime", "github.com/grpc-e...
[ "func", "New", "(", "reg", "*", "descriptor", ".", "Registry", ",", "useRequestContext", "bool", ",", "registerFuncSuffix", ",", "pathTypeString", "string", ",", "allowPatchFeature", "bool", ")", "gen", ".", "Generator", "{", "var", "imports", "[", "]", "descr...
// New returns a new generator which generates grpc gateway files.
[ "New", "returns", "a", "new", "generator", "which", "generates", "grpc", "gateway", "files", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/gengateway/generator.go#L39-L88
133,817
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/gengateway/generator.go
addEnumPathParamImports
func (g *generator) addEnumPathParamImports(file *descriptor.File, m *descriptor.Method, pkgSeen map[string]bool) []descriptor.GoPackage { var imports []descriptor.GoPackage for _, b := range m.Bindings { for _, p := range b.PathParams { e, err := g.reg.LookupEnum("", p.Target.GetTypeName()) if err != nil { ...
go
func (g *generator) addEnumPathParamImports(file *descriptor.File, m *descriptor.Method, pkgSeen map[string]bool) []descriptor.GoPackage { var imports []descriptor.GoPackage for _, b := range m.Bindings { for _, p := range b.PathParams { e, err := g.reg.LookupEnum("", p.Target.GetTypeName()) if err != nil { ...
[ "func", "(", "g", "*", "generator", ")", "addEnumPathParamImports", "(", "file", "*", "descriptor", ".", "File", ",", "m", "*", "descriptor", ".", "Method", ",", "pkgSeen", "map", "[", "string", "]", "bool", ")", "[", "]", "descriptor", ".", "GoPackage",...
// addEnumPathParamImports handles adding import of enum path parameter go packages
[ "addEnumPathParamImports", "handles", "adding", "import", "of", "enum", "path", "parameter", "go", "packages" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/gengateway/generator.go#L153-L170
133,818
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
FQMN
func (m *Message) FQMN() string { components := []string{""} if m.File.Package != nil { components = append(components, m.File.GetPackage()) } components = append(components, m.Outers...) components = append(components, m.GetName()) return strings.Join(components, ".") }
go
func (m *Message) FQMN() string { components := []string{""} if m.File.Package != nil { components = append(components, m.File.GetPackage()) } components = append(components, m.Outers...) components = append(components, m.GetName()) return strings.Join(components, ".") }
[ "func", "(", "m", "*", "Message", ")", "FQMN", "(", ")", "string", "{", "components", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "if", "m", ".", "File", ".", "Package", "!=", "nil", "{", "components", "=", "append", "(", "components", ...
// FQMN returns a fully qualified message name of this message.
[ "FQMN", "returns", "a", "fully", "qualified", "message", "name", "of", "this", "message", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L73-L81
133,819
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
FQEN
func (e *Enum) FQEN() string { components := []string{""} if e.File.Package != nil { components = append(components, e.File.GetPackage()) } components = append(components, e.Outers...) components = append(components, e.GetName()) return strings.Join(components, ".") }
go
func (e *Enum) FQEN() string { components := []string{""} if e.File.Package != nil { components = append(components, e.File.GetPackage()) } components = append(components, e.Outers...) components = append(components, e.GetName()) return strings.Join(components, ".") }
[ "func", "(", "e", "*", "Enum", ")", "FQEN", "(", ")", "string", "{", "components", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "if", "e", ".", "File", ".", "Package", "!=", "nil", "{", "components", "=", "append", "(", "components", ","...
// FQEN returns a fully qualified enum name of this enum.
[ "FQEN", "returns", "a", "fully", "qualified", "enum", "name", "of", "this", "enum", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L114-L122
133,820
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
FQSN
func (s *Service) FQSN() string { components := []string{""} if s.File.Package != nil { components = append(components, s.File.GetPackage()) } components = append(components, s.GetName()) return strings.Join(components, ".") }
go
func (s *Service) FQSN() string { components := []string{""} if s.File.Package != nil { components = append(components, s.File.GetPackage()) } components = append(components, s.GetName()) return strings.Join(components, ".") }
[ "func", "(", "s", "*", "Service", ")", "FQSN", "(", ")", "string", "{", "components", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "if", "s", ".", "File", ".", "Package", "!=", "nil", "{", "components", "=", "append", "(", "components", ...
// FQSN returns the fully qualified service name of this service.
[ "FQSN", "returns", "the", "fully", "qualified", "service", "name", "of", "this", "service", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L153-L160
133,821
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
FQMN
func (m *Method) FQMN() string { components := []string{} components = append(components, m.Service.FQSN()) components = append(components, m.GetName()) return strings.Join(components, ".") }
go
func (m *Method) FQMN() string { components := []string{} components = append(components, m.Service.FQSN()) components = append(components, m.GetName()) return strings.Join(components, ".") }
[ "func", "(", "m", "*", "Method", ")", "FQMN", "(", ")", "string", "{", "components", ":=", "[", "]", "string", "{", "}", "\n", "components", "=", "append", "(", "components", ",", "m", ".", "Service", ".", "FQSN", "(", ")", ")", "\n", "components",...
// FQMN returns a fully qualified rpc method name of this method.
[ "FQMN", "returns", "a", "fully", "qualified", "rpc", "method", "name", "of", "this", "method", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L176-L181
133,822
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
ExplicitParams
func (b *Binding) ExplicitParams() []string { var result []string if b.Body != nil { result = append(result, b.Body.FieldPath.String()) } for _, p := range b.PathParams { result = append(result, p.FieldPath.String()) } return result }
go
func (b *Binding) ExplicitParams() []string { var result []string if b.Body != nil { result = append(result, b.Body.FieldPath.String()) } for _, p := range b.PathParams { result = append(result, p.FieldPath.String()) } return result }
[ "func", "(", "b", "*", "Binding", ")", "ExplicitParams", "(", ")", "[", "]", "string", "{", "var", "result", "[", "]", "string", "\n", "if", "b", ".", "Body", "!=", "nil", "{", "result", "=", "append", "(", "result", ",", "b", ".", "Body", ".", ...
// ExplicitParams returns a list of explicitly bound parameters of "b", // i.e. a union of field path for body and field paths for path parameters.
[ "ExplicitParams", "returns", "a", "list", "of", "explicitly", "bound", "parameters", "of", "b", "i", ".", "e", ".", "a", "union", "of", "field", "path", "for", "body", "and", "field", "paths", "for", "path", "parameters", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L203-L212
133,823
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
ConvertFuncExpr
func (p Parameter) ConvertFuncExpr() (string, error) { tbl := proto3ConvertFuncs if !p.IsProto2() && p.IsRepeated() { tbl = proto3RepeatedConvertFuncs } else if p.IsProto2() && !p.IsRepeated() { tbl = proto2ConvertFuncs } else if p.IsProto2() && p.IsRepeated() { tbl = proto2RepeatedConvertFuncs } typ := p.T...
go
func (p Parameter) ConvertFuncExpr() (string, error) { tbl := proto3ConvertFuncs if !p.IsProto2() && p.IsRepeated() { tbl = proto3RepeatedConvertFuncs } else if p.IsProto2() && !p.IsRepeated() { tbl = proto2ConvertFuncs } else if p.IsProto2() && p.IsRepeated() { tbl = proto2RepeatedConvertFuncs } typ := p.T...
[ "func", "(", "p", "Parameter", ")", "ConvertFuncExpr", "(", ")", "(", "string", ",", "error", ")", "{", "tbl", ":=", "proto3ConvertFuncs", "\n", "if", "!", "p", ".", "IsProto2", "(", ")", "&&", "p", ".", "IsRepeated", "(", ")", "{", "tbl", "=", "pr...
// ConvertFuncExpr returns a go expression of a converter function. // The converter function converts a string into a value for the parameter.
[ "ConvertFuncExpr", "returns", "a", "go", "expression", "of", "a", "converter", "function", ".", "The", "converter", "function", "converts", "a", "string", "into", "a", "value", "for", "the", "parameter", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L235-L253
133,824
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
AssignableExpr
func (b Body) AssignableExpr(msgExpr string) string { return b.FieldPath.AssignableExpr(msgExpr) }
go
func (b Body) AssignableExpr(msgExpr string) string { return b.FieldPath.AssignableExpr(msgExpr) }
[ "func", "(", "b", "Body", ")", "AssignableExpr", "(", "msgExpr", "string", ")", "string", "{", "return", "b", ".", "FieldPath", ".", "AssignableExpr", "(", "msgExpr", ")", "\n", "}" ]
// AssignableExpr returns an assignable expression in Go to be used to initialize method request object. // It starts with "msgExpr", which is the go expression of the method request object.
[ "AssignableExpr", "returns", "an", "assignable", "expression", "in", "Go", "to", "be", "used", "to", "initialize", "method", "request", "object", ".", "It", "starts", "with", "msgExpr", "which", "is", "the", "go", "expression", "of", "the", "method", "request"...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L280-L282
133,825
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
String
func (p FieldPath) String() string { var components []string for _, c := range p { components = append(components, c.Name) } return strings.Join(components, ".") }
go
func (p FieldPath) String() string { var components []string for _, c := range p { components = append(components, c.Name) } return strings.Join(components, ".") }
[ "func", "(", "p", "FieldPath", ")", "String", "(", ")", "string", "{", "var", "components", "[", "]", "string", "\n", "for", "_", ",", "c", ":=", "range", "p", "{", "components", "=", "append", "(", "components", ",", "c", ".", "Name", ")", "\n", ...
// String returns a string representation of the field path.
[ "String", "returns", "a", "string", "representation", "of", "the", "field", "path", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L288-L294
133,826
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
IsNestedProto3
func (p FieldPath) IsNestedProto3() bool { if len(p) > 1 && !p[0].Target.Message.File.proto2() { return true } return false }
go
func (p FieldPath) IsNestedProto3() bool { if len(p) > 1 && !p[0].Target.Message.File.proto2() { return true } return false }
[ "func", "(", "p", "FieldPath", ")", "IsNestedProto3", "(", ")", "bool", "{", "if", "len", "(", "p", ")", ">", "1", "&&", "!", "p", "[", "0", "]", ".", "Target", ".", "Message", ".", "File", ".", "proto2", "(", ")", "{", "return", "true", "\n", ...
// IsNestedProto3 indicates whether the FieldPath is a nested Proto3 path.
[ "IsNestedProto3", "indicates", "whether", "the", "FieldPath", "is", "a", "nested", "Proto3", "path", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L297-L302
133,827
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
AssignableExpr
func (p FieldPath) AssignableExpr(msgExpr string) string { l := len(p) if l == 0 { return msgExpr } var preparations []string components := msgExpr for i, c := range p { // Check if it is a oneOf field. if c.Target.OneofIndex != nil { index := c.Target.OneofIndex msg := c.Target.Message oneOfName ...
go
func (p FieldPath) AssignableExpr(msgExpr string) string { l := len(p) if l == 0 { return msgExpr } var preparations []string components := msgExpr for i, c := range p { // Check if it is a oneOf field. if c.Target.OneofIndex != nil { index := c.Target.OneofIndex msg := c.Target.Message oneOfName ...
[ "func", "(", "p", "FieldPath", ")", "AssignableExpr", "(", "msgExpr", "string", ")", "string", "{", "l", ":=", "len", "(", "p", ")", "\n", "if", "l", "==", "0", "{", "return", "msgExpr", "\n", "}", "\n\n", "var", "preparations", "[", "]", "string", ...
// AssignableExpr is an assignable expression in Go to be used to assign a value to the target field. // It starts with "msgExpr", which is the go expression of the method request object.
[ "AssignableExpr", "is", "an", "assignable", "expression", "in", "Go", "to", "be", "used", "to", "assign", "a", "value", "to", "the", "target", "field", ".", "It", "starts", "with", "msgExpr", "which", "is", "the", "go", "expression", "of", "the", "method",...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L306-L342
133,828
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/types.go
ValueExpr
func (c FieldPathComponent) ValueExpr() string { if c.Target.Message.File.proto2() { return fmt.Sprintf("Get%s()", gogen.CamelCase(c.Name)) } return gogen.CamelCase(c.Name) }
go
func (c FieldPathComponent) ValueExpr() string { if c.Target.Message.File.proto2() { return fmt.Sprintf("Get%s()", gogen.CamelCase(c.Name)) } return gogen.CamelCase(c.Name) }
[ "func", "(", "c", "FieldPathComponent", ")", "ValueExpr", "(", ")", "string", "{", "if", "c", ".", "Target", ".", "Message", ".", "File", ".", "proto2", "(", ")", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "gogen", ".", "CamelCase", ...
// ValueExpr returns an expression in go for this field.
[ "ValueExpr", "returns", "an", "expression", "in", "go", "for", "this", "field", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/types.go#L359-L364
133,829
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/httprule/parse.go
Parse
func Parse(tmpl string) (Compiler, error) { if !strings.HasPrefix(tmpl, "/") { return template{}, InvalidTemplateError{tmpl: tmpl, msg: "no leading /"} } tokens, verb := tokenize(tmpl[1:]) p := parser{tokens: tokens} segs, err := p.topLevelSegments() if err != nil { return template{}, InvalidTemplateError{tm...
go
func Parse(tmpl string) (Compiler, error) { if !strings.HasPrefix(tmpl, "/") { return template{}, InvalidTemplateError{tmpl: tmpl, msg: "no leading /"} } tokens, verb := tokenize(tmpl[1:]) p := parser{tokens: tokens} segs, err := p.topLevelSegments() if err != nil { return template{}, InvalidTemplateError{tm...
[ "func", "Parse", "(", "tmpl", "string", ")", "(", "Compiler", ",", "error", ")", "{", "if", "!", "strings", ".", "HasPrefix", "(", "tmpl", ",", "\"", "\"", ")", "{", "return", "template", "{", "}", ",", "InvalidTemplateError", "{", "tmpl", ":", "tmpl...
// Parse parses the string representation of path template
[ "Parse", "parses", "the", "string", "representation", "of", "path", "template" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/httprule/parse.go#L21-L38
133,830
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/httprule/parse.go
topLevelSegments
func (p *parser) topLevelSegments() ([]segment, error) { glog.V(1).Infof("Parsing %q", p.tokens) segs, err := p.segments() if err != nil { return nil, err } glog.V(2).Infof("accept segments: %q; %q", p.accepted, p.tokens) if _, err := p.accept(typeEOF); err != nil { return nil, fmt.Errorf("unexpected token %q...
go
func (p *parser) topLevelSegments() ([]segment, error) { glog.V(1).Infof("Parsing %q", p.tokens) segs, err := p.segments() if err != nil { return nil, err } glog.V(2).Infof("accept segments: %q; %q", p.accepted, p.tokens) if _, err := p.accept(typeEOF); err != nil { return nil, fmt.Errorf("unexpected token %q...
[ "func", "(", "p", "*", "parser", ")", "topLevelSegments", "(", ")", "(", "[", "]", "segment", ",", "error", ")", "{", "glog", ".", "V", "(", "1", ")", ".", "Infof", "(", "\"", "\"", ",", "p", ".", "tokens", ")", "\n", "segs", ",", "err", ":="...
// topLevelSegments is the target of this parser.
[ "topLevelSegments", "is", "the", "target", "of", "this", "parser", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/httprule/parse.go#L102-L114
133,831
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/httprule/parse.go
accept
func (p *parser) accept(term termType) (string, error) { t := p.tokens[0] switch term { case "/", "*", "**", ".", "=", "{", "}": if t != string(term) && t != "/" { return "", fmt.Errorf("expected %q but got %q", term, t) } case typeEOF: if t != eof { return "", fmt.Errorf("expected EOF but got %q", t) ...
go
func (p *parser) accept(term termType) (string, error) { t := p.tokens[0] switch term { case "/", "*", "**", ".", "=", "{", "}": if t != string(term) && t != "/" { return "", fmt.Errorf("expected %q but got %q", term, t) } case typeEOF: if t != eof { return "", fmt.Errorf("expected EOF but got %q", t) ...
[ "func", "(", "p", "*", "parser", ")", "accept", "(", "term", "termType", ")", "(", "string", ",", "error", ")", "{", "t", ":=", "p", ".", "tokens", "[", "0", "]", "\n", "switch", "term", "{", "case", "\"", "\"", ",", "\"", "\"", ",", "\"", "\...
// accept tries to accept a token in "p". // This function consumes a token and returns it if it matches to the specified "term". // If it doesn't match, the function does not consume any tokens and return an error.
[ "accept", "tries", "to", "accept", "a", "token", "in", "p", ".", "This", "function", "consumes", "a", "token", "and", "returns", "it", "if", "it", "matches", "to", "the", "specified", "term", ".", "If", "it", "doesn", "t", "match", "the", "function", "...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/httprule/parse.go#L231-L256
133,832
grpc-ecosystem/grpc-gateway
utilities/trie.go
NewDoubleArray
func NewDoubleArray(seqs [][]string) *DoubleArray { da := &DoubleArray{Encoding: make(map[string]int)} if len(seqs) == 0 { return da } encoded := registerTokens(da, seqs) sort.Sort(byLex(encoded)) root := node{row: -1, col: -1, left: 0, right: len(encoded)} addSeqs(da, encoded, 0, root) for i := len(da.Bas...
go
func NewDoubleArray(seqs [][]string) *DoubleArray { da := &DoubleArray{Encoding: make(map[string]int)} if len(seqs) == 0 { return da } encoded := registerTokens(da, seqs) sort.Sort(byLex(encoded)) root := node{row: -1, col: -1, left: 0, right: len(encoded)} addSeqs(da, encoded, 0, root) for i := len(da.Bas...
[ "func", "NewDoubleArray", "(", "seqs", "[", "]", "[", "]", "string", ")", "*", "DoubleArray", "{", "da", ":=", "&", "DoubleArray", "{", "Encoding", ":", "make", "(", "map", "[", "string", "]", "int", ")", "}", "\n", "if", "len", "(", "seqs", ")", ...
// NewDoubleArray builds a DoubleArray from a set of sequences of strings.
[ "NewDoubleArray", "builds", "a", "DoubleArray", "from", "a", "set", "of", "sequences", "of", "strings", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/utilities/trie.go#L18-L38
133,833
grpc-ecosystem/grpc-gateway
utilities/trie.go
HasCommonPrefix
func (da *DoubleArray) HasCommonPrefix(seq []string) bool { if len(da.Base) == 0 { return false } var i int for _, t := range seq { code, ok := da.Encoding[t] if !ok { break } j := da.Base[i] + code if len(da.Check) <= j || da.Check[j] != i+1 { break } i = j } j := da.Base[i] + len(da.Encod...
go
func (da *DoubleArray) HasCommonPrefix(seq []string) bool { if len(da.Base) == 0 { return false } var i int for _, t := range seq { code, ok := da.Encoding[t] if !ok { break } j := da.Base[i] + code if len(da.Check) <= j || da.Check[j] != i+1 { break } i = j } j := da.Base[i] + len(da.Encod...
[ "func", "(", "da", "*", "DoubleArray", ")", "HasCommonPrefix", "(", "seq", "[", "]", "string", ")", "bool", "{", "if", "len", "(", "da", ".", "Base", ")", "==", "0", "{", "return", "false", "\n", "}", "\n\n", "var", "i", "int", "\n", "for", "_", ...
// HasCommonPrefix determines if any sequence in the DoubleArray is a prefix of the given sequence.
[ "HasCommonPrefix", "determines", "if", "any", "sequence", "in", "the", "DoubleArray", "is", "a", "prefix", "of", "the", "given", "sequence", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/utilities/trie.go#L155-L177
133,834
grpc-ecosystem/grpc-gateway
runtime/marshal_jsonpb.go
Unmarshal
func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { return unmarshalJSONPb(data, v) }
go
func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { return unmarshalJSONPb(data, v) }
[ "func", "(", "j", "*", "JSONPb", ")", "Unmarshal", "(", "data", "[", "]", "byte", ",", "v", "interface", "{", "}", ")", "error", "{", "return", "unmarshalJSONPb", "(", "data", ",", "v", ")", "\n", "}" ]
// Unmarshal unmarshals JSON "data" into "v"
[ "Unmarshal", "unmarshals", "JSON", "data", "into", "v" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/marshal_jsonpb.go#L130-L132
133,835
grpc-ecosystem/grpc-gateway
runtime/marshaler_registry.go
WithMarshalerOption
func WithMarshalerOption(mime string, marshaler Marshaler) ServeMuxOption { return func(mux *ServeMux) { if err := mux.marshalers.add(mime, marshaler); err != nil { panic(err) } } }
go
func WithMarshalerOption(mime string, marshaler Marshaler) ServeMuxOption { return func(mux *ServeMux) { if err := mux.marshalers.add(mime, marshaler); err != nil { panic(err) } } }
[ "func", "WithMarshalerOption", "(", "mime", "string", ",", "marshaler", "Marshaler", ")", "ServeMuxOption", "{", "return", "func", "(", "mux", "*", "ServeMux", ")", "{", "if", "err", ":=", "mux", ".", "marshalers", ".", "add", "(", "mime", ",", "marshaler"...
// WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound // Marshalers to a MIME type in mux.
[ "WithMarshalerOption", "returns", "a", "ServeMuxOption", "which", "associates", "inbound", "and", "outbound", "Marshalers", "to", "a", "MIME", "type", "in", "mux", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/marshaler_registry.go#L85-L91
133,836
grpc-ecosystem/grpc-gateway
examples/proto/examplepb/a_bit_of_everything.pb.gw.go
RegisterABitOfEverythingServiceHandler
func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterABitOfEverythingServiceHandlerClient(ctx, mux, NewABitOfEverythingServiceClient(conn)) }
go
func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterABitOfEverythingServiceHandlerClient(ctx, mux, NewABitOfEverythingServiceClient(conn)) }
[ "func", "RegisterABitOfEverythingServiceHandler", "(", "ctx", "context", ".", "Context", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "error", "{", "return", "RegisterABitOfEverythingServiceHandlerClient", "(", "ctx"...
// RegisterABitOfEverythingServiceHandler registers the http handlers for service ABitOfEverythingService to "mux". // The handlers forward requests to the grpc endpoint over "conn".
[ "RegisterABitOfEverythingServiceHandler", "registers", "the", "http", "handlers", "for", "service", "ABitOfEverythingService", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "conn", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/proto/examplepb/a_bit_of_everything.pb.gw.go#L970-L972
133,837
grpc-ecosystem/grpc-gateway
examples/proto/examplepb/a_bit_of_everything.pb.gw.go
RegisterCamelCaseServiceNameHandler
func RegisterCamelCaseServiceNameHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterCamelCaseServiceNameHandlerClient(ctx, mux, NewCamelCaseServiceNameClient(conn)) }
go
func RegisterCamelCaseServiceNameHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterCamelCaseServiceNameHandlerClient(ctx, mux, NewCamelCaseServiceNameClient(conn)) }
[ "func", "RegisterCamelCaseServiceNameHandler", "(", "ctx", "context", ".", "Context", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "error", "{", "return", "RegisterCamelCaseServiceNameHandlerClient", "(", "ctx", ",...
// RegisterCamelCaseServiceNameHandler registers the http handlers for service CamelCaseServiceName to "mux". // The handlers forward requests to the grpc endpoint over "conn".
[ "RegisterCamelCaseServiceNameHandler", "registers", "the", "http", "handlers", "for", "service", "CamelCaseServiceName", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "conn", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/proto/examplepb/a_bit_of_everything.pb.gw.go#L1447-L1449
133,838
grpc-ecosystem/grpc-gateway
examples/pbwrappers/helloworld/helloworld.pb.gw.go
RegisterGreeterHandler
func RegisterGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterGreeterHandlerClient(ctx, mux, NewGreeterClient(conn)) }
go
func RegisterGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterGreeterHandlerClient(ctx, mux, NewGreeterClient(conn)) }
[ "func", "RegisterGreeterHandler", "(", "ctx", "context", ".", "Context", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "error", "{", "return", "RegisterGreeterHandlerClient", "(", "ctx", ",", "mux", ",", "NewG...
// RegisterGreeterHandler registers the http handlers for service Greeter to "mux". // The handlers forward requests to the grpc endpoint over "conn".
[ "RegisterGreeterHandler", "registers", "the", "http", "handlers", "for", "service", "Greeter", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "conn", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/pbwrappers/helloworld/helloworld.pb.gw.go#L408-L410
133,839
grpc-ecosystem/grpc-gateway
runtime/mux.go
WithForwardResponseOption
func WithForwardResponseOption(forwardResponseOption func(context.Context, http.ResponseWriter, proto.Message) error) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.forwardResponseOptions = append(serveMux.forwardResponseOptions, forwardResponseOption) } }
go
func WithForwardResponseOption(forwardResponseOption func(context.Context, http.ResponseWriter, proto.Message) error) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.forwardResponseOptions = append(serveMux.forwardResponseOptions, forwardResponseOption) } }
[ "func", "WithForwardResponseOption", "(", "forwardResponseOption", "func", "(", "context", ".", "Context", ",", "http", ".", "ResponseWriter", ",", "proto", ".", "Message", ")", "error", ")", "ServeMuxOption", "{", "return", "func", "(", "serveMux", "*", "ServeM...
// WithForwardResponseOption returns a ServeMuxOption representing the forwardResponseOption. // // forwardResponseOption is an option that will be called on the relevant context.Context, // http.ResponseWriter, and proto.Message before every forwarded response. // // The message may be nil in the case where just a hea...
[ "WithForwardResponseOption", "returns", "a", "ServeMuxOption", "representing", "the", "forwardResponseOption", ".", "forwardResponseOption", "is", "an", "option", "that", "will", "be", "called", "on", "the", "relevant", "context", ".", "Context", "http", ".", "Respons...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/mux.go#L42-L46
133,840
grpc-ecosystem/grpc-gateway
runtime/mux.go
WithMetadata
func WithMetadata(annotator func(context.Context, *http.Request) metadata.MD) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.metadataAnnotators = append(serveMux.metadataAnnotators, annotator) } }
go
func WithMetadata(annotator func(context.Context, *http.Request) metadata.MD) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.metadataAnnotators = append(serveMux.metadataAnnotators, annotator) } }
[ "func", "WithMetadata", "(", "annotator", "func", "(", "context", ".", "Context", ",", "*", "http", ".", "Request", ")", "metadata", ".", "MD", ")", "ServeMuxOption", "{", "return", "func", "(", "serveMux", "*", "ServeMux", ")", "{", "serveMux", ".", "me...
// WithMetadata returns a ServeMuxOption for passing metadata to a gRPC context. // // This can be used by services that need to read from http.Request and modify gRPC context. A common use case // is reading token from cookie and adding it in gRPC context.
[ "WithMetadata", "returns", "a", "ServeMuxOption", "for", "passing", "metadata", "to", "a", "gRPC", "context", ".", "This", "can", "be", "used", "by", "services", "that", "need", "to", "read", "from", "http", ".", "Request", "and", "modify", "gRPC", "context"...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/mux.go#L89-L93
133,841
grpc-ecosystem/grpc-gateway
runtime/mux.go
NewServeMux
func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), marshalers: makeMarshalerMIMERegistry(), } for _, opt := range opts { ...
go
func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), marshalers: makeMarshalerMIMERegistry(), } for _, opt := range opts { ...
[ "func", "NewServeMux", "(", "opts", "...", "ServeMuxOption", ")", "*", "ServeMux", "{", "serveMux", ":=", "&", "ServeMux", "{", "handlers", ":", "make", "(", "map", "[", "string", "]", "[", "]", "handler", ")", ",", "forwardResponseOptions", ":", "make", ...
// NewServeMux returns a new ServeMux whose internal mapping is empty.
[ "NewServeMux", "returns", "a", "new", "ServeMux", "whose", "internal", "mapping", "is", "empty", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/mux.go#L114-L148
133,842
grpc-ecosystem/grpc-gateway
runtime/mux.go
Handle
func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) { s.handlers[meth] = append(s.handlers[meth], handler{pat: pat, h: h}) }
go
func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) { s.handlers[meth] = append(s.handlers[meth], handler{pat: pat, h: h}) }
[ "func", "(", "s", "*", "ServeMux", ")", "Handle", "(", "meth", "string", ",", "pat", "Pattern", ",", "h", "HandlerFunc", ")", "{", "s", ".", "handlers", "[", "meth", "]", "=", "append", "(", "s", ".", "handlers", "[", "meth", "]", ",", "handler", ...
// Handle associates "h" to the pair of HTTP method and path pattern.
[ "Handle", "associates", "h", "to", "the", "pair", "of", "HTTP", "method", "and", "path", "pattern", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/mux.go#L151-L153
133,843
grpc-ecosystem/grpc-gateway
runtime/mux.go
GetForwardResponseOptions
func (s *ServeMux) GetForwardResponseOptions() []func(context.Context, http.ResponseWriter, proto.Message) error { return s.forwardResponseOptions }
go
func (s *ServeMux) GetForwardResponseOptions() []func(context.Context, http.ResponseWriter, proto.Message) error { return s.forwardResponseOptions }
[ "func", "(", "s", "*", "ServeMux", ")", "GetForwardResponseOptions", "(", ")", "[", "]", "func", "(", "context", ".", "Context", ",", "http", ".", "ResponseWriter", ",", "proto", ".", "Message", ")", "error", "{", "return", "s", ".", "forwardResponseOption...
// GetForwardResponseOptions returns the ForwardResponseOptions associated with this ServeMux.
[ "GetForwardResponseOptions", "returns", "the", "ForwardResponseOptions", "associated", "with", "this", "ServeMux", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/mux.go#L257-L259
133,844
grpc-ecosystem/grpc-gateway
examples/clients/abe/enum_helper.go
UnmarshalJSON
func (e ExamplepbNumericEnum) UnmarshalJSON(b []byte) error { return unmarshalJSONEnum(b, pbexamplepb.NumericEnum_value) }
go
func (e ExamplepbNumericEnum) UnmarshalJSON(b []byte) error { return unmarshalJSONEnum(b, pbexamplepb.NumericEnum_value) }
[ "func", "(", "e", "ExamplepbNumericEnum", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "return", "unmarshalJSONEnum", "(", "b", ",", "pbexamplepb", ".", "NumericEnum_value", ")", "\n", "}" ]
// UnmarshalJSON does a no-op unmarshal to ExamplepbNumericEnum. // It just validates that the input is sane.
[ "UnmarshalJSON", "does", "a", "no", "-", "op", "unmarshal", "to", "ExamplepbNumericEnum", ".", "It", "just", "validates", "that", "the", "input", "is", "sane", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/clients/abe/enum_helper.go#L16-L18
133,845
grpc-ecosystem/grpc-gateway
examples/clients/abe/enum_helper.go
UnmarshalJSON
func (e MessagePathEnumNestedPathEnum) UnmarshalJSON(b []byte) error { return unmarshalJSONEnum(b, pbpathenum.MessagePathEnum_NestedPathEnum_value) }
go
func (e MessagePathEnumNestedPathEnum) UnmarshalJSON(b []byte) error { return unmarshalJSONEnum(b, pbpathenum.MessagePathEnum_NestedPathEnum_value) }
[ "func", "(", "e", "MessagePathEnumNestedPathEnum", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "return", "unmarshalJSONEnum", "(", "b", ",", "pbpathenum", ".", "MessagePathEnum_NestedPathEnum_value", ")", "\n", "}" ]
// UnmarshalJSON does a no-op unmarshal to MessagePathEnumNestedPathEnum. // It just validates that the input is sane.
[ "UnmarshalJSON", "does", "a", "no", "-", "op", "unmarshal", "to", "MessagePathEnumNestedPathEnum", ".", "It", "just", "validates", "that", "the", "input", "is", "sane", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/clients/abe/enum_helper.go#L27-L29
133,846
grpc-ecosystem/grpc-gateway
examples/clients/abe/enum_helper.go
UnmarshalJSON
func (e PathenumPathEnum) UnmarshalJSON(b []byte) error { return unmarshalJSONEnum(b, pbpathenum.PathEnum_value) }
go
func (e PathenumPathEnum) UnmarshalJSON(b []byte) error { return unmarshalJSONEnum(b, pbpathenum.PathEnum_value) }
[ "func", "(", "e", "PathenumPathEnum", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "return", "unmarshalJSONEnum", "(", "b", ",", "pbpathenum", ".", "PathEnum_value", ")", "\n", "}" ]
// UnmarshalJSON does a no-op unmarshal to PathenumPathEnum. // It just validates that the input is sane.
[ "UnmarshalJSON", "does", "a", "no", "-", "op", "unmarshal", "to", "PathenumPathEnum", ".", "It", "just", "validates", "that", "the", "input", "is", "sane", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/clients/abe/enum_helper.go#L38-L40
133,847
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/services.go
lookupField
func lookupField(msg *Message, name string) *Field { for _, f := range msg.Fields { if f.GetName() == name { return f } } return nil }
go
func lookupField(msg *Message, name string) *Field { for _, f := range msg.Fields { if f.GetName() == name { return f } } return nil }
[ "func", "lookupField", "(", "msg", "*", "Message", ",", "name", "string", ")", "*", "Field", "{", "for", "_", ",", "f", ":=", "range", "msg", ".", "Fields", "{", "if", "f", ".", "GetName", "(", ")", "==", "name", "{", "return", "f", "\n", "}", ...
// lookupField looks up a field named "name" within "msg". // It returns nil if no such field found.
[ "lookupField", "looks", "up", "a", "field", "named", "name", "within", "msg", ".", "It", "returns", "nil", "if", "no", "such", "field", "found", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/services.go#L261-L268
133,848
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/descriptor/services.go
resolveFieldPath
func (r *Registry) resolveFieldPath(msg *Message, path string, isPathParam bool) ([]FieldPathComponent, error) { if path == "" { return nil, nil } root := msg var result []FieldPathComponent for i, c := range strings.Split(path, ".") { if i > 0 { f := result[i-1].Target switch f.GetType() { case desc...
go
func (r *Registry) resolveFieldPath(msg *Message, path string, isPathParam bool) ([]FieldPathComponent, error) { if path == "" { return nil, nil } root := msg var result []FieldPathComponent for i, c := range strings.Split(path, ".") { if i > 0 { f := result[i-1].Target switch f.GetType() { case desc...
[ "func", "(", "r", "*", "Registry", ")", "resolveFieldPath", "(", "msg", "*", "Message", ",", "path", "string", ",", "isPathParam", "bool", ")", "(", "[", "]", "FieldPathComponent", ",", "error", ")", "{", "if", "path", "==", "\"", "\"", "{", "return", ...
// resolveFieldPath resolves "path" into a list of fieldDescriptor, starting from "msg".
[ "resolveFieldPath", "resolves", "path", "into", "a", "list", "of", "fieldDescriptor", "starting", "from", "msg", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/descriptor/services.go#L271-L304
133,849
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/gengateway/template.go
GetBodyFieldPath
func (b binding) GetBodyFieldPath() string { if b.Body != nil && len(b.Body.FieldPath) != 0 { return b.Body.FieldPath.String() } return "*" }
go
func (b binding) GetBodyFieldPath() string { if b.Body != nil && len(b.Body.FieldPath) != 0 { return b.Body.FieldPath.String() } return "*" }
[ "func", "(", "b", "binding", ")", "GetBodyFieldPath", "(", ")", "string", "{", "if", "b", ".", "Body", "!=", "nil", "&&", "len", "(", "b", ".", "Body", ".", "FieldPath", ")", "!=", "0", "{", "return", "b", ".", "Body", ".", "FieldPath", ".", "Str...
// GetBodyFieldPath returns the binding body's fieldpath.
[ "GetBodyFieldPath", "returns", "the", "binding", "body", "s", "fieldpath", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/gengateway/template.go#L30-L35
133,850
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/gengateway/template.go
HasQueryParam
func (b binding) HasQueryParam() bool { if b.Body != nil && len(b.Body.FieldPath) == 0 { return false } fields := make(map[string]bool) for _, f := range b.Method.RequestType.Fields { fields[f.GetName()] = true } if b.Body != nil { delete(fields, b.Body.FieldPath.String()) } for _, p := range b.PathParams...
go
func (b binding) HasQueryParam() bool { if b.Body != nil && len(b.Body.FieldPath) == 0 { return false } fields := make(map[string]bool) for _, f := range b.Method.RequestType.Fields { fields[f.GetName()] = true } if b.Body != nil { delete(fields, b.Body.FieldPath.String()) } for _, p := range b.PathParams...
[ "func", "(", "b", "binding", ")", "HasQueryParam", "(", ")", "bool", "{", "if", "b", ".", "Body", "!=", "nil", "&&", "len", "(", "b", ".", "Body", ".", "FieldPath", ")", "==", "0", "{", "return", "false", "\n", "}", "\n", "fields", ":=", "make", ...
// HasQueryParam determines if the binding needs parameters in query string. // // It sometimes returns true even though actually the binding does not need. // But it is not serious because it just results in a small amount of extra codes generated.
[ "HasQueryParam", "determines", "if", "the", "binding", "needs", "parameters", "in", "query", "string", ".", "It", "sometimes", "returns", "true", "even", "though", "actually", "the", "binding", "does", "not", "need", ".", "But", "it", "is", "not", "serious", ...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/gengateway/template.go#L41-L56
133,851
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/gengateway/template.go
hasEnumPathParam
func (b binding) hasEnumPathParam(repeated bool) bool { for _, p := range b.PathParams { if p.IsEnum() && p.IsRepeated() == repeated { return true } } return false }
go
func (b binding) hasEnumPathParam(repeated bool) bool { for _, p := range b.PathParams { if p.IsEnum() && p.IsRepeated() == repeated { return true } } return false }
[ "func", "(", "b", "binding", ")", "hasEnumPathParam", "(", "repeated", "bool", ")", "bool", "{", "for", "_", ",", "p", ":=", "range", "b", ".", "PathParams", "{", "if", "p", ".", "IsEnum", "(", ")", "&&", "p", ".", "IsRepeated", "(", ")", "==", "...
// hasEnumPathParam returns true if the path parameter slice contains a parameter // that maps to a enum proto field and that the enum proto field is or isn't repeated // based on the provided 'repeated' parameter.
[ "hasEnumPathParam", "returns", "true", "if", "the", "path", "parameter", "slice", "contains", "a", "parameter", "that", "maps", "to", "a", "enum", "proto", "field", "and", "that", "the", "enum", "proto", "field", "is", "or", "isn", "t", "repeated", "based", ...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/gengateway/template.go#L84-L91
133,852
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/gengateway/template.go
LookupEnum
func (b binding) LookupEnum(p descriptor.Parameter) *descriptor.Enum { e, err := b.Registry.LookupEnum("", p.Target.GetTypeName()) if err != nil { return nil } return e }
go
func (b binding) LookupEnum(p descriptor.Parameter) *descriptor.Enum { e, err := b.Registry.LookupEnum("", p.Target.GetTypeName()) if err != nil { return nil } return e }
[ "func", "(", "b", "binding", ")", "LookupEnum", "(", "p", "descriptor", ".", "Parameter", ")", "*", "descriptor", ".", "Enum", "{", "e", ",", "err", ":=", "b", ".", "Registry", ".", "LookupEnum", "(", "\"", "\"", ",", "p", ".", "Target", ".", "GetT...
// LookupEnum looks up a enum type by path parameter.
[ "LookupEnum", "looks", "up", "a", "enum", "type", "by", "path", "parameter", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/gengateway/template.go#L94-L100
133,853
grpc-ecosystem/grpc-gateway
protoc-gen-grpc-gateway/gengateway/template.go
FieldMaskField
func (b binding) FieldMaskField() string { var fieldMaskField *descriptor.Field for _, f := range b.Method.RequestType.Fields { if f.GetTypeName() == ".google.protobuf.FieldMask" { // if there is more than 1 FieldMask for this request, then return none if fieldMaskField != nil { return "" } fieldMas...
go
func (b binding) FieldMaskField() string { var fieldMaskField *descriptor.Field for _, f := range b.Method.RequestType.Fields { if f.GetTypeName() == ".google.protobuf.FieldMask" { // if there is more than 1 FieldMask for this request, then return none if fieldMaskField != nil { return "" } fieldMas...
[ "func", "(", "b", "binding", ")", "FieldMaskField", "(", ")", "string", "{", "var", "fieldMaskField", "*", "descriptor", ".", "Field", "\n", "for", "_", ",", "f", ":=", "range", "b", ".", "Method", ".", "RequestType", ".", "Fields", "{", "if", "f", "...
// FieldMaskField returns the golang-style name of the variable for a FieldMask, if there is exactly one of that type in // the message. Otherwise, it returns an empty string.
[ "FieldMaskField", "returns", "the", "golang", "-", "style", "name", "of", "the", "variable", "for", "a", "FieldMask", "if", "there", "is", "exactly", "one", "of", "that", "type", "in", "the", "message", ".", "Otherwise", "it", "returns", "an", "empty", "st...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-grpc-gateway/gengateway/template.go#L104-L119
133,854
grpc-ecosystem/grpc-gateway
runtime/context.go
NewServerMetadataContext
func NewServerMetadataContext(ctx context.Context, md ServerMetadata) context.Context { return context.WithValue(ctx, serverMetadataKey{}, md) }
go
func NewServerMetadataContext(ctx context.Context, md ServerMetadata) context.Context { return context.WithValue(ctx, serverMetadataKey{}, md) }
[ "func", "NewServerMetadataContext", "(", "ctx", "context", ".", "Context", ",", "md", "ServerMetadata", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "serverMetadataKey", "{", "}", ",", "md", ")", "\n", "}" ]
// NewServerMetadataContext creates a new context with ServerMetadata
[ "NewServerMetadataContext", "creates", "a", "new", "context", "with", "ServerMetadata" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/context.go#L132-L134
133,855
grpc-ecosystem/grpc-gateway
runtime/context.go
ServerMetadataFromContext
func ServerMetadataFromContext(ctx context.Context) (md ServerMetadata, ok bool) { md, ok = ctx.Value(serverMetadataKey{}).(ServerMetadata) return }
go
func ServerMetadataFromContext(ctx context.Context) (md ServerMetadata, ok bool) { md, ok = ctx.Value(serverMetadataKey{}).(ServerMetadata) return }
[ "func", "ServerMetadataFromContext", "(", "ctx", "context", ".", "Context", ")", "(", "md", "ServerMetadata", ",", "ok", "bool", ")", "{", "md", ",", "ok", "=", "ctx", ".", "Value", "(", "serverMetadataKey", "{", "}", ")", ".", "(", "ServerMetadata", ")"...
// ServerMetadataFromContext returns the ServerMetadata in ctx
[ "ServerMetadataFromContext", "returns", "the", "ServerMetadata", "in", "ctx" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/context.go#L137-L140
133,856
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
messageToQueryParameters
func messageToQueryParameters(message *descriptor.Message, reg *descriptor.Registry, pathParams []descriptor.Parameter) (params []swaggerParameterObject, err error) { for _, field := range message.Fields { p, err := queryParams(message, field, "", reg, pathParams) if err != nil { return nil, err } params = ...
go
func messageToQueryParameters(message *descriptor.Message, reg *descriptor.Registry, pathParams []descriptor.Parameter) (params []swaggerParameterObject, err error) { for _, field := range message.Fields { p, err := queryParams(message, field, "", reg, pathParams) if err != nil { return nil, err } params = ...
[ "func", "messageToQueryParameters", "(", "message", "*", "descriptor", ".", "Message", ",", "reg", "*", "descriptor", ".", "Registry", ",", "pathParams", "[", "]", "descriptor", ".", "Parameter", ")", "(", "params", "[", "]", "swaggerParameterObject", ",", "er...
// messageToQueryParameters converts a message to a list of swagger query parameters.
[ "messageToQueryParameters", "converts", "a", "message", "to", "a", "list", "of", "swagger", "query", "parameters", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L83-L92
133,857
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
findServicesMessagesAndEnumerations
func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, ms messageMap, e enumMap, refs refMap) { for _, svc := range s { for _, meth := range svc.Methods { // Request may be fully included in query if _, ok := refs[fmt.Sprintf("#/definitions/%s", fullyQualified...
go
func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, ms messageMap, e enumMap, refs refMap) { for _, svc := range s { for _, meth := range svc.Methods { // Request may be fully included in query if _, ok := refs[fmt.Sprintf("#/definitions/%s", fullyQualified...
[ "func", "findServicesMessagesAndEnumerations", "(", "s", "[", "]", "*", "descriptor", ".", "Service", ",", "reg", "*", "descriptor", ".", "Registry", ",", "m", "messageMap", ",", "ms", "messageMap", ",", "e", "enumMap", ",", "refs", "refMap", ")", "{", "fo...
// findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service.
[ "findServicesMessagesAndEnumerations", "discovers", "all", "messages", "and", "enums", "defined", "in", "the", "RPC", "methods", "of", "the", "service", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L192-L223
133,858
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
findNestedMessagesAndEnumerations
func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descriptor.Registry, m messageMap, e enumMap) { // Iterate over all the fields that for _, t := range message.Fields { fieldType := t.GetTypeName() // If the type is an empty string then it is a proto primitive if fieldType != "" { if _...
go
func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descriptor.Registry, m messageMap, e enumMap) { // Iterate over all the fields that for _, t := range message.Fields { fieldType := t.GetTypeName() // If the type is an empty string then it is a proto primitive if fieldType != "" { if _...
[ "func", "findNestedMessagesAndEnumerations", "(", "message", "*", "descriptor", ".", "Message", ",", "reg", "*", "descriptor", ".", "Registry", ",", "m", "messageMap", ",", "e", "enumMap", ")", "{", "// Iterate over all the fields that", "for", "_", ",", "t", ":...
// findNestedMessagesAndEnumerations those can be generated by the services.
[ "findNestedMessagesAndEnumerations", "those", "can", "be", "generated", "by", "the", "services", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L226-L247
133,859
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
schemaOfField
func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) swaggerSchemaObject { const ( singular = 0 array = 1 object = 2 ) var ( core schemaCore aggregate int ) fd := f.FieldDescriptorProto if m, err := reg.LookupMsg("", f.GetTypeName()); err == nil { if opt := m.GetOp...
go
func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) swaggerSchemaObject { const ( singular = 0 array = 1 object = 2 ) var ( core schemaCore aggregate int ) fd := f.FieldDescriptorProto if m, err := reg.LookupMsg("", f.GetTypeName()); err == nil { if opt := m.GetOp...
[ "func", "schemaOfField", "(", "f", "*", "descriptor", ".", "Field", ",", "reg", "*", "descriptor", ".", "Registry", ",", "refs", "refMap", ")", "swaggerSchemaObject", "{", "const", "(", "singular", "=", "0", "\n", "array", "=", "1", "\n", "object", "=", ...
// schemaOfField returns a swagger Schema Object for a protobuf field.
[ "schemaOfField", "returns", "a", "swagger", "Schema", "Object", "for", "a", "protobuf", "field", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L370-L449
133,860
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
primitiveSchema
func primitiveSchema(t pbdescriptor.FieldDescriptorProto_Type) (ftype, format string, ok bool) { switch t { case pbdescriptor.FieldDescriptorProto_TYPE_DOUBLE: return "number", "double", true case pbdescriptor.FieldDescriptorProto_TYPE_FLOAT: return "number", "float", true case pbdescriptor.FieldDescriptorProto...
go
func primitiveSchema(t pbdescriptor.FieldDescriptorProto_Type) (ftype, format string, ok bool) { switch t { case pbdescriptor.FieldDescriptorProto_TYPE_DOUBLE: return "number", "double", true case pbdescriptor.FieldDescriptorProto_TYPE_FLOAT: return "number", "float", true case pbdescriptor.FieldDescriptorProto...
[ "func", "primitiveSchema", "(", "t", "pbdescriptor", ".", "FieldDescriptorProto_Type", ")", "(", "ftype", ",", "format", "string", ",", "ok", "bool", ")", "{", "switch", "t", "{", "case", "pbdescriptor", ".", "FieldDescriptorProto_TYPE_DOUBLE", ":", "return", "\...
// primitiveSchema returns a pair of "Type" and "Format" in JSON Schema for // the given primitive field type. // The last return parameter is true iff the field type is actually primitive.
[ "primitiveSchema", "returns", "a", "pair", "of", "Type", "and", "Format", "in", "JSON", "Schema", "for", "the", "given", "primitive", "field", "type", ".", "The", "last", "return", "parameter", "is", "true", "iff", "the", "field", "type", "is", "actually", ...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L454-L498
133,861
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
renderEnumerationsAsDefinition
func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { for _, enum := range enums { enumComments := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index)) // it may be necessary to sort the result of the GetValue function. enumNames := listE...
go
func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { for _, enum := range enums { enumComments := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index)) // it may be necessary to sort the result of the GetValue function. enumNames := listE...
[ "func", "renderEnumerationsAsDefinition", "(", "enums", "enumMap", ",", "d", "swaggerDefinitionsObject", ",", "reg", "*", "descriptor", ".", "Registry", ")", "{", "for", "_", ",", "enum", ":=", "range", "enums", "{", "enumComments", ":=", "protoComments", "(", ...
// renderEnumerationsAsDefinition inserts enums into the definitions object.
[ "renderEnumerationsAsDefinition", "inserts", "enums", "into", "the", "definitions", "object", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L501-L525
133,862
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
fullyQualifiedNameToSwaggerName
func fullyQualifiedNameToSwaggerName(fqn string, reg *descriptor.Registry) string { registriesSeenMutex.Lock() defer registriesSeenMutex.Unlock() if mapping, present := registriesSeen[reg]; present { return mapping[fqn] } mapping := resolveFullyQualifiedNameToSwaggerNames(append(reg.GetAllFQMNs(), reg.GetAllFQEN...
go
func fullyQualifiedNameToSwaggerName(fqn string, reg *descriptor.Registry) string { registriesSeenMutex.Lock() defer registriesSeenMutex.Unlock() if mapping, present := registriesSeen[reg]; present { return mapping[fqn] } mapping := resolveFullyQualifiedNameToSwaggerNames(append(reg.GetAllFQMNs(), reg.GetAllFQEN...
[ "func", "fullyQualifiedNameToSwaggerName", "(", "fqn", "string", ",", "reg", "*", "descriptor", ".", "Registry", ")", "string", "{", "registriesSeenMutex", ".", "Lock", "(", ")", "\n", "defer", "registriesSeenMutex", ".", "Unlock", "(", ")", "\n", "if", "mappi...
// Take in a FQMN or FQEN and return a swagger safe version of the FQMN
[ "Take", "in", "a", "FQMN", "or", "FQEN", "and", "return", "a", "swagger", "safe", "version", "of", "the", "FQMN" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L528-L537
133,863
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
resolveFullyQualifiedNameToSwaggerNames
func resolveFullyQualifiedNameToSwaggerNames(messages []string, useFQNForSwaggerName bool) map[string]string { packagesByDepth := make(map[int][][]string) uniqueNames := make(map[string]string) hierarchy := func(pkg string) []string { return strings.Split(pkg, ".") } for _, p := range messages { h := hierarc...
go
func resolveFullyQualifiedNameToSwaggerNames(messages []string, useFQNForSwaggerName bool) map[string]string { packagesByDepth := make(map[int][][]string) uniqueNames := make(map[string]string) hierarchy := func(pkg string) []string { return strings.Split(pkg, ".") } for _, p := range messages { h := hierarc...
[ "func", "resolveFullyQualifiedNameToSwaggerNames", "(", "messages", "[", "]", "string", ",", "useFQNForSwaggerName", "bool", ")", "map", "[", "string", "]", "string", "{", "packagesByDepth", ":=", "make", "(", "map", "[", "int", "]", "[", "]", "[", "]", "str...
// Take the names of every proto and "uniq-ify" them. The idea is to produce a // set of names that meet a couple of conditions. They must be stable, they // must be unique, and they must be shorter than the FQN. // // This likely could be made better. This will always generate the same names // but may not always prod...
[ "Take", "the", "names", "of", "every", "proto", "and", "uniq", "-", "ify", "them", ".", "The", "idea", "is", "to", "produce", "a", "set", "of", "names", "that", "meet", "a", "couple", "of", "conditions", ".", "They", "must", "be", "stable", "they", "...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L551-L597
133,864
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
updateSwaggerDataFromComments
func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, isPackageObject bool) error { if len(comment) == 0 { return nil } // Figure out what to apply changes to. swaggerObjectValue := reflect.ValueOf(swaggerObject) infoObjectValue := swaggerObjectValue.Elem().FieldByName("Info") if !infoO...
go
func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, isPackageObject bool) error { if len(comment) == 0 { return nil } // Figure out what to apply changes to. swaggerObjectValue := reflect.ValueOf(swaggerObject) infoObjectValue := swaggerObjectValue.Elem().FieldByName("Info") if !infoO...
[ "func", "updateSwaggerDataFromComments", "(", "swaggerObject", "interface", "{", "}", ",", "comment", "string", ",", "isPackageObject", "bool", ")", "error", "{", "if", "len", "(", "comment", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "// Figur...
// updateSwaggerDataFromComments updates a Swagger object based on a comment // from the proto file. // // First paragraph of a comment is used for summary. Remaining paragraphs of // a comment are used for description. If 'Summary' field is not present on // the passed swaggerObject, the summary and description are jo...
[ "updateSwaggerDataFromComments", "updates", "a", "Swagger", "object", "based", "on", "a", "comment", "from", "the", "proto", "file", ".", "First", "paragraph", "of", "a", "comment", "is", "used", "for", "summary", ".", "Remaining", "paragraphs", "of", "a", "co...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L1213-L1279
133,865
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
extractOperationOptionFromMethodDescriptor
func extractOperationOptionFromMethodDescriptor(meth *pbdescriptor.MethodDescriptorProto) (*swagger_options.Operation, error) { if meth.Options == nil { return nil, nil } if !proto.HasExtension(meth.Options, swagger_options.E_Openapiv2Operation) { return nil, nil } ext, err := proto.GetExtension(meth.Options, ...
go
func extractOperationOptionFromMethodDescriptor(meth *pbdescriptor.MethodDescriptorProto) (*swagger_options.Operation, error) { if meth.Options == nil { return nil, nil } if !proto.HasExtension(meth.Options, swagger_options.E_Openapiv2Operation) { return nil, nil } ext, err := proto.GetExtension(meth.Options, ...
[ "func", "extractOperationOptionFromMethodDescriptor", "(", "meth", "*", "pbdescriptor", ".", "MethodDescriptorProto", ")", "(", "*", "swagger_options", ".", "Operation", ",", "error", ")", "{", "if", "meth", ".", "Options", "==", "nil", "{", "return", "nil", ","...
// extractOperationOptionFromMethodDescriptor extracts the message of type // swagger_options.Operation from a given proto method's descriptor.
[ "extractOperationOptionFromMethodDescriptor", "extracts", "the", "message", "of", "type", "swagger_options", ".", "Operation", "from", "a", "given", "proto", "method", "s", "descriptor", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L1453-L1469
133,866
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
extractSchemaOptionFromMessageDescriptor
func extractSchemaOptionFromMessageDescriptor(msg *pbdescriptor.DescriptorProto) (*swagger_options.Schema, error) { if msg.Options == nil { return nil, nil } if !proto.HasExtension(msg.Options, swagger_options.E_Openapiv2Schema) { return nil, nil } ext, err := proto.GetExtension(msg.Options, swagger_options.E_...
go
func extractSchemaOptionFromMessageDescriptor(msg *pbdescriptor.DescriptorProto) (*swagger_options.Schema, error) { if msg.Options == nil { return nil, nil } if !proto.HasExtension(msg.Options, swagger_options.E_Openapiv2Schema) { return nil, nil } ext, err := proto.GetExtension(msg.Options, swagger_options.E_...
[ "func", "extractSchemaOptionFromMessageDescriptor", "(", "msg", "*", "pbdescriptor", ".", "DescriptorProto", ")", "(", "*", "swagger_options", ".", "Schema", ",", "error", ")", "{", "if", "msg", ".", "Options", "==", "nil", "{", "return", "nil", ",", "nil", ...
// extractSchemaOptionFromMessageDescriptor extracts the message of type // swagger_options.Schema from a given proto message's descriptor.
[ "extractSchemaOptionFromMessageDescriptor", "extracts", "the", "message", "of", "type", "swagger_options", ".", "Schema", "from", "a", "given", "proto", "message", "s", "descriptor", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L1473-L1489
133,867
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/template.go
extractSwaggerOptionFromFileDescriptor
func extractSwaggerOptionFromFileDescriptor(file *pbdescriptor.FileDescriptorProto) (*swagger_options.Swagger, error) { if file.Options == nil { return nil, nil } if !proto.HasExtension(file.Options, swagger_options.E_Openapiv2Swagger) { return nil, nil } ext, err := proto.GetExtension(file.Options, swagger_op...
go
func extractSwaggerOptionFromFileDescriptor(file *pbdescriptor.FileDescriptorProto) (*swagger_options.Swagger, error) { if file.Options == nil { return nil, nil } if !proto.HasExtension(file.Options, swagger_options.E_Openapiv2Swagger) { return nil, nil } ext, err := proto.GetExtension(file.Options, swagger_op...
[ "func", "extractSwaggerOptionFromFileDescriptor", "(", "file", "*", "pbdescriptor", ".", "FileDescriptorProto", ")", "(", "*", "swagger_options", ".", "Swagger", ",", "error", ")", "{", "if", "file", ".", "Options", "==", "nil", "{", "return", "nil", ",", "nil...
// extractSwaggerOptionFromFileDescriptor extracts the message of type // swagger_options.Swagger from a given proto method's descriptor.
[ "extractSwaggerOptionFromFileDescriptor", "extracts", "the", "message", "of", "type", "swagger_options", ".", "Swagger", "from", "a", "given", "proto", "method", "s", "descriptor", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/template.go#L1493-L1509
133,868
grpc-ecosystem/grpc-gateway
examples/gateway/handlers.go
allowCORS
func allowCORS(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if origin := r.Header.Get("Origin"); origin != "" { w.Header().Set("Access-Control-Allow-Origin", origin) if r.Method == "OPTIONS" && r.Header.Get("Access-Control-Request-Method") != "" { pr...
go
func allowCORS(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if origin := r.Header.Get("Origin"); origin != "" { w.Header().Set("Access-Control-Allow-Origin", origin) if r.Method == "OPTIONS" && r.Header.Get("Access-Control-Request-Method") != "" { pr...
[ "func", "allowCORS", "(", "h", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "origin", ":="...
// allowCORS allows Cross Origin Resoruce Sharing from any origin. // Don't do this without consideration in production systems.
[ "allowCORS", "allows", "Cross", "Origin", "Resoruce", "Sharing", "from", "any", "origin", ".", "Don", "t", "do", "this", "without", "consideration", "in", "production", "systems", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/gateway/handlers.go#L32-L43
133,869
grpc-ecosystem/grpc-gateway
examples/gateway/handlers.go
preflightHandler
func preflightHandler(w http.ResponseWriter, r *http.Request) { headers := []string{"Content-Type", "Accept"} w.Header().Set("Access-Control-Allow-Headers", strings.Join(headers, ",")) methods := []string{"GET", "HEAD", "POST", "PUT", "DELETE"} w.Header().Set("Access-Control-Allow-Methods", strings.Join(methods, ",...
go
func preflightHandler(w http.ResponseWriter, r *http.Request) { headers := []string{"Content-Type", "Accept"} w.Header().Set("Access-Control-Allow-Headers", strings.Join(headers, ",")) methods := []string{"GET", "HEAD", "POST", "PUT", "DELETE"} w.Header().Set("Access-Control-Allow-Methods", strings.Join(methods, ",...
[ "func", "preflightHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "headers", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(",...
// preflightHandler adds the necessary headers in order to serve // CORS from any origin using the methods "GET", "HEAD", "POST", "PUT", "DELETE" // We insist, don't do this without consideration in production systems.
[ "preflightHandler", "adds", "the", "necessary", "headers", "in", "order", "to", "serve", "CORS", "from", "any", "origin", "using", "the", "methods", "GET", "HEAD", "POST", "PUT", "DELETE", "We", "insist", "don", "t", "do", "this", "without", "consideration", ...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/gateway/handlers.go#L48-L54
133,870
grpc-ecosystem/grpc-gateway
examples/gateway/handlers.go
healthzServer
func healthzServer(conn *grpc.ClientConn) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") if s := conn.GetState(); s != connectivity.Ready { http.Error(w, fmt.Sprintf("grpc server is %s", s), http.StatusBadGateway) return } fmt.Fprintl...
go
func healthzServer(conn *grpc.ClientConn) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") if s := conn.GetState(); s != connectivity.Ready { http.Error(w, fmt.Sprintf("grpc server is %s", s), http.StatusBadGateway) return } fmt.Fprintl...
[ "func", "healthzServer", "(", "conn", "*", "grpc", ".", "ClientConn", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "w", ".", "Header", "(", ")", ".",...
// healthzServer returns a simple health handler which returns ok.
[ "healthzServer", "returns", "a", "simple", "health", "handler", "which", "returns", "ok", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/gateway/handlers.go#L57-L66
133,871
grpc-ecosystem/grpc-gateway
runtime/query.go
PopulateQueryParameters
func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { for key, values := range values { re, err := regexp.Compile("^(.*)\\[(.*)\\]$") if err != nil { return err } match := re.FindStringSubmatch(key) if len(match) == 3 { key = match[1] values = appe...
go
func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { for key, values := range values { re, err := regexp.Compile("^(.*)\\[(.*)\\]$") if err != nil { return err } match := re.FindStringSubmatch(key) if len(match) == 3 { key = match[1] values = appe...
[ "func", "PopulateQueryParameters", "(", "msg", "proto", ".", "Message", ",", "values", "url", ".", "Values", ",", "filter", "*", "utilities", ".", "DoubleArray", ")", "error", "{", "for", "key", ",", "values", ":=", "range", "values", "{", "re", ",", "er...
// PopulateQueryParameters populates "values" into "msg". // A value is ignored if its key starts with one of the elements in "filter".
[ "PopulateQueryParameters", "populates", "values", "into", "msg", ".", "A", "value", "is", "ignored", "if", "its", "key", "starts", "with", "one", "of", "the", "elements", "in", "filter", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/query.go#L20-L40
133,872
grpc-ecosystem/grpc-gateway
runtime/query.go
PopulateFieldFromPath
func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value string) error { fieldPath := strings.Split(fieldPathString, ".") return populateFieldValueFromPath(msg, fieldPath, []string{value}) }
go
func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value string) error { fieldPath := strings.Split(fieldPathString, ".") return populateFieldValueFromPath(msg, fieldPath, []string{value}) }
[ "func", "PopulateFieldFromPath", "(", "msg", "proto", ".", "Message", ",", "fieldPathString", "string", ",", "value", "string", ")", "error", "{", "fieldPath", ":=", "strings", ".", "Split", "(", "fieldPathString", ",", "\"", "\"", ")", "\n", "return", "popu...
// PopulateFieldFromPath sets a value in a nested Protobuf structure. // It instantiates missing protobuf fields as it goes.
[ "PopulateFieldFromPath", "sets", "a", "value", "in", "a", "nested", "Protobuf", "structure", ".", "It", "instantiates", "missing", "protobuf", "fields", "as", "it", "goes", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/query.go#L44-L47
133,873
grpc-ecosystem/grpc-gateway
runtime/query.go
fieldByProtoName
func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Properties, error) { props := proto.GetProperties(m.Type()) // look up field name in oneof map if op, ok := props.OneofTypes[name]; ok { v := reflect.New(op.Type.Elem()) field := m.Field(op.Field) if !field.IsNil() { return reflect....
go
func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Properties, error) { props := proto.GetProperties(m.Type()) // look up field name in oneof map if op, ok := props.OneofTypes[name]; ok { v := reflect.New(op.Type.Elem()) field := m.Field(op.Field) if !field.IsNil() { return reflect....
[ "func", "fieldByProtoName", "(", "m", "reflect", ".", "Value", ",", "name", "string", ")", "(", "reflect", ".", "Value", ",", "*", "proto", ".", "Properties", ",", "error", ")", "{", "props", ":=", "proto", ".", "GetProperties", "(", "m", ".", "Type", ...
// fieldByProtoName looks up a field whose corresponding protobuf field name is "name". // "m" must be a struct value. It returns zero reflect.Value if no such field found.
[ "fieldByProtoName", "looks", "up", "a", "field", "whose", "corresponding", "protobuf", "field", "name", "is", "name", ".", "m", "must", "be", "a", "struct", "value", ".", "It", "returns", "zero", "reflect", ".", "Value", "if", "no", "such", "field", "found...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/query.go#L118-L141
133,874
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/generator.go
encodeSwagger
func encodeSwagger(file *wrapper) (*plugin.CodeGeneratorResponse_File, error) { var formatted bytes.Buffer enc := json.NewEncoder(&formatted) enc.SetIndent("", " ") if err := enc.Encode(*file.swagger); err != nil { return nil, err } name := file.fileName ext := filepath.Ext(name) base := strings.TrimSuffix(n...
go
func encodeSwagger(file *wrapper) (*plugin.CodeGeneratorResponse_File, error) { var formatted bytes.Buffer enc := json.NewEncoder(&formatted) enc.SetIndent("", " ") if err := enc.Encode(*file.swagger); err != nil { return nil, err } name := file.fileName ext := filepath.Ext(name) base := strings.TrimSuffix(n...
[ "func", "encodeSwagger", "(", "file", "*", "wrapper", ")", "(", "*", "plugin", ".", "CodeGeneratorResponse_File", ",", "error", ")", "{", "var", "formatted", "bytes", ".", "Buffer", "\n", "enc", ":=", "json", ".", "NewEncoder", "(", "&", "formatted", ")", ...
// convert swagger file obj to plugin.CodeGeneratorResponse_File
[ "convert", "swagger", "file", "obj", "to", "plugin", ".", "CodeGeneratorResponse_File" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/generator.go#L70-L85
133,875
grpc-ecosystem/grpc-gateway
protoc-gen-swagger/genswagger/generator.go
AddStreamError
func AddStreamError(reg *descriptor.Registry) error { //load internal protos any := fileDescriptorProtoForMessage(&any.Any{}) streamError := fileDescriptorProtoForMessage(&internal.StreamError{}) if err := reg.Load(&plugin.CodeGeneratorRequest{ ProtoFile: []*protocdescriptor.FileDescriptorProto{ any, stream...
go
func AddStreamError(reg *descriptor.Registry) error { //load internal protos any := fileDescriptorProtoForMessage(&any.Any{}) streamError := fileDescriptorProtoForMessage(&internal.StreamError{}) if err := reg.Load(&plugin.CodeGeneratorRequest{ ProtoFile: []*protocdescriptor.FileDescriptorProto{ any, stream...
[ "func", "AddStreamError", "(", "reg", "*", "descriptor", ".", "Registry", ")", "error", "{", "//load internal protos", "any", ":=", "fileDescriptorProtoForMessage", "(", "&", "any", ".", "Any", "{", "}", ")", "\n", "streamError", ":=", "fileDescriptorProtoForMessa...
//AddStreamError Adds grpc.gateway.runtime.StreamError and google.protobuf.Any to registry for stream responses
[ "AddStreamError", "Adds", "grpc", ".", "gateway", ".", "runtime", ".", "StreamError", "and", "google", ".", "protobuf", ".", "Any", "to", "registry", "for", "stream", "responses" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/protoc-gen-swagger/genswagger/generator.go#L152-L165
133,876
grpc-ecosystem/grpc-gateway
examples/proto/examplepb/flow_combination.pb.gw.go
RegisterFlowCombinationHandler
func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterFlowCombinationHandlerClient(ctx, mux, NewFlowCombinationClient(conn)) }
go
func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterFlowCombinationHandlerClient(ctx, mux, NewFlowCombinationClient(conn)) }
[ "func", "RegisterFlowCombinationHandler", "(", "ctx", "context", ".", "Context", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "error", "{", "return", "RegisterFlowCombinationHandlerClient", "(", "ctx", ",", "mux"...
// RegisterFlowCombinationHandler registers the http handlers for service FlowCombination to "mux". // The handlers forward requests to the grpc endpoint over "conn".
[ "RegisterFlowCombinationHandler", "registers", "the", "http", "handlers", "for", "service", "FlowCombination", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "conn", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/proto/examplepb/flow_combination.pb.gw.go#L1063-L1065
133,877
grpc-ecosystem/grpc-gateway
runtime/pattern.go
NewPattern
func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, error) { if version != 1 { grpclog.Infof("unsupported version: %d", version) return Pattern{}, ErrInvalidPattern } l := len(ops) if l%2 != 0 { grpclog.Infof("odd number of ops codes: %d", l) return Pattern{}, ErrInvalidPattern }...
go
func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, error) { if version != 1 { grpclog.Infof("unsupported version: %d", version) return Pattern{}, ErrInvalidPattern } l := len(ops) if l%2 != 0 { grpclog.Infof("odd number of ops codes: %d", l) return Pattern{}, ErrInvalidPattern }...
[ "func", "NewPattern", "(", "version", "int", ",", "ops", "[", "]", "int", ",", "pool", "[", "]", "string", ",", "verb", "string", ")", "(", "Pattern", ",", "error", ")", "{", "if", "version", "!=", "1", "{", "grpclog", ".", "Infof", "(", "\"", "\...
// NewPattern returns a new Pattern from the given definition values. // "ops" is a sequence of op codes. "pool" is a constant pool. // "verb" is the verb part of the pattern. It is empty if the pattern does not have the part. // "version" must be 1 for now. // It returns an error if the given definition is invalid.
[ "NewPattern", "returns", "a", "new", "Pattern", "from", "the", "given", "definition", "values", ".", "ops", "is", "a", "sequence", "of", "op", "codes", ".", "pool", "is", "a", "constant", "pool", ".", "verb", "is", "the", "verb", "part", "of", "the", "...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/pattern.go#L45-L132
133,878
grpc-ecosystem/grpc-gateway
runtime/pattern.go
MustPattern
func MustPattern(p Pattern, err error) Pattern { if err != nil { grpclog.Fatalf("Pattern initialization failed: %v", err) } return p }
go
func MustPattern(p Pattern, err error) Pattern { if err != nil { grpclog.Fatalf("Pattern initialization failed: %v", err) } return p }
[ "func", "MustPattern", "(", "p", "Pattern", ",", "err", "error", ")", "Pattern", "{", "if", "err", "!=", "nil", "{", "grpclog", ".", "Fatalf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "p", "\n", "}" ]
// MustPattern is a helper function which makes it easier to call NewPattern in variable initialization.
[ "MustPattern", "is", "a", "helper", "function", "which", "makes", "it", "easier", "to", "call", "NewPattern", "in", "variable", "initialization", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/pattern.go#L135-L140
133,879
grpc-ecosystem/grpc-gateway
runtime/pattern.go
Match
func (p Pattern) Match(components []string, verb string) (map[string]string, error) { if p.verb != verb { return nil, ErrNotMatch } var pos int stack := make([]string, 0, p.stacksize) captured := make([]string, len(p.vars)) l := len(components) for _, op := range p.ops { switch op.code { case utilities.Op...
go
func (p Pattern) Match(components []string, verb string) (map[string]string, error) { if p.verb != verb { return nil, ErrNotMatch } var pos int stack := make([]string, 0, p.stacksize) captured := make([]string, len(p.vars)) l := len(components) for _, op := range p.ops { switch op.code { case utilities.Op...
[ "func", "(", "p", "Pattern", ")", "Match", "(", "components", "[", "]", "string", ",", "verb", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "if", "p", ".", "verb", "!=", "verb", "{", "return", "nil", ",", "ErrN...
// Match examines components if it matches to the Pattern. // If it matches, the function returns a mapping from field paths to their captured values. // If otherwise, the function returns an error.
[ "Match", "examines", "components", "if", "it", "matches", "to", "the", "Pattern", ".", "If", "it", "matches", "the", "function", "returns", "a", "mapping", "from", "field", "paths", "to", "their", "captured", "values", ".", "If", "otherwise", "the", "functio...
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/pattern.go#L145-L196
133,880
grpc-ecosystem/grpc-gateway
examples/clients/echo/echo_service_api.go
Echo
func (a EchoServiceApi) Echo(id string) (*ExamplepbSimpleMessage, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", ...
go
func (a EchoServiceApi) Echo(id string) (*ExamplepbSimpleMessage, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", ...
[ "func", "(", "a", "EchoServiceApi", ")", "Echo", "(", "id", "string", ")", "(", "*", "ExamplepbSimpleMessage", ",", "*", "APIResponse", ",", "error", ")", "{", "var", "localVarHttpMethod", "=", "strings", ".", "ToUpper", "(", "\"", "\"", ")", "\n", "// c...
/** * Echo method receives a simple message and returns it. * The message posted as the id parameter will also be returned. * * @param id Id represents the message identifier. * @return *ExamplepbSimpleMessage */
[ "Echo", "method", "receives", "a", "simple", "message", "and", "returns", "it", ".", "The", "message", "posted", "as", "the", "id", "parameter", "will", "also", "be", "returned", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/clients/echo/echo_service_api.go#L47-L99
133,881
grpc-ecosystem/grpc-gateway
runtime/marshal_json.go
Unmarshal
func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { return json.Unmarshal(data, v) }
go
func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { return json.Unmarshal(data, v) }
[ "func", "(", "j", "*", "JSONBuiltin", ")", "Unmarshal", "(", "data", "[", "]", "byte", ",", "v", "interface", "{", "}", ")", "error", "{", "return", "json", ".", "Unmarshal", "(", "data", ",", "v", ")", "\n", "}" ]
// Unmarshal unmarshals JSON data into "v".
[ "Unmarshal", "unmarshals", "JSON", "data", "into", "v", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/marshal_json.go#L28-L30
133,882
grpc-ecosystem/grpc-gateway
runtime/marshal_proto.go
Marshal
func (*ProtoMarshaller) Marshal(value interface{}) ([]byte, error) { message, ok := value.(proto.Message) if !ok { return nil, errors.New("unable to marshal non proto field") } return proto.Marshal(message) }
go
func (*ProtoMarshaller) Marshal(value interface{}) ([]byte, error) { message, ok := value.(proto.Message) if !ok { return nil, errors.New("unable to marshal non proto field") } return proto.Marshal(message) }
[ "func", "(", "*", "ProtoMarshaller", ")", "Marshal", "(", "value", "interface", "{", "}", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "message", ",", "ok", ":=", "value", ".", "(", "proto", ".", "Message", ")", "\n", "if", "!", "ok", "{",...
// Marshal marshals "value" into Proto
[ "Marshal", "marshals", "value", "into", "Proto" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/marshal_proto.go#L20-L26
133,883
grpc-ecosystem/grpc-gateway
runtime/marshal_proto.go
Unmarshal
func (*ProtoMarshaller) Unmarshal(data []byte, value interface{}) error { message, ok := value.(proto.Message) if !ok { return errors.New("unable to unmarshal non proto field") } return proto.Unmarshal(data, message) }
go
func (*ProtoMarshaller) Unmarshal(data []byte, value interface{}) error { message, ok := value.(proto.Message) if !ok { return errors.New("unable to unmarshal non proto field") } return proto.Unmarshal(data, message) }
[ "func", "(", "*", "ProtoMarshaller", ")", "Unmarshal", "(", "data", "[", "]", "byte", ",", "value", "interface", "{", "}", ")", "error", "{", "message", ",", "ok", ":=", "value", ".", "(", "proto", ".", "Message", ")", "\n", "if", "!", "ok", "{", ...
// Unmarshal unmarshals proto "data" into "value"
[ "Unmarshal", "unmarshals", "proto", "data", "into", "value" ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/marshal_proto.go#L29-L35
133,884
grpc-ecosystem/grpc-gateway
runtime/proto2_convert.go
BoolP
func BoolP(val string) (*bool, error) { b, err := Bool(val) if err != nil { return nil, err } return proto.Bool(b), nil }
go
func BoolP(val string) (*bool, error) { b, err := Bool(val) if err != nil { return nil, err } return proto.Bool(b), nil }
[ "func", "BoolP", "(", "val", "string", ")", "(", "*", "bool", ",", "error", ")", "{", "b", ",", "err", ":=", "Bool", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "proto", ".", "...
// BoolP parses the given string representation of a boolean value, // and returns a pointer to a bool whose value is same as the parsed value.
[ "BoolP", "parses", "the", "given", "string", "representation", "of", "a", "boolean", "value", "and", "returns", "a", "pointer", "to", "a", "bool", "whose", "value", "is", "same", "as", "the", "parsed", "value", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/proto2_convert.go#L14-L20
133,885
grpc-ecosystem/grpc-gateway
runtime/proto2_convert.go
Float64P
func Float64P(val string) (*float64, error) { f, err := Float64(val) if err != nil { return nil, err } return proto.Float64(f), nil }
go
func Float64P(val string) (*float64, error) { f, err := Float64(val) if err != nil { return nil, err } return proto.Float64(f), nil }
[ "func", "Float64P", "(", "val", "string", ")", "(", "*", "float64", ",", "error", ")", "{", "f", ",", "err", ":=", "Float64", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "proto", ...
// Float64P parses the given string representation of a floating point number, // and returns a pointer to a float64 whose value is same as the parsed number.
[ "Float64P", "parses", "the", "given", "string", "representation", "of", "a", "floating", "point", "number", "and", "returns", "a", "pointer", "to", "a", "float64", "whose", "value", "is", "same", "as", "the", "parsed", "number", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/proto2_convert.go#L24-L30
133,886
grpc-ecosystem/grpc-gateway
runtime/proto2_convert.go
Float32P
func Float32P(val string) (*float32, error) { f, err := Float32(val) if err != nil { return nil, err } return proto.Float32(f), nil }
go
func Float32P(val string) (*float32, error) { f, err := Float32(val) if err != nil { return nil, err } return proto.Float32(f), nil }
[ "func", "Float32P", "(", "val", "string", ")", "(", "*", "float32", ",", "error", ")", "{", "f", ",", "err", ":=", "Float32", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "proto", ...
// Float32P parses the given string representation of a floating point number, // and returns a pointer to a float32 whose value is same as the parsed number.
[ "Float32P", "parses", "the", "given", "string", "representation", "of", "a", "floating", "point", "number", "and", "returns", "a", "pointer", "to", "a", "float32", "whose", "value", "is", "same", "as", "the", "parsed", "number", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/proto2_convert.go#L34-L40
133,887
grpc-ecosystem/grpc-gateway
runtime/proto2_convert.go
Int64P
func Int64P(val string) (*int64, error) { i, err := Int64(val) if err != nil { return nil, err } return proto.Int64(i), nil }
go
func Int64P(val string) (*int64, error) { i, err := Int64(val) if err != nil { return nil, err } return proto.Int64(i), nil }
[ "func", "Int64P", "(", "val", "string", ")", "(", "*", "int64", ",", "error", ")", "{", "i", ",", "err", ":=", "Int64", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "proto", ".", ...
// Int64P parses the given string representation of an integer // and returns a pointer to a int64 whose value is same as the parsed integer.
[ "Int64P", "parses", "the", "given", "string", "representation", "of", "an", "integer", "and", "returns", "a", "pointer", "to", "a", "int64", "whose", "value", "is", "same", "as", "the", "parsed", "integer", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/proto2_convert.go#L44-L50
133,888
grpc-ecosystem/grpc-gateway
runtime/proto2_convert.go
Int32P
func Int32P(val string) (*int32, error) { i, err := Int32(val) if err != nil { return nil, err } return proto.Int32(i), err }
go
func Int32P(val string) (*int32, error) { i, err := Int32(val) if err != nil { return nil, err } return proto.Int32(i), err }
[ "func", "Int32P", "(", "val", "string", ")", "(", "*", "int32", ",", "error", ")", "{", "i", ",", "err", ":=", "Int32", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "proto", ".", ...
// Int32P parses the given string representation of an integer // and returns a pointer to a int32 whose value is same as the parsed integer.
[ "Int32P", "parses", "the", "given", "string", "representation", "of", "an", "integer", "and", "returns", "a", "pointer", "to", "a", "int32", "whose", "value", "is", "same", "as", "the", "parsed", "integer", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/proto2_convert.go#L54-L60
133,889
grpc-ecosystem/grpc-gateway
runtime/proto2_convert.go
Uint64P
func Uint64P(val string) (*uint64, error) { i, err := Uint64(val) if err != nil { return nil, err } return proto.Uint64(i), err }
go
func Uint64P(val string) (*uint64, error) { i, err := Uint64(val) if err != nil { return nil, err } return proto.Uint64(i), err }
[ "func", "Uint64P", "(", "val", "string", ")", "(", "*", "uint64", ",", "error", ")", "{", "i", ",", "err", ":=", "Uint64", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "proto", "....
// Uint64P parses the given string representation of an integer // and returns a pointer to a uint64 whose value is same as the parsed integer.
[ "Uint64P", "parses", "the", "given", "string", "representation", "of", "an", "integer", "and", "returns", "a", "pointer", "to", "a", "uint64", "whose", "value", "is", "same", "as", "the", "parsed", "integer", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/proto2_convert.go#L64-L70
133,890
grpc-ecosystem/grpc-gateway
runtime/proto2_convert.go
Uint32P
func Uint32P(val string) (*uint32, error) { i, err := Uint32(val) if err != nil { return nil, err } return proto.Uint32(i), err }
go
func Uint32P(val string) (*uint32, error) { i, err := Uint32(val) if err != nil { return nil, err } return proto.Uint32(i), err }
[ "func", "Uint32P", "(", "val", "string", ")", "(", "*", "uint32", ",", "error", ")", "{", "i", ",", "err", ":=", "Uint32", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "proto", "....
// Uint32P parses the given string representation of an integer // and returns a pointer to a uint32 whose value is same as the parsed integer.
[ "Uint32P", "parses", "the", "given", "string", "representation", "of", "an", "integer", "and", "returns", "a", "pointer", "to", "a", "uint32", "whose", "value", "is", "same", "as", "the", "parsed", "integer", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/proto2_convert.go#L74-L80
133,891
grpc-ecosystem/grpc-gateway
examples/proto/examplepb/unannotated_echo_service.pb.gw.go
RegisterUnannotatedEchoServiceHandler
func RegisterUnannotatedEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterUnannotatedEchoServiceHandlerClient(ctx, mux, NewUnannotatedEchoServiceClient(conn)) }
go
func RegisterUnannotatedEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { return RegisterUnannotatedEchoServiceHandlerClient(ctx, mux, NewUnannotatedEchoServiceClient(conn)) }
[ "func", "RegisterUnannotatedEchoServiceHandler", "(", "ctx", "context", ".", "Context", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "error", "{", "return", "RegisterUnannotatedEchoServiceHandlerClient", "(", "ctx", ...
// RegisterUnannotatedEchoServiceHandler registers the http handlers for service UnannotatedEchoService to "mux". // The handlers forward requests to the grpc endpoint over "conn".
[ "RegisterUnannotatedEchoServiceHandler", "registers", "the", "http", "handlers", "for", "service", "UnannotatedEchoService", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "conn", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/examples/proto/examplepb/unannotated_echo_service.pb.gw.go#L173-L175
133,892
grpc-ecosystem/grpc-gateway
runtime/handler.go
ForwardResponseStream
func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { f, ok := w.(http.Flusher) if !ok { grpclog.Infof("Flush not supported in %T", w...
go
func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { f, ok := w.(http.Flusher) if !ok { grpclog.Infof("Flush not supported in %T", w...
[ "func", "ForwardResponseStream", "(", "ctx", "context", ".", "Context", ",", "mux", "*", "ServeMux", ",", "marshaler", "Marshaler", ",", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "recv", "func", "(", ")", "(", "pro...
// ForwardResponseStream forwards the stream from gRPC server to REST client.
[ "ForwardResponseStream", "forwards", "the", "stream", "from", "gRPC", "server", "to", "REST", "client", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/handler.go#L19-L81
133,893
grpc-ecosystem/grpc-gateway
runtime/handler.go
ForwardResponseMessage
func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { md, ok := ServerMetadataFromContext(ctx) if !ok { grpclog.Infof("Failed to extract ServerMetad...
go
func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { md, ok := ServerMetadataFromContext(ctx) if !ok { grpclog.Infof("Failed to extract ServerMetad...
[ "func", "ForwardResponseMessage", "(", "ctx", "context", ".", "Context", ",", "mux", "*", "ServeMux", ",", "marshaler", "Marshaler", ",", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "resp", "proto", ".", "Message", ","...
// ForwardResponseMessage forwards the message "resp" from gRPC server to REST client.
[ "ForwardResponseMessage", "forwards", "the", "message", "resp", "from", "gRPC", "server", "to", "REST", "client", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/handler.go#L116-L156
133,894
grpc-ecosystem/grpc-gateway
runtime/convert.go
StringSlice
func StringSlice(val, sep string) ([]string, error) { return strings.Split(val, sep), nil }
go
func StringSlice(val, sep string) ([]string, error) { return strings.Split(val, sep), nil }
[ "func", "StringSlice", "(", "val", ",", "sep", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "strings", ".", "Split", "(", "val", ",", "sep", ")", ",", "nil", "\n", "}" ]
// StringSlice converts 'val' where individual strings are separated by // 'sep' into a string slice.
[ "StringSlice", "converts", "val", "where", "individual", "strings", "are", "separated", "by", "sep", "into", "a", "string", "slice", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/convert.go#L23-L25
133,895
grpc-ecosystem/grpc-gateway
runtime/convert.go
BoolSlice
func BoolSlice(val, sep string) ([]bool, error) { s := strings.Split(val, sep) values := make([]bool, len(s)) for i, v := range s { value, err := Bool(v) if err != nil { return values, err } values[i] = value } return values, nil }
go
func BoolSlice(val, sep string) ([]bool, error) { s := strings.Split(val, sep) values := make([]bool, len(s)) for i, v := range s { value, err := Bool(v) if err != nil { return values, err } values[i] = value } return values, nil }
[ "func", "BoolSlice", "(", "val", ",", "sep", "string", ")", "(", "[", "]", "bool", ",", "error", ")", "{", "s", ":=", "strings", ".", "Split", "(", "val", ",", "sep", ")", "\n", "values", ":=", "make", "(", "[", "]", "bool", ",", "len", "(", ...
// BoolSlice converts 'val' where individual booleans are separated by // 'sep' into a bool slice.
[ "BoolSlice", "converts", "val", "where", "individual", "booleans", "are", "separated", "by", "sep", "into", "a", "bool", "slice", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/convert.go#L34-L45
133,896
grpc-ecosystem/grpc-gateway
runtime/convert.go
Float64Slice
func Float64Slice(val, sep string) ([]float64, error) { s := strings.Split(val, sep) values := make([]float64, len(s)) for i, v := range s { value, err := Float64(v) if err != nil { return values, err } values[i] = value } return values, nil }
go
func Float64Slice(val, sep string) ([]float64, error) { s := strings.Split(val, sep) values := make([]float64, len(s)) for i, v := range s { value, err := Float64(v) if err != nil { return values, err } values[i] = value } return values, nil }
[ "func", "Float64Slice", "(", "val", ",", "sep", "string", ")", "(", "[", "]", "float64", ",", "error", ")", "{", "s", ":=", "strings", ".", "Split", "(", "val", ",", "sep", ")", "\n", "values", ":=", "make", "(", "[", "]", "float64", ",", "len", ...
// Float64Slice converts 'val' where individual floating point numbers are separated by // 'sep' into a float64 slice.
[ "Float64Slice", "converts", "val", "where", "individual", "floating", "point", "numbers", "are", "separated", "by", "sep", "into", "a", "float64", "slice", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/convert.go#L54-L65
133,897
grpc-ecosystem/grpc-gateway
runtime/convert.go
Float32
func Float32(val string) (float32, error) { f, err := strconv.ParseFloat(val, 32) if err != nil { return 0, err } return float32(f), nil }
go
func Float32(val string) (float32, error) { f, err := strconv.ParseFloat(val, 32) if err != nil { return 0, err } return float32(f), nil }
[ "func", "Float32", "(", "val", "string", ")", "(", "float32", ",", "error", ")", "{", "f", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "val", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\...
// Float32 converts the given string representation of a floating point number into float32.
[ "Float32", "converts", "the", "given", "string", "representation", "of", "a", "floating", "point", "number", "into", "float32", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/convert.go#L68-L74
133,898
grpc-ecosystem/grpc-gateway
runtime/convert.go
Float32Slice
func Float32Slice(val, sep string) ([]float32, error) { s := strings.Split(val, sep) values := make([]float32, len(s)) for i, v := range s { value, err := Float32(v) if err != nil { return values, err } values[i] = value } return values, nil }
go
func Float32Slice(val, sep string) ([]float32, error) { s := strings.Split(val, sep) values := make([]float32, len(s)) for i, v := range s { value, err := Float32(v) if err != nil { return values, err } values[i] = value } return values, nil }
[ "func", "Float32Slice", "(", "val", ",", "sep", "string", ")", "(", "[", "]", "float32", ",", "error", ")", "{", "s", ":=", "strings", ".", "Split", "(", "val", ",", "sep", ")", "\n", "values", ":=", "make", "(", "[", "]", "float32", ",", "len", ...
// Float32Slice converts 'val' where individual floating point numbers are separated by // 'sep' into a float32 slice.
[ "Float32Slice", "converts", "val", "where", "individual", "floating", "point", "numbers", "are", "separated", "by", "sep", "into", "a", "float32", "slice", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/convert.go#L78-L89
133,899
grpc-ecosystem/grpc-gateway
runtime/convert.go
Int64Slice
func Int64Slice(val, sep string) ([]int64, error) { s := strings.Split(val, sep) values := make([]int64, len(s)) for i, v := range s { value, err := Int64(v) if err != nil { return values, err } values[i] = value } return values, nil }
go
func Int64Slice(val, sep string) ([]int64, error) { s := strings.Split(val, sep) values := make([]int64, len(s)) for i, v := range s { value, err := Int64(v) if err != nil { return values, err } values[i] = value } return values, nil }
[ "func", "Int64Slice", "(", "val", ",", "sep", "string", ")", "(", "[", "]", "int64", ",", "error", ")", "{", "s", ":=", "strings", ".", "Split", "(", "val", ",", "sep", ")", "\n", "values", ":=", "make", "(", "[", "]", "int64", ",", "len", "(",...
// Int64Slice converts 'val' where individual integers are separated by // 'sep' into a int64 slice.
[ "Int64Slice", "converts", "val", "where", "individual", "integers", "are", "separated", "by", "sep", "into", "a", "int64", "slice", "." ]
52a539ec166cf7380660e9c7ebde5206169d385d
https://github.com/grpc-ecosystem/grpc-gateway/blob/52a539ec166cf7380660e9c7ebde5206169d385d/runtime/convert.go#L98-L109