id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
17,500
thriftrw/thriftrw-go
gen/equals.go
Equals
func (e *equalsGenerator) Equals(g Generator, spec compile.TypeSpec, lhs, rhs string) (string, error) { if isPrimitiveType(spec) { if _, isEnum := spec.(*compile.EnumSpec); !isEnum { return fmt.Sprintf("(%s == %s)", lhs, rhs), nil } } switch s := spec.(type) { case *compile.BinarySpec: bytes := g.Import("bytes") return fmt.Sprintf("%s.Equal(%s, %s)", bytes, lhs, rhs), nil case *compile.MapSpec: equals, err := e.mapG.Equals(g, s) return fmt.Sprintf("%s(%s, %s)", equals, lhs, rhs), err case *compile.ListSpec: equals, err := e.listG.Equals(g, s) return fmt.Sprintf("%s(%s, %s)", equals, lhs, rhs), err case *compile.SetSpec: equals, err := e.setG.Equals(g, s) return fmt.Sprintf("%s(%s, %s)", equals, lhs, rhs), err default: // Custom defined type return fmt.Sprintf("%s.Equals(%s)", lhs, rhs), nil } }
go
func (e *equalsGenerator) Equals(g Generator, spec compile.TypeSpec, lhs, rhs string) (string, error) { if isPrimitiveType(spec) { if _, isEnum := spec.(*compile.EnumSpec); !isEnum { return fmt.Sprintf("(%s == %s)", lhs, rhs), nil } } switch s := spec.(type) { case *compile.BinarySpec: bytes := g.Import("bytes") return fmt.Sprintf("%s.Equal(%s, %s)", bytes, lhs, rhs), nil case *compile.MapSpec: equals, err := e.mapG.Equals(g, s) return fmt.Sprintf("%s(%s, %s)", equals, lhs, rhs), err case *compile.ListSpec: equals, err := e.listG.Equals(g, s) return fmt.Sprintf("%s(%s, %s)", equals, lhs, rhs), err case *compile.SetSpec: equals, err := e.setG.Equals(g, s) return fmt.Sprintf("%s(%s, %s)", equals, lhs, rhs), err default: // Custom defined type return fmt.Sprintf("%s.Equals(%s)", lhs, rhs), nil } }
[ "func", "(", "e", "*", "equalsGenerator", ")", "Equals", "(", "g", "Generator", ",", "spec", "compile", ".", "TypeSpec", ",", "lhs", ",", "rhs", "string", ")", "(", "string", ",", "error", ")", "{", "if", "isPrimitiveType", "(", "spec", ")", "{", "if", "_", ",", "isEnum", ":=", "spec", ".", "(", "*", "compile", ".", "EnumSpec", ")", ";", "!", "isEnum", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "lhs", ",", "rhs", ")", ",", "nil", "\n", "}", "\n", "}", "\n\n", "switch", "s", ":=", "spec", ".", "(", "type", ")", "{", "case", "*", "compile", ".", "BinarySpec", ":", "bytes", ":=", "g", ".", "Import", "(", "\"", "\"", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "bytes", ",", "lhs", ",", "rhs", ")", ",", "nil", "\n", "case", "*", "compile", ".", "MapSpec", ":", "equals", ",", "err", ":=", "e", ".", "mapG", ".", "Equals", "(", "g", ",", "s", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "equals", ",", "lhs", ",", "rhs", ")", ",", "err", "\n", "case", "*", "compile", ".", "ListSpec", ":", "equals", ",", "err", ":=", "e", ".", "listG", ".", "Equals", "(", "g", ",", "s", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "equals", ",", "lhs", ",", "rhs", ")", ",", "err", "\n", "case", "*", "compile", ".", "SetSpec", ":", "equals", ",", "err", ":=", "e", ".", "setG", ".", "Equals", "(", "g", ",", "s", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "equals", ",", "lhs", ",", "rhs", ")", ",", "err", "\n", "default", ":", "// Custom defined type", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "lhs", ",", "rhs", ")", ",", "nil", "\n", "}", "\n", "}" ]
// Equals generates a string comparing rhs to the given lhs. // Equals generates an expression of type bool.
[ "Equals", "generates", "a", "string", "comparing", "rhs", "to", "the", "given", "lhs", ".", "Equals", "generates", "an", "expression", "of", "type", "bool", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/equals.go#L39-L63
17,501
thriftrw/thriftrw-go
gen/equals.go
EqualsPtr
func (e *equalsGenerator) EqualsPtr(g Generator, spec compile.TypeSpec, lhs, rhs string) (string, error) { if !isPrimitiveType(spec) { // Everything else is a reference type that has a Equals method on it. return g.TextTemplate( `((<.LHS> == nil && <.RHS> == nil) || (<.LHS> != nil && <.RHS> != nil && <equals .Spec .LHS .RHS>))`, struct { Spec compile.TypeSpec LHS string RHS string }{Spec: spec, LHS: lhs, RHS: rhs}, ) } name := equalsPtrFuncName(g, spec) err := g.EnsureDeclared( ` <$type := typeReference .Spec> <$lhs := newVar "lhs"> <$rhs := newVar "rhs"> func <.Name>(<$lhs>, <$rhs> *<$type>) bool { <- $x := newVar "x" -> <- $y := newVar "y"> if <$lhs> != nil && <$rhs> != nil { // Call Equals method after dereferencing the pointers <$x> := *<$lhs> <$y> := *<$rhs> return <equals .Spec $x $y> } return <$lhs> == nil && <$rhs> == nil } `, struct { Name string Spec compile.TypeSpec }{Name: name, Spec: spec}, ) return fmt.Sprintf("%s(%s, %s)", name, lhs, rhs), err }
go
func (e *equalsGenerator) EqualsPtr(g Generator, spec compile.TypeSpec, lhs, rhs string) (string, error) { if !isPrimitiveType(spec) { // Everything else is a reference type that has a Equals method on it. return g.TextTemplate( `((<.LHS> == nil && <.RHS> == nil) || (<.LHS> != nil && <.RHS> != nil && <equals .Spec .LHS .RHS>))`, struct { Spec compile.TypeSpec LHS string RHS string }{Spec: spec, LHS: lhs, RHS: rhs}, ) } name := equalsPtrFuncName(g, spec) err := g.EnsureDeclared( ` <$type := typeReference .Spec> <$lhs := newVar "lhs"> <$rhs := newVar "rhs"> func <.Name>(<$lhs>, <$rhs> *<$type>) bool { <- $x := newVar "x" -> <- $y := newVar "y"> if <$lhs> != nil && <$rhs> != nil { // Call Equals method after dereferencing the pointers <$x> := *<$lhs> <$y> := *<$rhs> return <equals .Spec $x $y> } return <$lhs> == nil && <$rhs> == nil } `, struct { Name string Spec compile.TypeSpec }{Name: name, Spec: spec}, ) return fmt.Sprintf("%s(%s, %s)", name, lhs, rhs), err }
[ "func", "(", "e", "*", "equalsGenerator", ")", "EqualsPtr", "(", "g", "Generator", ",", "spec", "compile", ".", "TypeSpec", ",", "lhs", ",", "rhs", "string", ")", "(", "string", ",", "error", ")", "{", "if", "!", "isPrimitiveType", "(", "spec", ")", "{", "// Everything else is a reference type that has a Equals method on it.", "return", "g", ".", "TextTemplate", "(", "`((<.LHS> == nil && <.RHS> == nil) || (<.LHS> != nil && <.RHS> != nil && <equals .Spec .LHS .RHS>))`", ",", "struct", "{", "Spec", "compile", ".", "TypeSpec", "\n", "LHS", "string", "\n", "RHS", "string", "\n", "}", "{", "Spec", ":", "spec", ",", "LHS", ":", "lhs", ",", "RHS", ":", "rhs", "}", ",", ")", "\n", "}", "\n\n", "name", ":=", "equalsPtrFuncName", "(", "g", ",", "spec", ")", "\n", "err", ":=", "g", ".", "EnsureDeclared", "(", "`\n\t\t\t<$type := typeReference .Spec>\n\t\t\t<$lhs := newVar \"lhs\">\n\t\t\t<$rhs := newVar \"rhs\">\n\t\t\tfunc <.Name>(<$lhs>, <$rhs> *<$type>) bool {\n\t\t\t\t<- $x := newVar \"x\" ->\n\t\t\t\t<- $y := newVar \"y\">\n\t\t\t\tif <$lhs> != nil && <$rhs> != nil {\n\t\t\t\t\t// Call Equals method after dereferencing the pointers\n\t\t\t\t\t<$x> := *<$lhs>\n\t\t\t\t\t<$y> := *<$rhs>\n\t\t\t\t\treturn <equals .Spec $x $y>\n\t\t\t\t}\n\t\t\t\treturn <$lhs> == nil && <$rhs> == nil\n\t\t\t}\n\t\t`", ",", "struct", "{", "Name", "string", "\n", "Spec", "compile", ".", "TypeSpec", "\n", "}", "{", "Name", ":", "name", ",", "Spec", ":", "spec", "}", ",", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "lhs", ",", "rhs", ")", ",", "err", "\n", "}" ]
// EqualsPtr is the same as Equals except `lhs` and `rhs` are expected to be a // reference to a value of the given type.
[ "EqualsPtr", "is", "the", "same", "as", "Equals", "except", "lhs", "and", "rhs", "are", "expected", "to", "be", "a", "reference", "to", "a", "value", "of", "the", "given", "type", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/equals.go#L67-L104
17,502
thriftrw/thriftrw-go
internal/envelope/client.go
NewClient
func NewClient(p protocol.Protocol, t Transport) Client { return client{p: p, t: t} }
go
func NewClient(p protocol.Protocol, t Transport) Client { return client{p: p, t: t} }
[ "func", "NewClient", "(", "p", "protocol", ".", "Protocol", ",", "t", "Transport", ")", "Client", "{", "return", "client", "{", "p", ":", "p", ",", "t", ":", "t", "}", "\n", "}" ]
// NewClient builds a new client which sends requests over the given // transport, encoding them using the given protocol.
[ "NewClient", "builds", "a", "new", "client", "which", "sends", "requests", "over", "the", "given", "transport", "encoding", "them", "using", "the", "given", "protocol", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/internal/envelope/client.go#L47-L49
17,503
thriftrw/thriftrw-go
internal/envelope/client.go
Send
func (c client) Send(name string, reqValue wire.Value) (wire.Value, error) { reqEnvelope := wire.Envelope{ Name: name, Type: wire.Call, SeqID: 1, // don't care Value: reqValue, } // TODO(abg): We don't use or support out-of-order requests and responses // for plugin communaction so this should be fine for now but we may // eventually want to match responses to requests using seqID. var buff bytes.Buffer if err := c.p.EncodeEnveloped(reqEnvelope, &buff); err != nil { return wire.Value{}, err } resBody, err := c.t.Send(buff.Bytes()) if err != nil { return wire.Value{}, err } resEnvelope, err := c.p.DecodeEnveloped(bytes.NewReader(resBody)) if err != nil { return wire.Value{}, err } switch resEnvelope.Type { case wire.Exception: var exc exception.TApplicationException if err := exc.FromWire(resEnvelope.Value); err != nil { return wire.Value{}, err } return wire.Value{}, &exc case wire.Reply: return resEnvelope.Value, nil default: return wire.Value{}, errUnknownEnvelopeType(resEnvelope.Type) } }
go
func (c client) Send(name string, reqValue wire.Value) (wire.Value, error) { reqEnvelope := wire.Envelope{ Name: name, Type: wire.Call, SeqID: 1, // don't care Value: reqValue, } // TODO(abg): We don't use or support out-of-order requests and responses // for plugin communaction so this should be fine for now but we may // eventually want to match responses to requests using seqID. var buff bytes.Buffer if err := c.p.EncodeEnveloped(reqEnvelope, &buff); err != nil { return wire.Value{}, err } resBody, err := c.t.Send(buff.Bytes()) if err != nil { return wire.Value{}, err } resEnvelope, err := c.p.DecodeEnveloped(bytes.NewReader(resBody)) if err != nil { return wire.Value{}, err } switch resEnvelope.Type { case wire.Exception: var exc exception.TApplicationException if err := exc.FromWire(resEnvelope.Value); err != nil { return wire.Value{}, err } return wire.Value{}, &exc case wire.Reply: return resEnvelope.Value, nil default: return wire.Value{}, errUnknownEnvelopeType(resEnvelope.Type) } }
[ "func", "(", "c", "client", ")", "Send", "(", "name", "string", ",", "reqValue", "wire", ".", "Value", ")", "(", "wire", ".", "Value", ",", "error", ")", "{", "reqEnvelope", ":=", "wire", ".", "Envelope", "{", "Name", ":", "name", ",", "Type", ":", "wire", ".", "Call", ",", "SeqID", ":", "1", ",", "// don't care", "Value", ":", "reqValue", ",", "}", "\n\n", "// TODO(abg): We don't use or support out-of-order requests and responses", "// for plugin communaction so this should be fine for now but we may", "// eventually want to match responses to requests using seqID.", "var", "buff", "bytes", ".", "Buffer", "\n", "if", "err", ":=", "c", ".", "p", ".", "EncodeEnveloped", "(", "reqEnvelope", ",", "&", "buff", ")", ";", "err", "!=", "nil", "{", "return", "wire", ".", "Value", "{", "}", ",", "err", "\n", "}", "\n\n", "resBody", ",", "err", ":=", "c", ".", "t", ".", "Send", "(", "buff", ".", "Bytes", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "wire", ".", "Value", "{", "}", ",", "err", "\n", "}", "\n\n", "resEnvelope", ",", "err", ":=", "c", ".", "p", ".", "DecodeEnveloped", "(", "bytes", ".", "NewReader", "(", "resBody", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "wire", ".", "Value", "{", "}", ",", "err", "\n", "}", "\n\n", "switch", "resEnvelope", ".", "Type", "{", "case", "wire", ".", "Exception", ":", "var", "exc", "exception", ".", "TApplicationException", "\n", "if", "err", ":=", "exc", ".", "FromWire", "(", "resEnvelope", ".", "Value", ")", ";", "err", "!=", "nil", "{", "return", "wire", ".", "Value", "{", "}", ",", "err", "\n", "}", "\n", "return", "wire", ".", "Value", "{", "}", ",", "&", "exc", "\n\n", "case", "wire", ".", "Reply", ":", "return", "resEnvelope", ".", "Value", ",", "nil", "\n\n", "default", ":", "return", "wire", ".", "Value", "{", "}", ",", "errUnknownEnvelopeType", "(", "resEnvelope", ".", "Type", ")", "\n", "}", "\n", "}" ]
// Send sends the given request envelope over this transport.
[ "Send", "sends", "the", "given", "request", "envelope", "over", "this", "transport", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/internal/envelope/client.go#L57-L98
17,504
thriftrw/thriftrw-go
gen/constant.go
Constant
func Constant(g Generator, c *compile.Constant) error { err := g.DeclareFromTemplate( `<formatDoc .Doc><if canBeConstant .Type>const<else>var<end> <constantName .Name> <typeReference .Type> = <constantValue .Value .Type>`, c, TemplateFunc("constantValue", ConstantValue), TemplateFunc("canBeConstant", canBeConstant), TemplateFunc("constantName", constantName), ) return wrapGenerateError(c.Name, err) }
go
func Constant(g Generator, c *compile.Constant) error { err := g.DeclareFromTemplate( `<formatDoc .Doc><if canBeConstant .Type>const<else>var<end> <constantName .Name> <typeReference .Type> = <constantValue .Value .Type>`, c, TemplateFunc("constantValue", ConstantValue), TemplateFunc("canBeConstant", canBeConstant), TemplateFunc("constantName", constantName), ) return wrapGenerateError(c.Name, err) }
[ "func", "Constant", "(", "g", "Generator", ",", "c", "*", "compile", ".", "Constant", ")", "error", "{", "err", ":=", "g", ".", "DeclareFromTemplate", "(", "`<formatDoc .Doc><if canBeConstant .Type>const<else>var<end> <constantName .Name> <typeReference .Type> = <constantValue .Value .Type>`", ",", "c", ",", "TemplateFunc", "(", "\"", "\"", ",", "ConstantValue", ")", ",", "TemplateFunc", "(", "\"", "\"", ",", "canBeConstant", ")", ",", "TemplateFunc", "(", "\"", "\"", ",", "constantName", ")", ",", ")", "\n", "return", "wrapGenerateError", "(", "c", ".", "Name", ",", "err", ")", "\n", "}" ]
// Constant generates code for `const` expressions in Thrift files.
[ "Constant", "generates", "code", "for", "const", "expressions", "in", "Thrift", "files", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/constant.go#L31-L40
17,505
thriftrw/thriftrw-go
gen/constant.go
ConstantValue
func ConstantValue(g Generator, c compile.ConstantValue, t compile.TypeSpec) (string, error) { switch v := c.(type) { case compile.ConstantBool: return constantBool(g, v, t) case compile.ConstantDouble: return constantDouble(g, v, t) case compile.ConstantInt: return constantInt(g, v, t) case compile.ConstantList: return constantList(g, v, t) case compile.ConstantMap: return constantMap(g, v, t) case compile.ConstantSet: return constantSet(g, v, t) case compile.ConstantString: return strconv.Quote(string(v)), nil case *compile.ConstantStruct: return constantStruct(g, v, t) case compile.EnumItemReference: return enumItemReference(g, v, t) case compile.ConstReference: if canBeConstant(v.Target.Type) { return g.LookupConstantName(v.Target) } return ConstantValue(g, v.Target.Value, v.Target.Type) default: panic(fmt.Sprintf("Unknown constant value %v (%T)", c, c)) } }
go
func ConstantValue(g Generator, c compile.ConstantValue, t compile.TypeSpec) (string, error) { switch v := c.(type) { case compile.ConstantBool: return constantBool(g, v, t) case compile.ConstantDouble: return constantDouble(g, v, t) case compile.ConstantInt: return constantInt(g, v, t) case compile.ConstantList: return constantList(g, v, t) case compile.ConstantMap: return constantMap(g, v, t) case compile.ConstantSet: return constantSet(g, v, t) case compile.ConstantString: return strconv.Quote(string(v)), nil case *compile.ConstantStruct: return constantStruct(g, v, t) case compile.EnumItemReference: return enumItemReference(g, v, t) case compile.ConstReference: if canBeConstant(v.Target.Type) { return g.LookupConstantName(v.Target) } return ConstantValue(g, v.Target.Value, v.Target.Type) default: panic(fmt.Sprintf("Unknown constant value %v (%T)", c, c)) } }
[ "func", "ConstantValue", "(", "g", "Generator", ",", "c", "compile", ".", "ConstantValue", ",", "t", "compile", ".", "TypeSpec", ")", "(", "string", ",", "error", ")", "{", "switch", "v", ":=", "c", ".", "(", "type", ")", "{", "case", "compile", ".", "ConstantBool", ":", "return", "constantBool", "(", "g", ",", "v", ",", "t", ")", "\n", "case", "compile", ".", "ConstantDouble", ":", "return", "constantDouble", "(", "g", ",", "v", ",", "t", ")", "\n", "case", "compile", ".", "ConstantInt", ":", "return", "constantInt", "(", "g", ",", "v", ",", "t", ")", "\n", "case", "compile", ".", "ConstantList", ":", "return", "constantList", "(", "g", ",", "v", ",", "t", ")", "\n", "case", "compile", ".", "ConstantMap", ":", "return", "constantMap", "(", "g", ",", "v", ",", "t", ")", "\n", "case", "compile", ".", "ConstantSet", ":", "return", "constantSet", "(", "g", ",", "v", ",", "t", ")", "\n", "case", "compile", ".", "ConstantString", ":", "return", "strconv", ".", "Quote", "(", "string", "(", "v", ")", ")", ",", "nil", "\n", "case", "*", "compile", ".", "ConstantStruct", ":", "return", "constantStruct", "(", "g", ",", "v", ",", "t", ")", "\n", "case", "compile", ".", "EnumItemReference", ":", "return", "enumItemReference", "(", "g", ",", "v", ",", "t", ")", "\n", "case", "compile", ".", "ConstReference", ":", "if", "canBeConstant", "(", "v", ".", "Target", ".", "Type", ")", "{", "return", "g", ".", "LookupConstantName", "(", "v", ".", "Target", ")", "\n", "}", "\n", "return", "ConstantValue", "(", "g", ",", "v", ".", "Target", ".", "Value", ",", "v", ".", "Target", ".", "Type", ")", "\n", "default", ":", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ",", "c", ")", ")", "\n", "}", "\n", "}" ]
// ConstantValue generates an expression containing the given constant value of // the given type. // // The constant must already have been linked to the given type.
[ "ConstantValue", "generates", "an", "expression", "containing", "the", "given", "constant", "value", "of", "the", "given", "type", ".", "The", "constant", "must", "already", "have", "been", "linked", "to", "the", "given", "type", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/constant.go#L46-L74
17,506
thriftrw/thriftrw-go
gen/enum.go
verifyUniqueEnumItemLabels
func verifyUniqueEnumItemLabels(spec *compile.EnumSpec) error { items := spec.Items used := make(map[string]compile.EnumItem, len(items)) for _, i := range items { itemName := entityLabel(&i) if conflict, isUsed := used[itemName]; isUsed { return fmt.Errorf( "item %q with label %q conflicts with item %q in enum %q", i.Name, itemName, conflict.Name, spec.Name) } used[itemName] = i } return nil }
go
func verifyUniqueEnumItemLabels(spec *compile.EnumSpec) error { items := spec.Items used := make(map[string]compile.EnumItem, len(items)) for _, i := range items { itemName := entityLabel(&i) if conflict, isUsed := used[itemName]; isUsed { return fmt.Errorf( "item %q with label %q conflicts with item %q in enum %q", i.Name, itemName, conflict.Name, spec.Name) } used[itemName] = i } return nil }
[ "func", "verifyUniqueEnumItemLabels", "(", "spec", "*", "compile", ".", "EnumSpec", ")", "error", "{", "items", ":=", "spec", ".", "Items", "\n", "used", ":=", "make", "(", "map", "[", "string", "]", "compile", ".", "EnumItem", ",", "len", "(", "items", ")", ")", "\n", "for", "_", ",", "i", ":=", "range", "items", "{", "itemName", ":=", "entityLabel", "(", "&", "i", ")", "\n", "if", "conflict", ",", "isUsed", ":=", "used", "[", "itemName", "]", ";", "isUsed", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "i", ".", "Name", ",", "itemName", ",", "conflict", ".", "Name", ",", "spec", ".", "Name", ")", "\n", "}", "\n", "used", "[", "itemName", "]", "=", "i", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// verifyUniqueEnumItemLabels verifies that the labels for the enum items in // the given enum don't conflict.
[ "verifyUniqueEnumItemLabels", "verifies", "that", "the", "labels", "for", "the", "enum", "items", "in", "the", "given", "enum", "don", "t", "conflict", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/enum.go#L304-L317
17,507
thriftrw/thriftrw-go
gen/enum.go
enumUniqueItems
func enumUniqueItems(items []compile.EnumItem) []compile.EnumItem { used := make(map[int32]struct{}, len(items)) filtered := items[:0] // zero-alloc filtering for _, i := range items { if _, isUsed := used[i.Value]; isUsed { continue } filtered = append(filtered, i) used[i.Value] = struct{}{} } return filtered }
go
func enumUniqueItems(items []compile.EnumItem) []compile.EnumItem { used := make(map[int32]struct{}, len(items)) filtered := items[:0] // zero-alloc filtering for _, i := range items { if _, isUsed := used[i.Value]; isUsed { continue } filtered = append(filtered, i) used[i.Value] = struct{}{} } return filtered }
[ "func", "enumUniqueItems", "(", "items", "[", "]", "compile", ".", "EnumItem", ")", "[", "]", "compile", ".", "EnumItem", "{", "used", ":=", "make", "(", "map", "[", "int32", "]", "struct", "{", "}", ",", "len", "(", "items", ")", ")", "\n", "filtered", ":=", "items", "[", ":", "0", "]", "// zero-alloc filtering", "\n", "for", "_", ",", "i", ":=", "range", "items", "{", "if", "_", ",", "isUsed", ":=", "used", "[", "i", ".", "Value", "]", ";", "isUsed", "{", "continue", "\n", "}", "\n", "filtered", "=", "append", "(", "filtered", ",", "i", ")", "\n", "used", "[", "i", ".", "Value", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "return", "filtered", "\n", "}" ]
// enumUniqueItems returns a subset of the given list of enum items where // there are no value collisions between items.
[ "enumUniqueItems", "returns", "a", "subset", "of", "the", "given", "list", "of", "enum", "items", "where", "there", "are", "no", "value", "collisions", "between", "items", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/enum.go#L321-L332
17,508
thriftrw/thriftrw-go
compile/namespace.go
claim
func (n namespace) claim(name string, line int) error { s := n.transform(name) if line, ok := n.names[s]; ok { return nameConflict{name: name, line: line} } n.names[s] = line return nil }
go
func (n namespace) claim(name string, line int) error { s := n.transform(name) if line, ok := n.names[s]; ok { return nameConflict{name: name, line: line} } n.names[s] = line return nil }
[ "func", "(", "n", "namespace", ")", "claim", "(", "name", "string", ",", "line", "int", ")", "error", "{", "s", ":=", "n", ".", "transform", "(", "name", ")", "\n", "if", "line", ",", "ok", ":=", "n", ".", "names", "[", "s", "]", ";", "ok", "{", "return", "nameConflict", "{", "name", ":", "name", ",", "line", ":", "line", "}", "\n", "}", "\n", "n", ".", "names", "[", "s", "]", "=", "line", "\n", "return", "nil", "\n", "}" ]
// claim requests the given name in the namespace. If the name is already // claimed, an error will be returned.
[ "claim", "requests", "the", "given", "name", "in", "the", "namespace", ".", "If", "the", "name", "is", "already", "claimed", "an", "error", "will", "be", "returned", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/compile/namespace.go#L57-L64
17,509
thriftrw/thriftrw-go
compile/constant.go
compileConstant
func compileConstant(file string, src *ast.Constant) (*Constant, error) { typ, err := compileTypeReference(src.Type) if err != nil { return nil, err } return &Constant{ Name: src.Name, File: file, Type: typ, Doc: src.Doc, Value: compileConstantValue(src.Value), }, nil }
go
func compileConstant(file string, src *ast.Constant) (*Constant, error) { typ, err := compileTypeReference(src.Type) if err != nil { return nil, err } return &Constant{ Name: src.Name, File: file, Type: typ, Doc: src.Doc, Value: compileConstantValue(src.Value), }, nil }
[ "func", "compileConstant", "(", "file", "string", ",", "src", "*", "ast", ".", "Constant", ")", "(", "*", "Constant", ",", "error", ")", "{", "typ", ",", "err", ":=", "compileTypeReference", "(", "src", ".", "Type", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "Constant", "{", "Name", ":", "src", ".", "Name", ",", "File", ":", "file", ",", "Type", ":", "typ", ",", "Doc", ":", "src", ".", "Doc", ",", "Value", ":", "compileConstantValue", "(", "src", ".", "Value", ")", ",", "}", ",", "nil", "\n", "}" ]
// compileConstant builds a Constant from the given AST constant.
[ "compileConstant", "builds", "a", "Constant", "from", "the", "given", "AST", "constant", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/compile/constant.go#L41-L54
17,510
thriftrw/thriftrw-go
compile/constant.go
Link
func (c *Constant) Link(scope Scope) (err error) { if c.linked() { return nil } if c.Type, err = c.Type.Link(scope); err != nil { return compileError{Target: c.Name, Reason: err} } if c.Value, err = c.Value.Link(scope, c.Type); err != nil { return compileError{Target: c.Name, Reason: err} } return nil }
go
func (c *Constant) Link(scope Scope) (err error) { if c.linked() { return nil } if c.Type, err = c.Type.Link(scope); err != nil { return compileError{Target: c.Name, Reason: err} } if c.Value, err = c.Value.Link(scope, c.Type); err != nil { return compileError{Target: c.Name, Reason: err} } return nil }
[ "func", "(", "c", "*", "Constant", ")", "Link", "(", "scope", "Scope", ")", "(", "err", "error", ")", "{", "if", "c", ".", "linked", "(", ")", "{", "return", "nil", "\n", "}", "\n\n", "if", "c", ".", "Type", ",", "err", "=", "c", ".", "Type", ".", "Link", "(", "scope", ")", ";", "err", "!=", "nil", "{", "return", "compileError", "{", "Target", ":", "c", ".", "Name", ",", "Reason", ":", "err", "}", "\n", "}", "\n\n", "if", "c", ".", "Value", ",", "err", "=", "c", ".", "Value", ".", "Link", "(", "scope", ",", "c", ".", "Type", ")", ";", "err", "!=", "nil", "{", "return", "compileError", "{", "Target", ":", "c", ".", "Name", ",", "Reason", ":", "err", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Link resolves any references made by the constant.
[ "Link", "resolves", "any", "references", "made", "by", "the", "constant", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/compile/constant.go#L57-L71
17,511
thriftrw/thriftrw-go
gen/string.go
isAllCaps
func isAllCaps(s string) bool { for _, r := range s { if unicode.IsLetter(r) && !unicode.IsUpper(r) { return false } } return true }
go
func isAllCaps(s string) bool { for _, r := range s { if unicode.IsLetter(r) && !unicode.IsUpper(r) { return false } } return true }
[ "func", "isAllCaps", "(", "s", "string", ")", "bool", "{", "for", "_", ",", "r", ":=", "range", "s", "{", "if", "unicode", ".", "IsLetter", "(", "r", ")", "&&", "!", "unicode", ".", "IsUpper", "(", "r", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
// isAllCaps checks if a string contains all capital letters only. Non-letters // are not considered.
[ "isAllCaps", "checks", "if", "a", "string", "contains", "all", "capital", "letters", "only", ".", "Non", "-", "letters", "are", "not", "considered", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/string.go#L34-L41
17,512
thriftrw/thriftrw-go
gen/string.go
pascalCase
func pascalCase(allowAllCaps bool, words ...string) string { for i, chunk := range words { if len(chunk) == 0 { // foo__bar continue } // known initalism init := strings.ToUpper(chunk) if _, ok := commonInitialisms[init]; ok { words[i] = init continue } // Was SCREAMING_SNAKE_CASE and not a known initialism so Titlecase it. if isAllCaps(chunk) && !allowAllCaps { // A single ALLCAPS word does not count as SCREAMING_SNAKE_CASE. // There must be at least one underscore. words[i] = strings.Title(strings.ToLower(chunk)) continue } // Just another word, but could already be camelCased somehow, so just // change the first letter. head, headIndex := utf8.DecodeRuneInString(chunk) words[i] = string(unicode.ToUpper(head)) + string(chunk[headIndex:]) } return strings.Join(words, "") }
go
func pascalCase(allowAllCaps bool, words ...string) string { for i, chunk := range words { if len(chunk) == 0 { // foo__bar continue } // known initalism init := strings.ToUpper(chunk) if _, ok := commonInitialisms[init]; ok { words[i] = init continue } // Was SCREAMING_SNAKE_CASE and not a known initialism so Titlecase it. if isAllCaps(chunk) && !allowAllCaps { // A single ALLCAPS word does not count as SCREAMING_SNAKE_CASE. // There must be at least one underscore. words[i] = strings.Title(strings.ToLower(chunk)) continue } // Just another word, but could already be camelCased somehow, so just // change the first letter. head, headIndex := utf8.DecodeRuneInString(chunk) words[i] = string(unicode.ToUpper(head)) + string(chunk[headIndex:]) } return strings.Join(words, "") }
[ "func", "pascalCase", "(", "allowAllCaps", "bool", ",", "words", "...", "string", ")", "string", "{", "for", "i", ",", "chunk", ":=", "range", "words", "{", "if", "len", "(", "chunk", ")", "==", "0", "{", "// foo__bar", "continue", "\n", "}", "\n\n", "// known initalism", "init", ":=", "strings", ".", "ToUpper", "(", "chunk", ")", "\n", "if", "_", ",", "ok", ":=", "commonInitialisms", "[", "init", "]", ";", "ok", "{", "words", "[", "i", "]", "=", "init", "\n", "continue", "\n", "}", "\n\n", "// Was SCREAMING_SNAKE_CASE and not a known initialism so Titlecase it.", "if", "isAllCaps", "(", "chunk", ")", "&&", "!", "allowAllCaps", "{", "// A single ALLCAPS word does not count as SCREAMING_SNAKE_CASE.", "// There must be at least one underscore.", "words", "[", "i", "]", "=", "strings", ".", "Title", "(", "strings", ".", "ToLower", "(", "chunk", ")", ")", "\n", "continue", "\n", "}", "\n\n", "// Just another word, but could already be camelCased somehow, so just", "// change the first letter.", "head", ",", "headIndex", ":=", "utf8", ".", "DecodeRuneInString", "(", "chunk", ")", "\n", "words", "[", "i", "]", "=", "string", "(", "unicode", ".", "ToUpper", "(", "head", ")", ")", "+", "string", "(", "chunk", "[", "headIndex", ":", "]", ")", "\n", "}", "\n\n", "return", "strings", ".", "Join", "(", "words", ",", "\"", "\"", ")", "\n", "}" ]
// pascalCase combines the given words using PascalCase. // // If allowAllCaps is true, when an all-caps word that is not a known // abbreviation is encountered, it is left unchanged. Otherwise, it is // Titlecased.
[ "pascalCase", "combines", "the", "given", "words", "using", "PascalCase", ".", "If", "allowAllCaps", "is", "true", "when", "an", "all", "-", "caps", "word", "that", "is", "not", "a", "known", "abbreviation", "is", "encountered", "it", "is", "left", "unchanged", ".", "Otherwise", "it", "is", "Titlecased", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/string.go#L48-L77
17,513
thriftrw/thriftrw-go
gen/string.go
goCase
func goCase(s string) string { if len(s) == 0 { panic(fmt.Sprintf("%q is not a valid identifier", s)) } words := strings.Split(s, "_") return pascalCase(len(words) == 1 /* all caps */, words...) // goCase allows all caps only if the string is a single all caps word. // That is, "FOO" is allowed but "FOO_BAR" is changed to "FooBar". }
go
func goCase(s string) string { if len(s) == 0 { panic(fmt.Sprintf("%q is not a valid identifier", s)) } words := strings.Split(s, "_") return pascalCase(len(words) == 1 /* all caps */, words...) // goCase allows all caps only if the string is a single all caps word. // That is, "FOO" is allowed but "FOO_BAR" is changed to "FooBar". }
[ "func", "goCase", "(", "s", "string", ")", "string", "{", "if", "len", "(", "s", ")", "==", "0", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ")", ")", "\n", "}", "\n\n", "words", ":=", "strings", ".", "Split", "(", "s", ",", "\"", "\"", ")", "\n", "return", "pascalCase", "(", "len", "(", "words", ")", "==", "1", "/* all caps */", ",", "words", "...", ")", "\n", "// goCase allows all caps only if the string is a single all caps word.", "// That is, \"FOO\" is allowed but \"FOO_BAR\" is changed to \"FooBar\".", "}" ]
// goCase converts strings into PascalCase.
[ "goCase", "converts", "strings", "into", "PascalCase", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/string.go#L84-L93
17,514
thriftrw/thriftrw-go
internal/frame/server.go
NewServer
func NewServer(r io.Reader, w io.Writer) *Server { return &Server{ r: NewReader(r), w: NewWriter(w), running: atomic.NewBool(false), } }
go
func NewServer(r io.Reader, w io.Writer) *Server { return &Server{ r: NewReader(r), w: NewWriter(w), running: atomic.NewBool(false), } }
[ "func", "NewServer", "(", "r", "io", ".", "Reader", ",", "w", "io", ".", "Writer", ")", "*", "Server", "{", "return", "&", "Server", "{", "r", ":", "NewReader", "(", "r", ")", ",", "w", ":", "NewWriter", "(", "w", ")", ",", "running", ":", "atomic", ".", "NewBool", "(", "false", ")", ",", "}", "\n", "}" ]
// NewServer builds a new server which reads requests from the given Reader // and writes responses to the given Writer.
[ "NewServer", "builds", "a", "new", "server", "which", "reads", "requests", "from", "the", "given", "Reader", "and", "writes", "responses", "to", "the", "given", "Writer", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/internal/frame/server.go#L49-L55
17,515
thriftrw/thriftrw-go
internal/frame/server.go
Serve
func (s *Server) Serve(h Handler) (err error) { if s.running.Swap(true) { return fmt.Errorf("server is already running") } defer func() { err = multierr.Append(err, s.r.Close()) err = multierr.Append(err, s.w.Close()) }() for s.running.Load() { req, err := s.r.Read() if err != nil { // If the error occurred because the server was stopped, ignore it. if !s.running.Load() { break } return err } res, err := h.Handle(req) if err != nil { return err } if err := s.w.Write(res); err != nil { return err } } return nil }
go
func (s *Server) Serve(h Handler) (err error) { if s.running.Swap(true) { return fmt.Errorf("server is already running") } defer func() { err = multierr.Append(err, s.r.Close()) err = multierr.Append(err, s.w.Close()) }() for s.running.Load() { req, err := s.r.Read() if err != nil { // If the error occurred because the server was stopped, ignore it. if !s.running.Load() { break } return err } res, err := h.Handle(req) if err != nil { return err } if err := s.w.Write(res); err != nil { return err } } return nil }
[ "func", "(", "s", "*", "Server", ")", "Serve", "(", "h", "Handler", ")", "(", "err", "error", ")", "{", "if", "s", ".", "running", ".", "Swap", "(", "true", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "defer", "func", "(", ")", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "s", ".", "r", ".", "Close", "(", ")", ")", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "s", ".", "w", ".", "Close", "(", ")", ")", "\n", "}", "(", ")", "\n\n", "for", "s", ".", "running", ".", "Load", "(", ")", "{", "req", ",", "err", ":=", "s", ".", "r", ".", "Read", "(", ")", "\n", "if", "err", "!=", "nil", "{", "// If the error occurred because the server was stopped, ignore it.", "if", "!", "s", ".", "running", ".", "Load", "(", ")", "{", "break", "\n", "}", "\n\n", "return", "err", "\n", "}", "\n\n", "res", ",", "err", ":=", "h", ".", "Handle", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "w", ".", "Write", "(", "res", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Serve serves the given Handler with the Server. // // Only one request is served at a time. The server stops handling requests if // there is an IO error or an unhandled error is received from the Handler. // // This blocks until the server is stopped using Stop.
[ "Serve", "serves", "the", "given", "Handler", "with", "the", "Server", ".", "Only", "one", "request", "is", "served", "at", "a", "time", ".", "The", "server", "stops", "handling", "requests", "if", "there", "is", "an", "IO", "error", "or", "an", "unhandled", "error", "is", "received", "from", "the", "Handler", ".", "This", "blocks", "until", "the", "server", "is", "stopped", "using", "Stop", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/internal/frame/server.go#L63-L95
17,516
thriftrw/thriftrw-go
internal/frame/server.go
Stop
func (s *Server) Stop() error { // We only close the reader because we want the writer to be available if // Stop() was called by a request handler which still needs to send back a // response (goodbye()). The writer will be closed automatically when the // loop exits. if s.running.Swap(false) { return s.r.Close() } return nil }
go
func (s *Server) Stop() error { // We only close the reader because we want the writer to be available if // Stop() was called by a request handler which still needs to send back a // response (goodbye()). The writer will be closed automatically when the // loop exits. if s.running.Swap(false) { return s.r.Close() } return nil }
[ "func", "(", "s", "*", "Server", ")", "Stop", "(", ")", "error", "{", "// We only close the reader because we want the writer to be available if", "// Stop() was called by a request handler which still needs to send back a", "// response (goodbye()). The writer will be closed automatically when the", "// loop exits.", "if", "s", ".", "running", ".", "Swap", "(", "false", ")", "{", "return", "s", ".", "r", ".", "Close", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Stop tells the Server that it's okay to stop Serve. // // This is a no-op if the server wasn't already running.
[ "Stop", "tells", "the", "Server", "that", "it", "s", "okay", "to", "stop", "Serve", ".", "This", "is", "a", "no", "-", "op", "if", "the", "server", "wasn", "t", "already", "running", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/internal/frame/server.go#L100-L109
17,517
thriftrw/thriftrw-go
gen/embedidl.go
embedIDL
func embedIDL(g Generator, i thriftPackageImporter, m *compile.Module) error { pkg, err := i.Package(m.ThriftPath) if err != nil { return wrapGenerateError("idl embedding", err) } packageRelPath, err := i.RelativeThriftFilePath(m.ThriftPath) if err != nil { return wrapGenerateError("idl embedding", err) } hash := sha1.Sum(m.Raw) var includes []string for _, v := range m.Includes { importPath, err := i.Package(v.Module.ThriftPath) if err != nil { return wrapGenerateError("idl embedding", err) } includes = append(includes, g.Import(importPath)) } sort.Strings(includes) data := struct { Name string Package string FilePath string SHA1 string Includes []string Raw []byte }{ Name: m.Name, Package: pkg, FilePath: packageRelPath, SHA1: hex.EncodeToString(hash[:]), Includes: includes, Raw: m.Raw, } err = g.DeclareFromTemplate(` <$idl := import "go.uber.org/thriftrw/thriftreflect"> // ThriftModule represents the IDL file used to generate this package. var ThriftModule = &<$idl>.ThriftModule { Name: "<.Name>", Package: "<.Package>", FilePath: <printf "%q" .FilePath>, SHA1: "<.SHA1>", <if .Includes -> Includes: []*<$idl>.ThriftModule {<range .Includes> <.>.ThriftModule, <end> }, <end -> Raw: rawIDL, } const rawIDL = <printf "%q" .Raw> `, data) return wrapGenerateError("idl embedding", err) }
go
func embedIDL(g Generator, i thriftPackageImporter, m *compile.Module) error { pkg, err := i.Package(m.ThriftPath) if err != nil { return wrapGenerateError("idl embedding", err) } packageRelPath, err := i.RelativeThriftFilePath(m.ThriftPath) if err != nil { return wrapGenerateError("idl embedding", err) } hash := sha1.Sum(m.Raw) var includes []string for _, v := range m.Includes { importPath, err := i.Package(v.Module.ThriftPath) if err != nil { return wrapGenerateError("idl embedding", err) } includes = append(includes, g.Import(importPath)) } sort.Strings(includes) data := struct { Name string Package string FilePath string SHA1 string Includes []string Raw []byte }{ Name: m.Name, Package: pkg, FilePath: packageRelPath, SHA1: hex.EncodeToString(hash[:]), Includes: includes, Raw: m.Raw, } err = g.DeclareFromTemplate(` <$idl := import "go.uber.org/thriftrw/thriftreflect"> // ThriftModule represents the IDL file used to generate this package. var ThriftModule = &<$idl>.ThriftModule { Name: "<.Name>", Package: "<.Package>", FilePath: <printf "%q" .FilePath>, SHA1: "<.SHA1>", <if .Includes -> Includes: []*<$idl>.ThriftModule {<range .Includes> <.>.ThriftModule, <end> }, <end -> Raw: rawIDL, } const rawIDL = <printf "%q" .Raw> `, data) return wrapGenerateError("idl embedding", err) }
[ "func", "embedIDL", "(", "g", "Generator", ",", "i", "thriftPackageImporter", ",", "m", "*", "compile", ".", "Module", ")", "error", "{", "pkg", ",", "err", ":=", "i", ".", "Package", "(", "m", ".", "ThriftPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "wrapGenerateError", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "packageRelPath", ",", "err", ":=", "i", ".", "RelativeThriftFilePath", "(", "m", ".", "ThriftPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "wrapGenerateError", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "hash", ":=", "sha1", ".", "Sum", "(", "m", ".", "Raw", ")", "\n", "var", "includes", "[", "]", "string", "\n", "for", "_", ",", "v", ":=", "range", "m", ".", "Includes", "{", "importPath", ",", "err", ":=", "i", ".", "Package", "(", "v", ".", "Module", ".", "ThriftPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "wrapGenerateError", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "includes", "=", "append", "(", "includes", ",", "g", ".", "Import", "(", "importPath", ")", ")", "\n", "}", "\n\n", "sort", ".", "Strings", "(", "includes", ")", "\n\n", "data", ":=", "struct", "{", "Name", "string", "\n", "Package", "string", "\n", "FilePath", "string", "\n", "SHA1", "string", "\n", "Includes", "[", "]", "string", "\n", "Raw", "[", "]", "byte", "\n", "}", "{", "Name", ":", "m", ".", "Name", ",", "Package", ":", "pkg", ",", "FilePath", ":", "packageRelPath", ",", "SHA1", ":", "hex", ".", "EncodeToString", "(", "hash", "[", ":", "]", ")", ",", "Includes", ":", "includes", ",", "Raw", ":", "m", ".", "Raw", ",", "}", "\n", "err", "=", "g", ".", "DeclareFromTemplate", "(", "`\n\t\t<$idl := import \"go.uber.org/thriftrw/thriftreflect\">\n\n\t\t// ThriftModule represents the IDL file used to generate this package.\n\t\tvar ThriftModule = &<$idl>.ThriftModule {\n\t\t\tName: \"<.Name>\",\n\t\t\tPackage: \"<.Package>\",\n\t\t\tFilePath: <printf \"%q\" .FilePath>,\n\t\t\tSHA1: \"<.SHA1>\",\n\t\t\t<if .Includes ->\n\t\t\t\tIncludes: []*<$idl>.ThriftModule {<range .Includes>\n\t\t\t\t\t\t<.>.ThriftModule, <end>\n\t\t\t\t\t},\n\t\t\t<end ->\n\t\t\tRaw: rawIDL,\n\t\t}\n\t\tconst rawIDL = <printf \"%q\" .Raw>\n\t\t`", ",", "data", ")", "\n", "return", "wrapGenerateError", "(", "\"", "\"", ",", "err", ")", "\n", "}" ]
// embedIDL generate Go code with a full copy of the IDL embeded.
[ "embedIDL", "generate", "Go", "code", "with", "a", "full", "copy", "of", "the", "IDL", "embeded", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/gen/embedidl.go#L32-L88
17,518
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *Argument) String() string { if v == nil { return "<nil>" } var fields [2]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("Type: %v", v.Type) i++ return fmt.Sprintf("Argument{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *Argument) String() string { if v == nil { return "<nil>" } var fields [2]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("Type: %v", v.Type) i++ return fmt.Sprintf("Argument{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "Argument", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "2", "]", "string", "\n", "i", ":=", "0", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Type", ")", "\n", "i", "++", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a Argument // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "Argument", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L163-L176
17,519
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *Argument) Equals(rhs *Argument) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !v.Type.Equals(rhs.Type) { return false } return true }
go
func (v *Argument) Equals(rhs *Argument) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !v.Type.Equals(rhs.Type) { return false } return true }
[ "func", "(", "v", "*", "Argument", ")", "Equals", "(", "rhs", "*", "Argument", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "Name", "==", "rhs", ".", "Name", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "v", ".", "Type", ".", "Equals", "(", "rhs", ".", "Type", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this Argument match the // provided Argument. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "Argument", "match", "the", "provided", "Argument", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L182-L196
17,520
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *Argument) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) err = multierr.Append(err, enc.AddObject("type", v.Type)) return err }
go
func (v *Argument) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) err = multierr.Append(err, enc.AddObject("type", v.Type)) return err }
[ "func", "(", "v", "*", "Argument", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "Type", ")", ")", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of Argument.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "Argument", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L200-L207
17,521
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v Feature) MarshalLogObject(enc zapcore.ObjectEncoder) error { enc.AddInt32("value", int32(v)) switch int32(v) { case 1: enc.AddString("name", "SERVICE_GENERATOR") } return nil }
go
func (v Feature) MarshalLogObject(enc zapcore.ObjectEncoder) error { enc.AddInt32("value", int32(v)) switch int32(v) { case 1: enc.AddString("name", "SERVICE_GENERATOR") } return nil }
[ "func", "(", "v", "Feature", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "error", "{", "enc", ".", "AddInt32", "(", "\"", "\"", ",", "int32", "(", "v", ")", ")", "\n", "switch", "int32", "(", "v", ")", "{", "case", "1", ":", "enc", ".", "AddString", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of Feature. // Enums are logged as objects, where the value is logged with key "value", and // if this value's name is known, the name is logged with key "name".
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "Feature", ".", "Enums", "are", "logged", "as", "objects", "where", "the", "value", "is", "logged", "with", "key", "value", "and", "if", "this", "value", "s", "name", "is", "known", "the", "name", "is", "logged", "with", "key", "name", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L289-L296
17,522
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v Feature) String() string { w := int32(v) switch w { case 1: return "SERVICE_GENERATOR" } return fmt.Sprintf("Feature(%d)", w) }
go
func (v Feature) String() string { w := int32(v) switch w { case 1: return "SERVICE_GENERATOR" } return fmt.Sprintf("Feature(%d)", w) }
[ "func", "(", "v", "Feature", ")", "String", "(", ")", "string", "{", "w", ":=", "int32", "(", "v", ")", "\n", "switch", "w", "{", "case", "1", ":", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "w", ")", "\n", "}" ]
// String returns a readable string representation of Feature.
[ "String", "returns", "a", "readable", "string", "representation", "of", "Feature", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L331-L338
17,523
thriftrw/thriftrw-go
plugin/api/types.go
MarshalJSON
func (v Feature) MarshalJSON() ([]byte, error) { switch int32(v) { case 1: return ([]byte)("\"SERVICE_GENERATOR\""), nil } return ([]byte)(strconv.FormatInt(int64(v), 10)), nil }
go
func (v Feature) MarshalJSON() ([]byte, error) { switch int32(v) { case 1: return ([]byte)("\"SERVICE_GENERATOR\""), nil } return ([]byte)(strconv.FormatInt(int64(v), 10)), nil }
[ "func", "(", "v", "Feature", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "switch", "int32", "(", "v", ")", "{", "case", "1", ":", "return", "(", "[", "]", "byte", ")", "(", "\"", "\\\"", "\\\"", "\"", ")", ",", "nil", "\n", "}", "\n", "return", "(", "[", "]", "byte", ")", "(", "strconv", ".", "FormatInt", "(", "int64", "(", "v", ")", ",", "10", ")", ")", ",", "nil", "\n", "}" ]
// MarshalJSON serializes Feature into JSON. // // If the enum value is recognized, its name is returned. Otherwise, // its integer value is returned. // // This implements json.Marshaler.
[ "MarshalJSON", "serializes", "Feature", "into", "JSON", ".", "If", "the", "enum", "value", "is", "recognized", "its", "name", "is", "returned", ".", "Otherwise", "its", "integer", "value", "is", "returned", ".", "This", "implements", "json", ".", "Marshaler", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L352-L358
17,524
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *Function) String() string { if v == nil { return "<nil>" } var fields [7]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("ThriftName: %v", v.ThriftName) i++ fields[i] = fmt.Sprintf("Arguments: %v", v.Arguments) i++ if v.ReturnType != nil { fields[i] = fmt.Sprintf("ReturnType: %v", v.ReturnType) i++ } if v.Exceptions != nil { fields[i] = fmt.Sprintf("Exceptions: %v", v.Exceptions) i++ } if v.OneWay != nil { fields[i] = fmt.Sprintf("OneWay: %v", *(v.OneWay)) i++ } if v.Annotations != nil { fields[i] = fmt.Sprintf("Annotations: %v", v.Annotations) i++ } return fmt.Sprintf("Function{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *Function) String() string { if v == nil { return "<nil>" } var fields [7]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("ThriftName: %v", v.ThriftName) i++ fields[i] = fmt.Sprintf("Arguments: %v", v.Arguments) i++ if v.ReturnType != nil { fields[i] = fmt.Sprintf("ReturnType: %v", v.ReturnType) i++ } if v.Exceptions != nil { fields[i] = fmt.Sprintf("Exceptions: %v", v.Exceptions) i++ } if v.OneWay != nil { fields[i] = fmt.Sprintf("OneWay: %v", *(v.OneWay)) i++ } if v.Annotations != nil { fields[i] = fmt.Sprintf("Annotations: %v", v.Annotations) i++ } return fmt.Sprintf("Function{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "Function", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "7", "]", "string", "\n", "i", ":=", "0", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ThriftName", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Arguments", ")", "\n", "i", "++", "\n", "if", "v", ".", "ReturnType", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ReturnType", ")", "\n", "i", "++", "\n", "}", "\n", "if", "v", ".", "Exceptions", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Exceptions", ")", "\n", "i", "++", "\n", "}", "\n", "if", "v", ".", "OneWay", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*", "(", "v", ".", "OneWay", ")", ")", "\n", "i", "++", "\n", "}", "\n", "if", "v", ".", "Annotations", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Annotations", ")", "\n", "i", "++", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a Function // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "Function", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L732-L763
17,525
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *Function) Equals(rhs *Function) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !(v.ThriftName == rhs.ThriftName) { return false } if !_List_Argument_Equals(v.Arguments, rhs.Arguments) { return false } if !((v.ReturnType == nil && rhs.ReturnType == nil) || (v.ReturnType != nil && rhs.ReturnType != nil && v.ReturnType.Equals(rhs.ReturnType))) { return false } if !((v.Exceptions == nil && rhs.Exceptions == nil) || (v.Exceptions != nil && rhs.Exceptions != nil && _List_Argument_Equals(v.Exceptions, rhs.Exceptions))) { return false } if !_Bool_EqualsPtr(v.OneWay, rhs.OneWay) { return false } if !((v.Annotations == nil && rhs.Annotations == nil) || (v.Annotations != nil && rhs.Annotations != nil && _Map_String_String_Equals(v.Annotations, rhs.Annotations))) { return false } return true }
go
func (v *Function) Equals(rhs *Function) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !(v.ThriftName == rhs.ThriftName) { return false } if !_List_Argument_Equals(v.Arguments, rhs.Arguments) { return false } if !((v.ReturnType == nil && rhs.ReturnType == nil) || (v.ReturnType != nil && rhs.ReturnType != nil && v.ReturnType.Equals(rhs.ReturnType))) { return false } if !((v.Exceptions == nil && rhs.Exceptions == nil) || (v.Exceptions != nil && rhs.Exceptions != nil && _List_Argument_Equals(v.Exceptions, rhs.Exceptions))) { return false } if !_Bool_EqualsPtr(v.OneWay, rhs.OneWay) { return false } if !((v.Annotations == nil && rhs.Annotations == nil) || (v.Annotations != nil && rhs.Annotations != nil && _Map_String_String_Equals(v.Annotations, rhs.Annotations))) { return false } return true }
[ "func", "(", "v", "*", "Function", ")", "Equals", "(", "rhs", "*", "Function", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "Name", "==", "rhs", ".", "Name", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "ThriftName", "==", "rhs", ".", "ThriftName", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "_List_Argument_Equals", "(", "v", ".", "Arguments", ",", "rhs", ".", "Arguments", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "ReturnType", "==", "nil", "&&", "rhs", ".", "ReturnType", "==", "nil", ")", "||", "(", "v", ".", "ReturnType", "!=", "nil", "&&", "rhs", ".", "ReturnType", "!=", "nil", "&&", "v", ".", "ReturnType", ".", "Equals", "(", "rhs", ".", "ReturnType", ")", ")", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "Exceptions", "==", "nil", "&&", "rhs", ".", "Exceptions", "==", "nil", ")", "||", "(", "v", ".", "Exceptions", "!=", "nil", "&&", "rhs", ".", "Exceptions", "!=", "nil", "&&", "_List_Argument_Equals", "(", "v", ".", "Exceptions", ",", "rhs", ".", "Exceptions", ")", ")", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "_Bool_EqualsPtr", "(", "v", ".", "OneWay", ",", "rhs", ".", "OneWay", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "Annotations", "==", "nil", "&&", "rhs", ".", "Annotations", "==", "nil", ")", "||", "(", "v", ".", "Annotations", "!=", "nil", "&&", "rhs", ".", "Annotations", "!=", "nil", "&&", "_Map_String_String_Equals", "(", "v", ".", "Annotations", ",", "rhs", ".", "Annotations", ")", ")", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this Function match the // provided Function. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "Function", "match", "the", "provided", "Function", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L811-L840
17,526
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *Function) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) enc.AddString("thriftName", v.ThriftName) err = multierr.Append(err, enc.AddArray("arguments", (_List_Argument_Zapper)(v.Arguments))) if v.ReturnType != nil { err = multierr.Append(err, enc.AddObject("returnType", v.ReturnType)) } if v.Exceptions != nil { err = multierr.Append(err, enc.AddArray("exceptions", (_List_Argument_Zapper)(v.Exceptions))) } if v.OneWay != nil { enc.AddBool("oneWay", *v.OneWay) } if v.Annotations != nil { err = multierr.Append(err, enc.AddObject("annotations", (_Map_String_String_Zapper)(v.Annotations))) } return err }
go
func (v *Function) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) enc.AddString("thriftName", v.ThriftName) err = multierr.Append(err, enc.AddArray("arguments", (_List_Argument_Zapper)(v.Arguments))) if v.ReturnType != nil { err = multierr.Append(err, enc.AddObject("returnType", v.ReturnType)) } if v.Exceptions != nil { err = multierr.Append(err, enc.AddArray("exceptions", (_List_Argument_Zapper)(v.Exceptions))) } if v.OneWay != nil { enc.AddBool("oneWay", *v.OneWay) } if v.Annotations != nil { err = multierr.Append(err, enc.AddObject("annotations", (_Map_String_String_Zapper)(v.Annotations))) } return err }
[ "func", "(", "v", "*", "Function", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "ThriftName", ")", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddArray", "(", "\"", "\"", ",", "(", "_List_Argument_Zapper", ")", "(", "v", ".", "Arguments", ")", ")", ")", "\n", "if", "v", ".", "ReturnType", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "ReturnType", ")", ")", "\n", "}", "\n", "if", "v", ".", "Exceptions", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddArray", "(", "\"", "\"", ",", "(", "_List_Argument_Zapper", ")", "(", "v", ".", "Exceptions", ")", ")", ")", "\n", "}", "\n", "if", "v", ".", "OneWay", "!=", "nil", "{", "enc", ".", "AddBool", "(", "\"", "\"", ",", "*", "v", ".", "OneWay", ")", "\n", "}", "\n", "if", "v", ".", "Annotations", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "(", "_Map_String_String_Zapper", ")", "(", "v", ".", "Annotations", ")", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of Function.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "Function", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L866-L886
17,527
thriftrw/thriftrw-go
plugin/api/types.go
GetArguments
func (v *Function) GetArguments() (o []*Argument) { if v != nil { o = v.Arguments } return }
go
func (v *Function) GetArguments() (o []*Argument) { if v != nil { o = v.Arguments } return }
[ "func", "(", "v", "*", "Function", ")", "GetArguments", "(", ")", "(", "o", "[", "]", "*", "Argument", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "Arguments", "\n", "}", "\n", "return", "\n", "}" ]
// GetArguments returns the value of Arguments if it is set or its // zero value if it is unset.
[ "GetArguments", "returns", "the", "value", "of", "Arguments", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L908-L913
17,528
thriftrw/thriftrw-go
plugin/api/types.go
GetReturnType
func (v *Function) GetReturnType() (o *Type) { if v != nil && v.ReturnType != nil { return v.ReturnType } return }
go
func (v *Function) GetReturnType() (o *Type) { if v != nil && v.ReturnType != nil { return v.ReturnType } return }
[ "func", "(", "v", "*", "Function", ")", "GetReturnType", "(", ")", "(", "o", "*", "Type", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "ReturnType", "!=", "nil", "{", "return", "v", ".", "ReturnType", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetReturnType returns the value of ReturnType if it is set or its // zero value if it is unset.
[ "GetReturnType", "returns", "the", "value", "of", "ReturnType", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L922-L928
17,529
thriftrw/thriftrw-go
plugin/api/types.go
GetExceptions
func (v *Function) GetExceptions() (o []*Argument) { if v != nil && v.Exceptions != nil { return v.Exceptions } return }
go
func (v *Function) GetExceptions() (o []*Argument) { if v != nil && v.Exceptions != nil { return v.Exceptions } return }
[ "func", "(", "v", "*", "Function", ")", "GetExceptions", "(", ")", "(", "o", "[", "]", "*", "Argument", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Exceptions", "!=", "nil", "{", "return", "v", ".", "Exceptions", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetExceptions returns the value of Exceptions if it is set or its // zero value if it is unset.
[ "GetExceptions", "returns", "the", "value", "of", "Exceptions", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L937-L943
17,530
thriftrw/thriftrw-go
plugin/api/types.go
GetOneWay
func (v *Function) GetOneWay() (o bool) { if v != nil && v.OneWay != nil { return *v.OneWay } return }
go
func (v *Function) GetOneWay() (o bool) { if v != nil && v.OneWay != nil { return *v.OneWay } return }
[ "func", "(", "v", "*", "Function", ")", "GetOneWay", "(", ")", "(", "o", "bool", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "OneWay", "!=", "nil", "{", "return", "*", "v", ".", "OneWay", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetOneWay returns the value of OneWay if it is set or its // zero value if it is unset.
[ "GetOneWay", "returns", "the", "value", "of", "OneWay", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L952-L958
17,531
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *GenerateServiceRequest) String() string { if v == nil { return "<nil>" } var fields [5]string i := 0 fields[i] = fmt.Sprintf("RootServices: %v", v.RootServices) i++ fields[i] = fmt.Sprintf("Services: %v", v.Services) i++ fields[i] = fmt.Sprintf("Modules: %v", v.Modules) i++ fields[i] = fmt.Sprintf("PackagePrefix: %v", v.PackagePrefix) i++ fields[i] = fmt.Sprintf("ThriftRoot: %v", v.ThriftRoot) i++ return fmt.Sprintf("GenerateServiceRequest{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *GenerateServiceRequest) String() string { if v == nil { return "<nil>" } var fields [5]string i := 0 fields[i] = fmt.Sprintf("RootServices: %v", v.RootServices) i++ fields[i] = fmt.Sprintf("Services: %v", v.Services) i++ fields[i] = fmt.Sprintf("Modules: %v", v.Modules) i++ fields[i] = fmt.Sprintf("PackagePrefix: %v", v.PackagePrefix) i++ fields[i] = fmt.Sprintf("ThriftRoot: %v", v.ThriftRoot) i++ return fmt.Sprintf("GenerateServiceRequest{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "GenerateServiceRequest", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "5", "]", "string", "\n", "i", ":=", "0", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "RootServices", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Services", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Modules", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "PackagePrefix", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ThriftRoot", ")", "\n", "i", "++", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a GenerateServiceRequest // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "GenerateServiceRequest", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1374-L1393
17,532
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *GenerateServiceRequest) Equals(rhs *GenerateServiceRequest) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !_List_ServiceID_Equals(v.RootServices, rhs.RootServices) { return false } if !_Map_ServiceID_Service_Equals(v.Services, rhs.Services) { return false } if !_Map_ModuleID_Module_Equals(v.Modules, rhs.Modules) { return false } if !(v.PackagePrefix == rhs.PackagePrefix) { return false } if !(v.ThriftRoot == rhs.ThriftRoot) { return false } return true }
go
func (v *GenerateServiceRequest) Equals(rhs *GenerateServiceRequest) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !_List_ServiceID_Equals(v.RootServices, rhs.RootServices) { return false } if !_Map_ServiceID_Service_Equals(v.Services, rhs.Services) { return false } if !_Map_ModuleID_Module_Equals(v.Modules, rhs.Modules) { return false } if !(v.PackagePrefix == rhs.PackagePrefix) { return false } if !(v.ThriftRoot == rhs.ThriftRoot) { return false } return true }
[ "func", "(", "v", "*", "GenerateServiceRequest", ")", "Equals", "(", "rhs", "*", "GenerateServiceRequest", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "_List_ServiceID_Equals", "(", "v", ".", "RootServices", ",", "rhs", ".", "RootServices", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "_Map_ServiceID_Service_Equals", "(", "v", ".", "Services", ",", "rhs", ".", "Services", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "_Map_ModuleID_Module_Equals", "(", "v", ".", "Modules", ",", "rhs", ".", "Modules", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "PackagePrefix", "==", "rhs", ".", "PackagePrefix", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "ThriftRoot", "==", "rhs", ".", "ThriftRoot", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this GenerateServiceRequest match the // provided GenerateServiceRequest. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "GenerateServiceRequest", "match", "the", "provided", "GenerateServiceRequest", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1448-L1471
17,533
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogArray
func (l _List_ServiceID_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) { for _, v := range l { enc.AppendInt32((int32)(v)) } return err }
go
func (l _List_ServiceID_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) { for _, v := range l { enc.AppendInt32((int32)(v)) } return err }
[ "func", "(", "l", "_List_ServiceID_Zapper", ")", "MarshalLogArray", "(", "enc", "zapcore", ".", "ArrayEncoder", ")", "(", "err", "error", ")", "{", "for", "_", ",", "v", ":=", "range", "l", "{", "enc", ".", "AppendInt32", "(", "(", "int32", ")", "(", "v", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogArray implements zapcore.ArrayMarshaler, enabling // fast logging of _List_ServiceID_Zapper.
[ "MarshalLogArray", "implements", "zapcore", ".", "ArrayMarshaler", "enabling", "fast", "logging", "of", "_List_ServiceID_Zapper", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1477-L1482
17,534
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogArray
func (m _Map_ServiceID_Service_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) { for k, v := range m { err = multierr.Append(err, enc.AppendObject(_Map_ServiceID_Service_Item_Zapper{Key: k, Value: v})) } return err }
go
func (m _Map_ServiceID_Service_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) { for k, v := range m { err = multierr.Append(err, enc.AppendObject(_Map_ServiceID_Service_Item_Zapper{Key: k, Value: v})) } return err }
[ "func", "(", "m", "_Map_ServiceID_Service_Zapper", ")", "MarshalLogArray", "(", "enc", "zapcore", ".", "ArrayEncoder", ")", "(", "err", "error", ")", "{", "for", "k", ",", "v", ":=", "range", "m", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AppendObject", "(", "_Map_ServiceID_Service_Item_Zapper", "{", "Key", ":", "k", ",", "Value", ":", "v", "}", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogArray implements zapcore.ArrayMarshaler, enabling // fast logging of _Map_ServiceID_Service_Zapper.
[ "MarshalLogArray", "implements", "zapcore", ".", "ArrayMarshaler", "enabling", "fast", "logging", "of", "_Map_ServiceID_Service_Zapper", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1501-L1506
17,535
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v _Map_ModuleID_Module_Item_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { enc.AddInt32("key", (int32)(v.Key)) err = multierr.Append(err, enc.AddObject("value", v.Value)) return err }
go
func (v _Map_ModuleID_Module_Item_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { enc.AddInt32("key", (int32)(v.Key)) err = multierr.Append(err, enc.AddObject("value", v.Value)) return err }
[ "func", "(", "v", "_Map_ModuleID_Module_Item_Zapper", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "enc", ".", "AddInt32", "(", "\"", "\"", ",", "(", "int32", ")", "(", "v", ".", "Key", ")", ")", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "Value", ")", ")", "\n", "return", "err", "\n", "}" ]
// MarshalLogArray implements zapcore.ArrayMarshaler, enabling // fast logging of _Map_ModuleID_Module_Item_Zapper.
[ "MarshalLogArray", "implements", "zapcore", ".", "ArrayMarshaler", "enabling", "fast", "logging", "of", "_Map_ModuleID_Module_Item_Zapper", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1515-L1519
17,536
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogArray
func (m _Map_ModuleID_Module_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) { for k, v := range m { err = multierr.Append(err, enc.AppendObject(_Map_ModuleID_Module_Item_Zapper{Key: k, Value: v})) } return err }
go
func (m _Map_ModuleID_Module_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) { for k, v := range m { err = multierr.Append(err, enc.AppendObject(_Map_ModuleID_Module_Item_Zapper{Key: k, Value: v})) } return err }
[ "func", "(", "m", "_Map_ModuleID_Module_Zapper", ")", "MarshalLogArray", "(", "enc", "zapcore", ".", "ArrayEncoder", ")", "(", "err", "error", ")", "{", "for", "k", ",", "v", ":=", "range", "m", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AppendObject", "(", "_Map_ModuleID_Module_Item_Zapper", "{", "Key", ":", "k", ",", "Value", ":", "v", "}", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogArray implements zapcore.ArrayMarshaler, enabling // fast logging of _Map_ModuleID_Module_Zapper.
[ "MarshalLogArray", "implements", "zapcore", ".", "ArrayMarshaler", "enabling", "fast", "logging", "of", "_Map_ModuleID_Module_Zapper", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1525-L1530
17,537
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *GenerateServiceRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } err = multierr.Append(err, enc.AddArray("rootServices", (_List_ServiceID_Zapper)(v.RootServices))) err = multierr.Append(err, enc.AddArray("services", (_Map_ServiceID_Service_Zapper)(v.Services))) err = multierr.Append(err, enc.AddArray("modules", (_Map_ModuleID_Module_Zapper)(v.Modules))) enc.AddString("packagePrefix", v.PackagePrefix) enc.AddString("thriftRoot", v.ThriftRoot) return err }
go
func (v *GenerateServiceRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } err = multierr.Append(err, enc.AddArray("rootServices", (_List_ServiceID_Zapper)(v.RootServices))) err = multierr.Append(err, enc.AddArray("services", (_Map_ServiceID_Service_Zapper)(v.Services))) err = multierr.Append(err, enc.AddArray("modules", (_Map_ModuleID_Module_Zapper)(v.Modules))) enc.AddString("packagePrefix", v.PackagePrefix) enc.AddString("thriftRoot", v.ThriftRoot) return err }
[ "func", "(", "v", "*", "GenerateServiceRequest", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddArray", "(", "\"", "\"", ",", "(", "_List_ServiceID_Zapper", ")", "(", "v", ".", "RootServices", ")", ")", ")", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddArray", "(", "\"", "\"", ",", "(", "_Map_ServiceID_Service_Zapper", ")", "(", "v", ".", "Services", ")", ")", ")", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddArray", "(", "\"", "\"", ",", "(", "_Map_ModuleID_Module_Zapper", ")", "(", "v", ".", "Modules", ")", ")", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "PackagePrefix", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "ThriftRoot", ")", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of GenerateServiceRequest.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "GenerateServiceRequest", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1534-L1544
17,538
thriftrw/thriftrw-go
plugin/api/types.go
GetRootServices
func (v *GenerateServiceRequest) GetRootServices() (o []ServiceID) { if v != nil { o = v.RootServices } return }
go
func (v *GenerateServiceRequest) GetRootServices() (o []ServiceID) { if v != nil { o = v.RootServices } return }
[ "func", "(", "v", "*", "GenerateServiceRequest", ")", "GetRootServices", "(", ")", "(", "o", "[", "]", "ServiceID", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "RootServices", "\n", "}", "\n", "return", "\n", "}" ]
// GetRootServices returns the value of RootServices if it is set or its // zero value if it is unset.
[ "GetRootServices", "returns", "the", "value", "of", "RootServices", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1548-L1553
17,539
thriftrw/thriftrw-go
plugin/api/types.go
GetServices
func (v *GenerateServiceRequest) GetServices() (o map[ServiceID]*Service) { if v != nil { o = v.Services } return }
go
func (v *GenerateServiceRequest) GetServices() (o map[ServiceID]*Service) { if v != nil { o = v.Services } return }
[ "func", "(", "v", "*", "GenerateServiceRequest", ")", "GetServices", "(", ")", "(", "o", "map", "[", "ServiceID", "]", "*", "Service", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "Services", "\n", "}", "\n", "return", "\n", "}" ]
// GetServices returns the value of Services if it is set or its // zero value if it is unset.
[ "GetServices", "returns", "the", "value", "of", "Services", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1562-L1567
17,540
thriftrw/thriftrw-go
plugin/api/types.go
GetModules
func (v *GenerateServiceRequest) GetModules() (o map[ModuleID]*Module) { if v != nil { o = v.Modules } return }
go
func (v *GenerateServiceRequest) GetModules() (o map[ModuleID]*Module) { if v != nil { o = v.Modules } return }
[ "func", "(", "v", "*", "GenerateServiceRequest", ")", "GetModules", "(", ")", "(", "o", "map", "[", "ModuleID", "]", "*", "Module", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "Modules", "\n", "}", "\n", "return", "\n", "}" ]
// GetModules returns the value of Modules if it is set or its // zero value if it is unset.
[ "GetModules", "returns", "the", "value", "of", "Modules", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1576-L1581
17,541
thriftrw/thriftrw-go
plugin/api/types.go
GetPackagePrefix
func (v *GenerateServiceRequest) GetPackagePrefix() (o string) { if v != nil { o = v.PackagePrefix } return }
go
func (v *GenerateServiceRequest) GetPackagePrefix() (o string) { if v != nil { o = v.PackagePrefix } return }
[ "func", "(", "v", "*", "GenerateServiceRequest", ")", "GetPackagePrefix", "(", ")", "(", "o", "string", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "PackagePrefix", "\n", "}", "\n", "return", "\n", "}" ]
// GetPackagePrefix returns the value of PackagePrefix if it is set or its // zero value if it is unset.
[ "GetPackagePrefix", "returns", "the", "value", "of", "PackagePrefix", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1590-L1595
17,542
thriftrw/thriftrw-go
plugin/api/types.go
GetThriftRoot
func (v *GenerateServiceRequest) GetThriftRoot() (o string) { if v != nil { o = v.ThriftRoot } return }
go
func (v *GenerateServiceRequest) GetThriftRoot() (o string) { if v != nil { o = v.ThriftRoot } return }
[ "func", "(", "v", "*", "GenerateServiceRequest", ")", "GetThriftRoot", "(", ")", "(", "o", "string", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "ThriftRoot", "\n", "}", "\n", "return", "\n", "}" ]
// GetThriftRoot returns the value of ThriftRoot if it is set or its // zero value if it is unset.
[ "GetThriftRoot", "returns", "the", "value", "of", "ThriftRoot", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1599-L1604
17,543
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *GenerateServiceResponse) String() string { if v == nil { return "<nil>" } var fields [1]string i := 0 if v.Files != nil { fields[i] = fmt.Sprintf("Files: %v", v.Files) i++ } return fmt.Sprintf("GenerateServiceResponse{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *GenerateServiceResponse) String() string { if v == nil { return "<nil>" } var fields [1]string i := 0 if v.Files != nil { fields[i] = fmt.Sprintf("Files: %v", v.Files) i++ } return fmt.Sprintf("GenerateServiceResponse{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "GenerateServiceResponse", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "1", "]", "string", "\n", "i", ":=", "0", "\n", "if", "v", ".", "Files", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Files", ")", "\n", "i", "++", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a GenerateServiceResponse // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "GenerateServiceResponse", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1757-L1770
17,544
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *GenerateServiceResponse) Equals(rhs *GenerateServiceResponse) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !((v.Files == nil && rhs.Files == nil) || (v.Files != nil && rhs.Files != nil && _Map_String_Binary_Equals(v.Files, rhs.Files))) { return false } return true }
go
func (v *GenerateServiceResponse) Equals(rhs *GenerateServiceResponse) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !((v.Files == nil && rhs.Files == nil) || (v.Files != nil && rhs.Files != nil && _Map_String_Binary_Equals(v.Files, rhs.Files))) { return false } return true }
[ "func", "(", "v", "*", "GenerateServiceResponse", ")", "Equals", "(", "rhs", "*", "GenerateServiceResponse", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "Files", "==", "nil", "&&", "rhs", ".", "Files", "==", "nil", ")", "||", "(", "v", ".", "Files", "!=", "nil", "&&", "rhs", ".", "Files", "!=", "nil", "&&", "_Map_String_Binary_Equals", "(", "v", ".", "Files", ",", "rhs", ".", "Files", ")", ")", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this GenerateServiceResponse match the // provided GenerateServiceResponse. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "GenerateServiceResponse", "match", "the", "provided", "GenerateServiceResponse", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1793-L1804
17,545
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (m _Map_String_Binary_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { for k, v := range m { enc.AddString((string)(k), base64.StdEncoding.EncodeToString(v)) } return err }
go
func (m _Map_String_Binary_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { for k, v := range m { enc.AddString((string)(k), base64.StdEncoding.EncodeToString(v)) } return err }
[ "func", "(", "m", "_Map_String_Binary_Zapper", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "for", "k", ",", "v", ":=", "range", "m", "{", "enc", ".", "AddString", "(", "(", "string", ")", "(", "k", ")", ",", "base64", ".", "StdEncoding", ".", "EncodeToString", "(", "v", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of _Map_String_Binary_Zapper.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "_Map_String_Binary_Zapper", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1810-L1815
17,546
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *GenerateServiceResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } if v.Files != nil { err = multierr.Append(err, enc.AddObject("files", (_Map_String_Binary_Zapper)(v.Files))) } return err }
go
func (v *GenerateServiceResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } if v.Files != nil { err = multierr.Append(err, enc.AddObject("files", (_Map_String_Binary_Zapper)(v.Files))) } return err }
[ "func", "(", "v", "*", "GenerateServiceResponse", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "v", ".", "Files", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "(", "_Map_String_Binary_Zapper", ")", "(", "v", ".", "Files", ")", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of GenerateServiceResponse.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "GenerateServiceResponse", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1819-L1827
17,547
thriftrw/thriftrw-go
plugin/api/types.go
GetFiles
func (v *GenerateServiceResponse) GetFiles() (o map[string][]byte) { if v != nil && v.Files != nil { return v.Files } return }
go
func (v *GenerateServiceResponse) GetFiles() (o map[string][]byte) { if v != nil && v.Files != nil { return v.Files } return }
[ "func", "(", "v", "*", "GenerateServiceResponse", ")", "GetFiles", "(", ")", "(", "o", "map", "[", "string", "]", "[", "]", "byte", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Files", "!=", "nil", "{", "return", "v", ".", "Files", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetFiles returns the value of Files if it is set or its // zero value if it is unset.
[ "GetFiles", "returns", "the", "value", "of", "Files", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1831-L1837
17,548
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *HandshakeRequest) String() string { if v == nil { return "<nil>" } var fields [0]string i := 0 return fmt.Sprintf("HandshakeRequest{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *HandshakeRequest) String() string { if v == nil { return "<nil>" } var fields [0]string i := 0 return fmt.Sprintf("HandshakeRequest{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "HandshakeRequest", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "0", "]", "string", "\n", "i", ":=", "0", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a HandshakeRequest // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "HandshakeRequest", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1902-L1911
17,549
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *HandshakeRequest) Equals(rhs *HandshakeRequest) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } return true }
go
func (v *HandshakeRequest) Equals(rhs *HandshakeRequest) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } return true }
[ "func", "(", "v", "*", "HandshakeRequest", ")", "Equals", "(", "rhs", "*", "HandshakeRequest", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this HandshakeRequest match the // provided HandshakeRequest. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "HandshakeRequest", "match", "the", "provided", "HandshakeRequest", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1917-L1925
17,550
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *HandshakeRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } return err }
go
func (v *HandshakeRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } return err }
[ "func", "(", "v", "*", "HandshakeRequest", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of HandshakeRequest.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "HandshakeRequest", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L1929-L1934
17,551
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *HandshakeResponse) String() string { if v == nil { return "<nil>" } var fields [4]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("APIVersion: %v", v.APIVersion) i++ fields[i] = fmt.Sprintf("Features: %v", v.Features) i++ if v.LibraryVersion != nil { fields[i] = fmt.Sprintf("LibraryVersion: %v", *(v.LibraryVersion)) i++ } return fmt.Sprintf("HandshakeResponse{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *HandshakeResponse) String() string { if v == nil { return "<nil>" } var fields [4]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("APIVersion: %v", v.APIVersion) i++ fields[i] = fmt.Sprintf("Features: %v", v.Features) i++ if v.LibraryVersion != nil { fields[i] = fmt.Sprintf("LibraryVersion: %v", *(v.LibraryVersion)) i++ } return fmt.Sprintf("HandshakeResponse{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "HandshakeResponse", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "4", "]", "string", "\n", "i", ":=", "0", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "APIVersion", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Features", ")", "\n", "i", "++", "\n", "if", "v", ".", "LibraryVersion", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*", "(", "v", ".", "LibraryVersion", ")", ")", "\n", "i", "++", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a HandshakeResponse // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "HandshakeResponse", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2141-L2160
17,552
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *HandshakeResponse) Equals(rhs *HandshakeResponse) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !(v.APIVersion == rhs.APIVersion) { return false } if !_List_Feature_Equals(v.Features, rhs.Features) { return false } if !_String_EqualsPtr(v.LibraryVersion, rhs.LibraryVersion) { return false } return true }
go
func (v *HandshakeResponse) Equals(rhs *HandshakeResponse) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !(v.APIVersion == rhs.APIVersion) { return false } if !_List_Feature_Equals(v.Features, rhs.Features) { return false } if !_String_EqualsPtr(v.LibraryVersion, rhs.LibraryVersion) { return false } return true }
[ "func", "(", "v", "*", "HandshakeResponse", ")", "Equals", "(", "rhs", "*", "HandshakeResponse", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "Name", "==", "rhs", ".", "Name", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "APIVersion", "==", "rhs", ".", "APIVersion", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "_List_Feature_Equals", "(", "v", ".", "Features", ",", "rhs", ".", "Features", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "_String_EqualsPtr", "(", "v", ".", "LibraryVersion", ",", "rhs", ".", "LibraryVersion", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this HandshakeResponse match the // provided HandshakeResponse. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "HandshakeResponse", "match", "the", "provided", "HandshakeResponse", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2191-L2211
17,553
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *HandshakeResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) enc.AddInt32("apiVersion", v.APIVersion) err = multierr.Append(err, enc.AddArray("features", (_List_Feature_Zapper)(v.Features))) if v.LibraryVersion != nil { enc.AddString("libraryVersion", *v.LibraryVersion) } return err }
go
func (v *HandshakeResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) enc.AddInt32("apiVersion", v.APIVersion) err = multierr.Append(err, enc.AddArray("features", (_List_Feature_Zapper)(v.Features))) if v.LibraryVersion != nil { enc.AddString("libraryVersion", *v.LibraryVersion) } return err }
[ "func", "(", "v", "*", "HandshakeResponse", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "enc", ".", "AddInt32", "(", "\"", "\"", ",", "v", ".", "APIVersion", ")", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddArray", "(", "\"", "\"", ",", "(", "_List_Feature_Zapper", ")", "(", "v", ".", "Features", ")", ")", ")", "\n", "if", "v", ".", "LibraryVersion", "!=", "nil", "{", "enc", ".", "AddString", "(", "\"", "\"", ",", "*", "v", ".", "LibraryVersion", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of HandshakeResponse.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "HandshakeResponse", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2226-L2237
17,554
thriftrw/thriftrw-go
plugin/api/types.go
GetAPIVersion
func (v *HandshakeResponse) GetAPIVersion() (o int32) { if v != nil { o = v.APIVersion } return }
go
func (v *HandshakeResponse) GetAPIVersion() (o int32) { if v != nil { o = v.APIVersion } return }
[ "func", "(", "v", "*", "HandshakeResponse", ")", "GetAPIVersion", "(", ")", "(", "o", "int32", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "APIVersion", "\n", "}", "\n", "return", "\n", "}" ]
// GetAPIVersion returns the value of APIVersion if it is set or its // zero value if it is unset.
[ "GetAPIVersion", "returns", "the", "value", "of", "APIVersion", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2250-L2255
17,555
thriftrw/thriftrw-go
plugin/api/types.go
GetFeatures
func (v *HandshakeResponse) GetFeatures() (o []Feature) { if v != nil { o = v.Features } return }
go
func (v *HandshakeResponse) GetFeatures() (o []Feature) { if v != nil { o = v.Features } return }
[ "func", "(", "v", "*", "HandshakeResponse", ")", "GetFeatures", "(", ")", "(", "o", "[", "]", "Feature", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "Features", "\n", "}", "\n", "return", "\n", "}" ]
// GetFeatures returns the value of Features if it is set or its // zero value if it is unset.
[ "GetFeatures", "returns", "the", "value", "of", "Features", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2259-L2264
17,556
thriftrw/thriftrw-go
plugin/api/types.go
GetLibraryVersion
func (v *HandshakeResponse) GetLibraryVersion() (o string) { if v != nil && v.LibraryVersion != nil { return *v.LibraryVersion } return }
go
func (v *HandshakeResponse) GetLibraryVersion() (o string) { if v != nil && v.LibraryVersion != nil { return *v.LibraryVersion } return }
[ "func", "(", "v", "*", "HandshakeResponse", ")", "GetLibraryVersion", "(", ")", "(", "o", "string", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "LibraryVersion", "!=", "nil", "{", "return", "*", "v", ".", "LibraryVersion", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetLibraryVersion returns the value of LibraryVersion if it is set or its // zero value if it is unset.
[ "GetLibraryVersion", "returns", "the", "value", "of", "LibraryVersion", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2273-L2279
17,557
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *Module) String() string { if v == nil { return "<nil>" } var fields [3]string i := 0 fields[i] = fmt.Sprintf("ImportPath: %v", v.ImportPath) i++ fields[i] = fmt.Sprintf("Directory: %v", v.Directory) i++ fields[i] = fmt.Sprintf("ThriftFilePath: %v", v.ThriftFilePath) i++ return fmt.Sprintf("Module{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *Module) String() string { if v == nil { return "<nil>" } var fields [3]string i := 0 fields[i] = fmt.Sprintf("ImportPath: %v", v.ImportPath) i++ fields[i] = fmt.Sprintf("Directory: %v", v.Directory) i++ fields[i] = fmt.Sprintf("ThriftFilePath: %v", v.ThriftFilePath) i++ return fmt.Sprintf("Module{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "Module", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "3", "]", "string", "\n", "i", ":=", "0", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ImportPath", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Directory", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ThriftFilePath", ")", "\n", "i", "++", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a Module // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "Module", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2419-L2434
17,558
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *Module) Equals(rhs *Module) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.ImportPath == rhs.ImportPath) { return false } if !(v.Directory == rhs.Directory) { return false } if !(v.ThriftFilePath == rhs.ThriftFilePath) { return false } return true }
go
func (v *Module) Equals(rhs *Module) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.ImportPath == rhs.ImportPath) { return false } if !(v.Directory == rhs.Directory) { return false } if !(v.ThriftFilePath == rhs.ThriftFilePath) { return false } return true }
[ "func", "(", "v", "*", "Module", ")", "Equals", "(", "rhs", "*", "Module", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "ImportPath", "==", "rhs", ".", "ImportPath", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "Directory", "==", "rhs", ".", "Directory", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "ThriftFilePath", "==", "rhs", ".", "ThriftFilePath", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this Module match the // provided Module. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "Module", "match", "the", "provided", "Module", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2440-L2457
17,559
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *Module) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("importPath", v.ImportPath) enc.AddString("directory", v.Directory) enc.AddString("thriftFilePath", v.ThriftFilePath) return err }
go
func (v *Module) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("importPath", v.ImportPath) enc.AddString("directory", v.Directory) enc.AddString("thriftFilePath", v.ThriftFilePath) return err }
[ "func", "(", "v", "*", "Module", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "ImportPath", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "Directory", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "ThriftFilePath", ")", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of Module.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "Module", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2461-L2469
17,560
thriftrw/thriftrw-go
plugin/api/types.go
GetDirectory
func (v *Module) GetDirectory() (o string) { if v != nil { o = v.Directory } return }
go
func (v *Module) GetDirectory() (o string) { if v != nil { o = v.Directory } return }
[ "func", "(", "v", "*", "Module", ")", "GetDirectory", "(", ")", "(", "o", "string", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "Directory", "\n", "}", "\n", "return", "\n", "}" ]
// GetDirectory returns the value of Directory if it is set or its // zero value if it is unset.
[ "GetDirectory", "returns", "the", "value", "of", "Directory", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2482-L2487
17,561
thriftrw/thriftrw-go
plugin/api/types.go
GetThriftFilePath
func (v *Module) GetThriftFilePath() (o string) { if v != nil { o = v.ThriftFilePath } return }
go
func (v *Module) GetThriftFilePath() (o string) { if v != nil { o = v.ThriftFilePath } return }
[ "func", "(", "v", "*", "Module", ")", "GetThriftFilePath", "(", ")", "(", "o", "string", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "ThriftFilePath", "\n", "}", "\n", "return", "\n", "}" ]
// GetThriftFilePath returns the value of ThriftFilePath if it is set or its // zero value if it is unset.
[ "GetThriftFilePath", "returns", "the", "value", "of", "ThriftFilePath", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2491-L2496
17,562
thriftrw/thriftrw-go
plugin/api/types.go
ToWire
func (v ModuleID) ToWire() (wire.Value, error) { x := (int32)(v) return wire.NewValueI32(x), error(nil) }
go
func (v ModuleID) ToWire() (wire.Value, error) { x := (int32)(v) return wire.NewValueI32(x), error(nil) }
[ "func", "(", "v", "ModuleID", ")", "ToWire", "(", ")", "(", "wire", ".", "Value", ",", "error", ")", "{", "x", ":=", "(", "int32", ")", "(", "v", ")", "\n", "return", "wire", ".", "NewValueI32", "(", "x", ")", ",", "error", "(", "nil", ")", "\n", "}" ]
// ToWire translates ModuleID into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation.
[ "ToWire", "translates", "ModuleID", "into", "a", "Thrift", "-", "level", "intermediate", "representation", ".", "This", "intermediate", "representation", "may", "be", "serialized", "into", "bytes", "using", "a", "ThriftRW", "protocol", "implementation", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2510-L2513
17,563
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v ModuleID) String() string { x := (int32)(v) return fmt.Sprint(x) }
go
func (v ModuleID) String() string { x := (int32)(v) return fmt.Sprint(x) }
[ "func", "(", "v", "ModuleID", ")", "String", "(", ")", "string", "{", "x", ":=", "(", "int32", ")", "(", "v", ")", "\n", "return", "fmt", ".", "Sprint", "(", "x", ")", "\n", "}" ]
// String returns a readable string representation of ModuleID.
[ "String", "returns", "a", "readable", "string", "representation", "of", "ModuleID", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2516-L2519
17,564
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (lhs ModuleID) Equals(rhs ModuleID) bool { return ((int32)(lhs) == (int32)(rhs)) }
go
func (lhs ModuleID) Equals(rhs ModuleID) bool { return ((int32)(lhs) == (int32)(rhs)) }
[ "func", "(", "lhs", "ModuleID", ")", "Equals", "(", "rhs", "ModuleID", ")", "bool", "{", "return", "(", "(", "int32", ")", "(", "lhs", ")", "==", "(", "int32", ")", "(", "rhs", ")", ")", "\n", "}" ]
// Equals returns true if this ModuleID is equal to the provided // ModuleID.
[ "Equals", "returns", "true", "if", "this", "ModuleID", "is", "equal", "to", "the", "provided", "ModuleID", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2532-L2534
17,565
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *Service) String() string { if v == nil { return "<nil>" } var fields [6]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("ThriftName: %v", v.ThriftName) i++ if v.ParentID != nil { fields[i] = fmt.Sprintf("ParentID: %v", *(v.ParentID)) i++ } fields[i] = fmt.Sprintf("Functions: %v", v.Functions) i++ fields[i] = fmt.Sprintf("ModuleID: %v", v.ModuleID) i++ if v.Annotations != nil { fields[i] = fmt.Sprintf("Annotations: %v", v.Annotations) i++ } return fmt.Sprintf("Service{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *Service) String() string { if v == nil { return "<nil>" } var fields [6]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("ThriftName: %v", v.ThriftName) i++ if v.ParentID != nil { fields[i] = fmt.Sprintf("ParentID: %v", *(v.ParentID)) i++ } fields[i] = fmt.Sprintf("Functions: %v", v.Functions) i++ fields[i] = fmt.Sprintf("ModuleID: %v", v.ModuleID) i++ if v.Annotations != nil { fields[i] = fmt.Sprintf("Annotations: %v", v.Annotations) i++ } return fmt.Sprintf("Service{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "Service", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "6", "]", "string", "\n", "i", ":=", "0", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ThriftName", ")", "\n", "i", "++", "\n", "if", "v", ".", "ParentID", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*", "(", "v", ".", "ParentID", ")", ")", "\n", "i", "++", "\n", "}", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Functions", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ModuleID", ")", "\n", "i", "++", "\n", "if", "v", ".", "Annotations", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Annotations", ")", "\n", "i", "++", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a Service // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "Service", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2790-L2815
17,566
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *Service) Equals(rhs *Service) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !(v.ThriftName == rhs.ThriftName) { return false } if !_ServiceID_EqualsPtr(v.ParentID, rhs.ParentID) { return false } if !_List_Function_Equals(v.Functions, rhs.Functions) { return false } if !(v.ModuleID == rhs.ModuleID) { return false } if !((v.Annotations == nil && rhs.Annotations == nil) || (v.Annotations != nil && rhs.Annotations != nil && _Map_String_String_Equals(v.Annotations, rhs.Annotations))) { return false } return true }
go
func (v *Service) Equals(rhs *Service) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !(v.ThriftName == rhs.ThriftName) { return false } if !_ServiceID_EqualsPtr(v.ParentID, rhs.ParentID) { return false } if !_List_Function_Equals(v.Functions, rhs.Functions) { return false } if !(v.ModuleID == rhs.ModuleID) { return false } if !((v.Annotations == nil && rhs.Annotations == nil) || (v.Annotations != nil && rhs.Annotations != nil && _Map_String_String_Equals(v.Annotations, rhs.Annotations))) { return false } return true }
[ "func", "(", "v", "*", "Service", ")", "Equals", "(", "rhs", "*", "Service", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "Name", "==", "rhs", ".", "Name", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "ThriftName", "==", "rhs", ".", "ThriftName", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "_ServiceID_EqualsPtr", "(", "v", ".", "ParentID", ",", "rhs", ".", "ParentID", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "_List_Function_Equals", "(", "v", ".", "Functions", ",", "rhs", ".", "Functions", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "ModuleID", "==", "rhs", ".", "ModuleID", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "Annotations", "==", "nil", "&&", "rhs", ".", "Annotations", "==", "nil", ")", "||", "(", "v", ".", "Annotations", "!=", "nil", "&&", "rhs", ".", "Annotations", "!=", "nil", "&&", "_Map_String_String_Equals", "(", "v", ".", "Annotations", ",", "rhs", ".", "Annotations", ")", ")", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this Service match the // provided Service. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "Service", "match", "the", "provided", "Service", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2846-L2872
17,567
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *Service) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) enc.AddString("thriftName", v.ThriftName) if v.ParentID != nil { enc.AddInt32("parentID", (int32)(*v.ParentID)) } err = multierr.Append(err, enc.AddArray("functions", (_List_Function_Zapper)(v.Functions))) enc.AddInt32("moduleID", (int32)(v.ModuleID)) if v.Annotations != nil { err = multierr.Append(err, enc.AddObject("annotations", (_Map_String_String_Zapper)(v.Annotations))) } return err }
go
func (v *Service) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) enc.AddString("thriftName", v.ThriftName) if v.ParentID != nil { enc.AddInt32("parentID", (int32)(*v.ParentID)) } err = multierr.Append(err, enc.AddArray("functions", (_List_Function_Zapper)(v.Functions))) enc.AddInt32("moduleID", (int32)(v.ModuleID)) if v.Annotations != nil { err = multierr.Append(err, enc.AddObject("annotations", (_Map_String_String_Zapper)(v.Annotations))) } return err }
[ "func", "(", "v", "*", "Service", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "ThriftName", ")", "\n", "if", "v", ".", "ParentID", "!=", "nil", "{", "enc", ".", "AddInt32", "(", "\"", "\"", ",", "(", "int32", ")", "(", "*", "v", ".", "ParentID", ")", ")", "\n", "}", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddArray", "(", "\"", "\"", ",", "(", "_List_Function_Zapper", ")", "(", "v", ".", "Functions", ")", ")", ")", "\n", "enc", ".", "AddInt32", "(", "\"", "\"", ",", "(", "int32", ")", "(", "v", ".", "ModuleID", ")", ")", "\n", "if", "v", ".", "Annotations", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "(", "_Map_String_String_Zapper", ")", "(", "v", ".", "Annotations", ")", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of Service.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "Service", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2887-L2902
17,568
thriftrw/thriftrw-go
plugin/api/types.go
GetParentID
func (v *Service) GetParentID() (o ServiceID) { if v != nil && v.ParentID != nil { return *v.ParentID } return }
go
func (v *Service) GetParentID() (o ServiceID) { if v != nil && v.ParentID != nil { return *v.ParentID } return }
[ "func", "(", "v", "*", "Service", ")", "GetParentID", "(", ")", "(", "o", "ServiceID", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "ParentID", "!=", "nil", "{", "return", "*", "v", ".", "ParentID", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetParentID returns the value of ParentID if it is set or its // zero value if it is unset.
[ "GetParentID", "returns", "the", "value", "of", "ParentID", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2924-L2930
17,569
thriftrw/thriftrw-go
plugin/api/types.go
GetFunctions
func (v *Service) GetFunctions() (o []*Function) { if v != nil { o = v.Functions } return }
go
func (v *Service) GetFunctions() (o []*Function) { if v != nil { o = v.Functions } return }
[ "func", "(", "v", "*", "Service", ")", "GetFunctions", "(", ")", "(", "o", "[", "]", "*", "Function", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "Functions", "\n", "}", "\n", "return", "\n", "}" ]
// GetFunctions returns the value of Functions if it is set or its // zero value if it is unset.
[ "GetFunctions", "returns", "the", "value", "of", "Functions", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2939-L2944
17,570
thriftrw/thriftrw-go
plugin/api/types.go
GetModuleID
func (v *Service) GetModuleID() (o ModuleID) { if v != nil { o = v.ModuleID } return }
go
func (v *Service) GetModuleID() (o ModuleID) { if v != nil { o = v.ModuleID } return }
[ "func", "(", "v", "*", "Service", ")", "GetModuleID", "(", ")", "(", "o", "ModuleID", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "ModuleID", "\n", "}", "\n", "return", "\n", "}" ]
// GetModuleID returns the value of ModuleID if it is set or its // zero value if it is unset.
[ "GetModuleID", "returns", "the", "value", "of", "ModuleID", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2953-L2958
17,571
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v ServiceID) String() string { x := (int32)(v) return fmt.Sprint(x) }
go
func (v ServiceID) String() string { x := (int32)(v) return fmt.Sprint(x) }
[ "func", "(", "v", "ServiceID", ")", "String", "(", ")", "string", "{", "x", ":=", "(", "int32", ")", "(", "v", ")", "\n", "return", "fmt", ".", "Sprint", "(", "x", ")", "\n", "}" ]
// String returns a readable string representation of ServiceID.
[ "String", "returns", "a", "readable", "string", "representation", "of", "ServiceID", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L2993-L2996
17,572
thriftrw/thriftrw-go
plugin/api/types.go
FromWire
func (v *ServiceID) FromWire(w wire.Value) error { x, err := w.GetI32(), error(nil) *v = (ServiceID)(x) return err }
go
func (v *ServiceID) FromWire(w wire.Value) error { x, err := w.GetI32(), error(nil) *v = (ServiceID)(x) return err }
[ "func", "(", "v", "*", "ServiceID", ")", "FromWire", "(", "w", "wire", ".", "Value", ")", "error", "{", "x", ",", "err", ":=", "w", ".", "GetI32", "(", ")", ",", "error", "(", "nil", ")", "\n", "*", "v", "=", "(", "ServiceID", ")", "(", "x", ")", "\n", "return", "err", "\n", "}" ]
// FromWire deserializes ServiceID from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation.
[ "FromWire", "deserializes", "ServiceID", "from", "its", "Thrift", "-", "level", "representation", ".", "The", "Thrift", "-", "level", "representation", "may", "be", "obtained", "from", "a", "ThriftRW", "protocol", "implementation", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3001-L3005
17,573
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (lhs ServiceID) Equals(rhs ServiceID) bool { return ((int32)(lhs) == (int32)(rhs)) }
go
func (lhs ServiceID) Equals(rhs ServiceID) bool { return ((int32)(lhs) == (int32)(rhs)) }
[ "func", "(", "lhs", "ServiceID", ")", "Equals", "(", "rhs", "ServiceID", ")", "bool", "{", "return", "(", "(", "int32", ")", "(", "lhs", ")", "==", "(", "int32", ")", "(", "rhs", ")", ")", "\n", "}" ]
// Equals returns true if this ServiceID is equal to the provided // ServiceID.
[ "Equals", "returns", "true", "if", "this", "ServiceID", "is", "equal", "to", "the", "provided", "ServiceID", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3009-L3011
17,574
thriftrw/thriftrw-go
plugin/api/types.go
SimpleType_Values
func SimpleType_Values() []SimpleType { return []SimpleType{ SimpleTypeBool, SimpleTypeByte, SimpleTypeInt8, SimpleTypeInt16, SimpleTypeInt32, SimpleTypeInt64, SimpleTypeFloat64, SimpleTypeString, SimpleTypeStructEmpty, } }
go
func SimpleType_Values() []SimpleType { return []SimpleType{ SimpleTypeBool, SimpleTypeByte, SimpleTypeInt8, SimpleTypeInt16, SimpleTypeInt32, SimpleTypeInt64, SimpleTypeFloat64, SimpleTypeString, SimpleTypeStructEmpty, } }
[ "func", "SimpleType_Values", "(", ")", "[", "]", "SimpleType", "{", "return", "[", "]", "SimpleType", "{", "SimpleTypeBool", ",", "SimpleTypeByte", ",", "SimpleTypeInt8", ",", "SimpleTypeInt16", ",", "SimpleTypeInt32", ",", "SimpleTypeInt64", ",", "SimpleTypeFloat64", ",", "SimpleTypeString", ",", "SimpleTypeStructEmpty", ",", "}", "\n", "}" ]
// SimpleType_Values returns all recognized values of SimpleType.
[ "SimpleType_Values", "returns", "all", "recognized", "values", "of", "SimpleType", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3029-L3041
17,575
thriftrw/thriftrw-go
plugin/api/types.go
ToWire
func (v SimpleType) ToWire() (wire.Value, error) { return wire.NewValueI32(int32(v)), nil }
go
func (v SimpleType) ToWire() (wire.Value, error) { return wire.NewValueI32(int32(v)), nil }
[ "func", "(", "v", "SimpleType", ")", "ToWire", "(", ")", "(", "wire", ".", "Value", ",", "error", ")", "{", "return", "wire", ".", "NewValueI32", "(", "int32", "(", "v", ")", ")", ",", "nil", "\n", "}" ]
// ToWire translates SimpleType into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // // Enums are represented as 32-bit integers over the wire.
[ "ToWire", "translates", "SimpleType", "into", "a", "Thrift", "-", "level", "intermediate", "representation", ".", "This", "intermediate", "representation", "may", "be", "serialized", "into", "bytes", "using", "a", "ThriftRW", "protocol", "implementation", ".", "Enums", "are", "represented", "as", "32", "-", "bit", "integers", "over", "the", "wire", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3156-L3158
17,576
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v SimpleType) String() string { w := int32(v) switch w { case 1: return "BOOL" case 2: return "BYTE" case 3: return "INT8" case 4: return "INT16" case 5: return "INT32" case 6: return "INT64" case 7: return "FLOAT64" case 8: return "STRING" case 9: return "STRUCT_EMPTY" } return fmt.Sprintf("SimpleType(%d)", w) }
go
func (v SimpleType) String() string { w := int32(v) switch w { case 1: return "BOOL" case 2: return "BYTE" case 3: return "INT8" case 4: return "INT16" case 5: return "INT32" case 6: return "INT64" case 7: return "FLOAT64" case 8: return "STRING" case 9: return "STRUCT_EMPTY" } return fmt.Sprintf("SimpleType(%d)", w) }
[ "func", "(", "v", "SimpleType", ")", "String", "(", ")", "string", "{", "w", ":=", "int32", "(", "v", ")", "\n", "switch", "w", "{", "case", "1", ":", "return", "\"", "\"", "\n", "case", "2", ":", "return", "\"", "\"", "\n", "case", "3", ":", "return", "\"", "\"", "\n", "case", "4", ":", "return", "\"", "\"", "\n", "case", "5", ":", "return", "\"", "\"", "\n", "case", "6", ":", "return", "\"", "\"", "\n", "case", "7", ":", "return", "\"", "\"", "\n", "case", "8", ":", "return", "\"", "\"", "\n", "case", "9", ":", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "w", ")", "\n", "}" ]
// String returns a readable string representation of SimpleType.
[ "String", "returns", "a", "readable", "string", "representation", "of", "SimpleType", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3179-L3202
17,577
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *Type) String() string { if v == nil { return "<nil>" } var fields [6]string i := 0 if v.SimpleType != nil { fields[i] = fmt.Sprintf("SimpleType: %v", *(v.SimpleType)) i++ } if v.SliceType != nil { fields[i] = fmt.Sprintf("SliceType: %v", v.SliceType) i++ } if v.KeyValueSliceType != nil { fields[i] = fmt.Sprintf("KeyValueSliceType: %v", v.KeyValueSliceType) i++ } if v.MapType != nil { fields[i] = fmt.Sprintf("MapType: %v", v.MapType) i++ } if v.ReferenceType != nil { fields[i] = fmt.Sprintf("ReferenceType: %v", v.ReferenceType) i++ } if v.PointerType != nil { fields[i] = fmt.Sprintf("PointerType: %v", v.PointerType) i++ } return fmt.Sprintf("Type{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *Type) String() string { if v == nil { return "<nil>" } var fields [6]string i := 0 if v.SimpleType != nil { fields[i] = fmt.Sprintf("SimpleType: %v", *(v.SimpleType)) i++ } if v.SliceType != nil { fields[i] = fmt.Sprintf("SliceType: %v", v.SliceType) i++ } if v.KeyValueSliceType != nil { fields[i] = fmt.Sprintf("KeyValueSliceType: %v", v.KeyValueSliceType) i++ } if v.MapType != nil { fields[i] = fmt.Sprintf("MapType: %v", v.MapType) i++ } if v.ReferenceType != nil { fields[i] = fmt.Sprintf("ReferenceType: %v", v.ReferenceType) i++ } if v.PointerType != nil { fields[i] = fmt.Sprintf("PointerType: %v", v.PointerType) i++ } return fmt.Sprintf("Type{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "Type", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "6", "]", "string", "\n", "i", ":=", "0", "\n", "if", "v", ".", "SimpleType", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*", "(", "v", ".", "SimpleType", ")", ")", "\n", "i", "++", "\n", "}", "\n", "if", "v", ".", "SliceType", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "SliceType", ")", "\n", "i", "++", "\n", "}", "\n", "if", "v", ".", "KeyValueSliceType", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "KeyValueSliceType", ")", "\n", "i", "++", "\n", "}", "\n", "if", "v", ".", "MapType", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "MapType", ")", "\n", "i", "++", "\n", "}", "\n", "if", "v", ".", "ReferenceType", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ReferenceType", ")", "\n", "i", "++", "\n", "}", "\n", "if", "v", ".", "PointerType", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "PointerType", ")", "\n", "i", "++", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a Type // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "Type", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3497-L3530
17,578
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *Type) Equals(rhs *Type) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !_SimpleType_EqualsPtr(v.SimpleType, rhs.SimpleType) { return false } if !((v.SliceType == nil && rhs.SliceType == nil) || (v.SliceType != nil && rhs.SliceType != nil && v.SliceType.Equals(rhs.SliceType))) { return false } if !((v.KeyValueSliceType == nil && rhs.KeyValueSliceType == nil) || (v.KeyValueSliceType != nil && rhs.KeyValueSliceType != nil && v.KeyValueSliceType.Equals(rhs.KeyValueSliceType))) { return false } if !((v.MapType == nil && rhs.MapType == nil) || (v.MapType != nil && rhs.MapType != nil && v.MapType.Equals(rhs.MapType))) { return false } if !((v.ReferenceType == nil && rhs.ReferenceType == nil) || (v.ReferenceType != nil && rhs.ReferenceType != nil && v.ReferenceType.Equals(rhs.ReferenceType))) { return false } if !((v.PointerType == nil && rhs.PointerType == nil) || (v.PointerType != nil && rhs.PointerType != nil && v.PointerType.Equals(rhs.PointerType))) { return false } return true }
go
func (v *Type) Equals(rhs *Type) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !_SimpleType_EqualsPtr(v.SimpleType, rhs.SimpleType) { return false } if !((v.SliceType == nil && rhs.SliceType == nil) || (v.SliceType != nil && rhs.SliceType != nil && v.SliceType.Equals(rhs.SliceType))) { return false } if !((v.KeyValueSliceType == nil && rhs.KeyValueSliceType == nil) || (v.KeyValueSliceType != nil && rhs.KeyValueSliceType != nil && v.KeyValueSliceType.Equals(rhs.KeyValueSliceType))) { return false } if !((v.MapType == nil && rhs.MapType == nil) || (v.MapType != nil && rhs.MapType != nil && v.MapType.Equals(rhs.MapType))) { return false } if !((v.ReferenceType == nil && rhs.ReferenceType == nil) || (v.ReferenceType != nil && rhs.ReferenceType != nil && v.ReferenceType.Equals(rhs.ReferenceType))) { return false } if !((v.PointerType == nil && rhs.PointerType == nil) || (v.PointerType != nil && rhs.PointerType != nil && v.PointerType.Equals(rhs.PointerType))) { return false } return true }
[ "func", "(", "v", "*", "Type", ")", "Equals", "(", "rhs", "*", "Type", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "_SimpleType_EqualsPtr", "(", "v", ".", "SimpleType", ",", "rhs", ".", "SimpleType", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "SliceType", "==", "nil", "&&", "rhs", ".", "SliceType", "==", "nil", ")", "||", "(", "v", ".", "SliceType", "!=", "nil", "&&", "rhs", ".", "SliceType", "!=", "nil", "&&", "v", ".", "SliceType", ".", "Equals", "(", "rhs", ".", "SliceType", ")", ")", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "KeyValueSliceType", "==", "nil", "&&", "rhs", ".", "KeyValueSliceType", "==", "nil", ")", "||", "(", "v", ".", "KeyValueSliceType", "!=", "nil", "&&", "rhs", ".", "KeyValueSliceType", "!=", "nil", "&&", "v", ".", "KeyValueSliceType", ".", "Equals", "(", "rhs", ".", "KeyValueSliceType", ")", ")", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "MapType", "==", "nil", "&&", "rhs", ".", "MapType", "==", "nil", ")", "||", "(", "v", ".", "MapType", "!=", "nil", "&&", "rhs", ".", "MapType", "!=", "nil", "&&", "v", ".", "MapType", ".", "Equals", "(", "rhs", ".", "MapType", ")", ")", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "ReferenceType", "==", "nil", "&&", "rhs", ".", "ReferenceType", "==", "nil", ")", "||", "(", "v", ".", "ReferenceType", "!=", "nil", "&&", "rhs", ".", "ReferenceType", "!=", "nil", "&&", "v", ".", "ReferenceType", ".", "Equals", "(", "rhs", ".", "ReferenceType", ")", ")", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "PointerType", "==", "nil", "&&", "rhs", ".", "PointerType", "==", "nil", ")", "||", "(", "v", ".", "PointerType", "!=", "nil", "&&", "rhs", ".", "PointerType", "!=", "nil", "&&", "v", ".", "PointerType", ".", "Equals", "(", "rhs", ".", "PointerType", ")", ")", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this Type match the // provided Type. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "Type", "match", "the", "provided", "Type", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3546-L3572
17,579
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *Type) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } if v.SimpleType != nil { err = multierr.Append(err, enc.AddObject("simpleType", *v.SimpleType)) } if v.SliceType != nil { err = multierr.Append(err, enc.AddObject("sliceType", v.SliceType)) } if v.KeyValueSliceType != nil { err = multierr.Append(err, enc.AddObject("keyValueSliceType", v.KeyValueSliceType)) } if v.MapType != nil { err = multierr.Append(err, enc.AddObject("mapType", v.MapType)) } if v.ReferenceType != nil { err = multierr.Append(err, enc.AddObject("referenceType", v.ReferenceType)) } if v.PointerType != nil { err = multierr.Append(err, enc.AddObject("pointerType", v.PointerType)) } return err }
go
func (v *Type) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } if v.SimpleType != nil { err = multierr.Append(err, enc.AddObject("simpleType", *v.SimpleType)) } if v.SliceType != nil { err = multierr.Append(err, enc.AddObject("sliceType", v.SliceType)) } if v.KeyValueSliceType != nil { err = multierr.Append(err, enc.AddObject("keyValueSliceType", v.KeyValueSliceType)) } if v.MapType != nil { err = multierr.Append(err, enc.AddObject("mapType", v.MapType)) } if v.ReferenceType != nil { err = multierr.Append(err, enc.AddObject("referenceType", v.ReferenceType)) } if v.PointerType != nil { err = multierr.Append(err, enc.AddObject("pointerType", v.PointerType)) } return err }
[ "func", "(", "v", "*", "Type", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "v", ".", "SimpleType", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "*", "v", ".", "SimpleType", ")", ")", "\n", "}", "\n", "if", "v", ".", "SliceType", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "SliceType", ")", ")", "\n", "}", "\n", "if", "v", ".", "KeyValueSliceType", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "KeyValueSliceType", ")", ")", "\n", "}", "\n", "if", "v", ".", "MapType", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "MapType", ")", ")", "\n", "}", "\n", "if", "v", ".", "ReferenceType", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "ReferenceType", ")", ")", "\n", "}", "\n", "if", "v", ".", "PointerType", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "PointerType", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of Type.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "Type", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3576-L3599
17,580
thriftrw/thriftrw-go
plugin/api/types.go
GetSimpleType
func (v *Type) GetSimpleType() (o SimpleType) { if v != nil && v.SimpleType != nil { return *v.SimpleType } return }
go
func (v *Type) GetSimpleType() (o SimpleType) { if v != nil && v.SimpleType != nil { return *v.SimpleType } return }
[ "func", "(", "v", "*", "Type", ")", "GetSimpleType", "(", ")", "(", "o", "SimpleType", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "SimpleType", "!=", "nil", "{", "return", "*", "v", ".", "SimpleType", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetSimpleType returns the value of SimpleType if it is set or its // zero value if it is unset.
[ "GetSimpleType", "returns", "the", "value", "of", "SimpleType", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3603-L3609
17,581
thriftrw/thriftrw-go
plugin/api/types.go
GetSliceType
func (v *Type) GetSliceType() (o *Type) { if v != nil && v.SliceType != nil { return v.SliceType } return }
go
func (v *Type) GetSliceType() (o *Type) { if v != nil && v.SliceType != nil { return v.SliceType } return }
[ "func", "(", "v", "*", "Type", ")", "GetSliceType", "(", ")", "(", "o", "*", "Type", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "SliceType", "!=", "nil", "{", "return", "v", ".", "SliceType", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetSliceType returns the value of SliceType if it is set or its // zero value if it is unset.
[ "GetSliceType", "returns", "the", "value", "of", "SliceType", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3618-L3624
17,582
thriftrw/thriftrw-go
plugin/api/types.go
GetKeyValueSliceType
func (v *Type) GetKeyValueSliceType() (o *TypePair) { if v != nil && v.KeyValueSliceType != nil { return v.KeyValueSliceType } return }
go
func (v *Type) GetKeyValueSliceType() (o *TypePair) { if v != nil && v.KeyValueSliceType != nil { return v.KeyValueSliceType } return }
[ "func", "(", "v", "*", "Type", ")", "GetKeyValueSliceType", "(", ")", "(", "o", "*", "TypePair", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "KeyValueSliceType", "!=", "nil", "{", "return", "v", ".", "KeyValueSliceType", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetKeyValueSliceType returns the value of KeyValueSliceType if it is set or its // zero value if it is unset.
[ "GetKeyValueSliceType", "returns", "the", "value", "of", "KeyValueSliceType", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3633-L3639
17,583
thriftrw/thriftrw-go
plugin/api/types.go
GetMapType
func (v *Type) GetMapType() (o *TypePair) { if v != nil && v.MapType != nil { return v.MapType } return }
go
func (v *Type) GetMapType() (o *TypePair) { if v != nil && v.MapType != nil { return v.MapType } return }
[ "func", "(", "v", "*", "Type", ")", "GetMapType", "(", ")", "(", "o", "*", "TypePair", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "MapType", "!=", "nil", "{", "return", "v", ".", "MapType", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetMapType returns the value of MapType if it is set or its // zero value if it is unset.
[ "GetMapType", "returns", "the", "value", "of", "MapType", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3648-L3654
17,584
thriftrw/thriftrw-go
plugin/api/types.go
GetReferenceType
func (v *Type) GetReferenceType() (o *TypeReference) { if v != nil && v.ReferenceType != nil { return v.ReferenceType } return }
go
func (v *Type) GetReferenceType() (o *TypeReference) { if v != nil && v.ReferenceType != nil { return v.ReferenceType } return }
[ "func", "(", "v", "*", "Type", ")", "GetReferenceType", "(", ")", "(", "o", "*", "TypeReference", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "ReferenceType", "!=", "nil", "{", "return", "v", ".", "ReferenceType", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetReferenceType returns the value of ReferenceType if it is set or its // zero value if it is unset.
[ "GetReferenceType", "returns", "the", "value", "of", "ReferenceType", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3663-L3669
17,585
thriftrw/thriftrw-go
plugin/api/types.go
GetPointerType
func (v *Type) GetPointerType() (o *Type) { if v != nil && v.PointerType != nil { return v.PointerType } return }
go
func (v *Type) GetPointerType() (o *Type) { if v != nil && v.PointerType != nil { return v.PointerType } return }
[ "func", "(", "v", "*", "Type", ")", "GetPointerType", "(", ")", "(", "o", "*", "Type", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "PointerType", "!=", "nil", "{", "return", "v", ".", "PointerType", "\n", "}", "\n\n", "return", "\n", "}" ]
// GetPointerType returns the value of PointerType if it is set or its // zero value if it is unset.
[ "GetPointerType", "returns", "the", "value", "of", "PointerType", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3678-L3684
17,586
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *TypePair) String() string { if v == nil { return "<nil>" } var fields [2]string i := 0 fields[i] = fmt.Sprintf("Left: %v", v.Left) i++ fields[i] = fmt.Sprintf("Right: %v", v.Right) i++ return fmt.Sprintf("TypePair{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *TypePair) String() string { if v == nil { return "<nil>" } var fields [2]string i := 0 fields[i] = fmt.Sprintf("Left: %v", v.Left) i++ fields[i] = fmt.Sprintf("Right: %v", v.Right) i++ return fmt.Sprintf("TypePair{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "TypePair", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "2", "]", "string", "\n", "i", ":=", "0", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Left", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Right", ")", "\n", "i", "++", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a TypePair // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "TypePair", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3799-L3812
17,587
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *TypePair) Equals(rhs *TypePair) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !v.Left.Equals(rhs.Left) { return false } if !v.Right.Equals(rhs.Right) { return false } return true }
go
func (v *TypePair) Equals(rhs *TypePair) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !v.Left.Equals(rhs.Left) { return false } if !v.Right.Equals(rhs.Right) { return false } return true }
[ "func", "(", "v", "*", "TypePair", ")", "Equals", "(", "rhs", "*", "TypePair", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "v", ".", "Left", ".", "Equals", "(", "rhs", ".", "Left", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "v", ".", "Right", ".", "Equals", "(", "rhs", ".", "Right", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this TypePair match the // provided TypePair. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "TypePair", "match", "the", "provided", "TypePair", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3818-L3832
17,588
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *TypePair) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } err = multierr.Append(err, enc.AddObject("left", v.Left)) err = multierr.Append(err, enc.AddObject("right", v.Right)) return err }
go
func (v *TypePair) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } err = multierr.Append(err, enc.AddObject("left", v.Left)) err = multierr.Append(err, enc.AddObject("right", v.Right)) return err }
[ "func", "(", "v", "*", "TypePair", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "Left", ")", ")", "\n", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "v", ".", "Right", ")", ")", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of TypePair.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "TypePair", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3836-L3843
17,589
thriftrw/thriftrw-go
plugin/api/types.go
GetLeft
func (v *TypePair) GetLeft() (o *Type) { if v != nil { o = v.Left } return }
go
func (v *TypePair) GetLeft() (o *Type) { if v != nil { o = v.Left } return }
[ "func", "(", "v", "*", "TypePair", ")", "GetLeft", "(", ")", "(", "o", "*", "Type", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "Left", "\n", "}", "\n", "return", "\n", "}" ]
// GetLeft returns the value of Left if it is set or its // zero value if it is unset.
[ "GetLeft", "returns", "the", "value", "of", "Left", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3847-L3852
17,590
thriftrw/thriftrw-go
plugin/api/types.go
GetRight
func (v *TypePair) GetRight() (o *Type) { if v != nil { o = v.Right } return }
go
func (v *TypePair) GetRight() (o *Type) { if v != nil { o = v.Right } return }
[ "func", "(", "v", "*", "TypePair", ")", "GetRight", "(", ")", "(", "o", "*", "Type", ")", "{", "if", "v", "!=", "nil", "{", "o", "=", "v", ".", "Right", "\n", "}", "\n", "return", "\n", "}" ]
// GetRight returns the value of Right if it is set or its // zero value if it is unset.
[ "GetRight", "returns", "the", "value", "of", "Right", "if", "it", "is", "set", "or", "its", "zero", "value", "if", "it", "is", "unset", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L3861-L3866
17,591
thriftrw/thriftrw-go
plugin/api/types.go
String
func (v *TypeReference) String() string { if v == nil { return "<nil>" } var fields [3]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("ImportPath: %v", v.ImportPath) i++ if v.Annotations != nil { fields[i] = fmt.Sprintf("Annotations: %v", v.Annotations) i++ } return fmt.Sprintf("TypeReference{%v}", strings.Join(fields[:i], ", ")) }
go
func (v *TypeReference) String() string { if v == nil { return "<nil>" } var fields [3]string i := 0 fields[i] = fmt.Sprintf("Name: %v", v.Name) i++ fields[i] = fmt.Sprintf("ImportPath: %v", v.ImportPath) i++ if v.Annotations != nil { fields[i] = fmt.Sprintf("Annotations: %v", v.Annotations) i++ } return fmt.Sprintf("TypeReference{%v}", strings.Join(fields[:i], ", ")) }
[ "func", "(", "v", "*", "TypeReference", ")", "String", "(", ")", "string", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "fields", "[", "3", "]", "string", "\n", "i", ":=", "0", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "i", "++", "\n", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ImportPath", ")", "\n", "i", "++", "\n", "if", "v", ".", "Annotations", "!=", "nil", "{", "fields", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Annotations", ")", "\n", "i", "++", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "fields", "[", ":", "i", "]", ",", "\"", "\"", ")", ")", "\n", "}" ]
// String returns a readable string representation of a TypeReference // struct.
[ "String", "returns", "a", "readable", "string", "representation", "of", "a", "TypeReference", "struct", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L4012-L4029
17,592
thriftrw/thriftrw-go
plugin/api/types.go
Equals
func (v *TypeReference) Equals(rhs *TypeReference) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !(v.ImportPath == rhs.ImportPath) { return false } if !((v.Annotations == nil && rhs.Annotations == nil) || (v.Annotations != nil && rhs.Annotations != nil && _Map_String_String_Equals(v.Annotations, rhs.Annotations))) { return false } return true }
go
func (v *TypeReference) Equals(rhs *TypeReference) bool { if v == nil { return rhs == nil } else if rhs == nil { return false } if !(v.Name == rhs.Name) { return false } if !(v.ImportPath == rhs.ImportPath) { return false } if !((v.Annotations == nil && rhs.Annotations == nil) || (v.Annotations != nil && rhs.Annotations != nil && _Map_String_String_Equals(v.Annotations, rhs.Annotations))) { return false } return true }
[ "func", "(", "v", "*", "TypeReference", ")", "Equals", "(", "rhs", "*", "TypeReference", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "rhs", "==", "nil", "\n", "}", "else", "if", "rhs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "Name", "==", "rhs", ".", "Name", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "v", ".", "ImportPath", "==", "rhs", ".", "ImportPath", ")", "{", "return", "false", "\n", "}", "\n", "if", "!", "(", "(", "v", ".", "Annotations", "==", "nil", "&&", "rhs", ".", "Annotations", "==", "nil", ")", "||", "(", "v", ".", "Annotations", "!=", "nil", "&&", "rhs", ".", "Annotations", "!=", "nil", "&&", "_Map_String_String_Equals", "(", "v", ".", "Annotations", ",", "rhs", ".", "Annotations", ")", ")", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equals returns true if all the fields of this TypeReference match the // provided TypeReference. // // This function performs a deep comparison.
[ "Equals", "returns", "true", "if", "all", "the", "fields", "of", "this", "TypeReference", "match", "the", "provided", "TypeReference", ".", "This", "function", "performs", "a", "deep", "comparison", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L4035-L4052
17,593
thriftrw/thriftrw-go
plugin/api/types.go
MarshalLogObject
func (v *TypeReference) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) enc.AddString("importPath", v.ImportPath) if v.Annotations != nil { err = multierr.Append(err, enc.AddObject("annotations", (_Map_String_String_Zapper)(v.Annotations))) } return err }
go
func (v *TypeReference) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v == nil { return nil } enc.AddString("name", v.Name) enc.AddString("importPath", v.ImportPath) if v.Annotations != nil { err = multierr.Append(err, enc.AddObject("annotations", (_Map_String_String_Zapper)(v.Annotations))) } return err }
[ "func", "(", "v", "*", "TypeReference", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "(", "err", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "Name", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "v", ".", "ImportPath", ")", "\n", "if", "v", ".", "Annotations", "!=", "nil", "{", "err", "=", "multierr", ".", "Append", "(", "err", ",", "enc", ".", "AddObject", "(", "\"", "\"", ",", "(", "_Map_String_String_Zapper", ")", "(", "v", ".", "Annotations", ")", ")", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling // fast logging of TypeReference.
[ "MarshalLogObject", "implements", "zapcore", ".", "ObjectMarshaler", "enabling", "fast", "logging", "of", "TypeReference", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/plugin/api/types.go#L4056-L4066
17,594
thriftrw/thriftrw-go
compile/string.go
capitalize
func capitalize(s string) string { if len(s) == 0 { return s } x, i := utf8.DecodeRuneInString(s) return string(unicode.ToUpper(x)) + string(s[i:]) }
go
func capitalize(s string) string { if len(s) == 0 { return s } x, i := utf8.DecodeRuneInString(s) return string(unicode.ToUpper(x)) + string(s[i:]) }
[ "func", "capitalize", "(", "s", "string", ")", "string", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "s", "\n", "}", "\n", "x", ",", "i", ":=", "utf8", ".", "DecodeRuneInString", "(", "s", ")", "\n", "return", "string", "(", "unicode", ".", "ToUpper", "(", "x", ")", ")", "+", "string", "(", "s", "[", "i", ":", "]", ")", "\n", "}" ]
// capitalize changes the first letter of a string to upper case.
[ "capitalize", "changes", "the", "first", "letter", "of", "a", "string", "to", "upper", "case", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/compile/string.go#L31-L37
17,595
thriftrw/thriftrw-go
compile/string.go
fileBaseName
func fileBaseName(p string) string { return strings.TrimSuffix(filepath.Base(p), filepath.Ext(p)) }
go
func fileBaseName(p string) string { return strings.TrimSuffix(filepath.Base(p), filepath.Ext(p)) }
[ "func", "fileBaseName", "(", "p", "string", ")", "string", "{", "return", "strings", ".", "TrimSuffix", "(", "filepath", ".", "Base", "(", "p", ")", ",", "filepath", ".", "Ext", "(", "p", ")", ")", "\n", "}" ]
// fileBaseName returns the base name of the given file without the extension.
[ "fileBaseName", "returns", "the", "base", "name", "of", "the", "given", "file", "without", "the", "extension", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/compile/string.go#L40-L42
17,596
thriftrw/thriftrw-go
compile/string.go
splitInclude
func splitInclude(s string) (string, string) { if i := strings.IndexRune(s, '.'); i > 0 { return s[:i], s[i+1:] } return "", s }
go
func splitInclude(s string) (string, string) { if i := strings.IndexRune(s, '.'); i > 0 { return s[:i], s[i+1:] } return "", s }
[ "func", "splitInclude", "(", "s", "string", ")", "(", "string", ",", "string", ")", "{", "if", "i", ":=", "strings", ".", "IndexRune", "(", "s", ",", "'.'", ")", ";", "i", ">", "0", "{", "return", "s", "[", ":", "i", "]", ",", "s", "[", "i", "+", "1", ":", "]", "\n", "}", "\n", "return", "\"", "\"", ",", "s", "\n", "}" ]
// splitInclude splits the given string at the first ".". // // If the given string doesn't have a '.', the second returned string contains // the entirety of it.
[ "splitInclude", "splits", "the", "given", "string", "at", "the", "first", ".", ".", "If", "the", "given", "string", "doesn", "t", "have", "a", ".", "the", "second", "returned", "string", "contains", "the", "entirety", "of", "it", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/compile/string.go#L48-L53
17,597
thriftrw/thriftrw-go
wire/lazy_list.go
MapItemListToSlice
func MapItemListToSlice(l MapItemList) []MapItem { items := make([]MapItem, 0, l.Size()) // explicitly ignoring since we know there will not be an error _ = l.ForEach(func(v MapItem) error { items = append(items, v) return nil }) return items }
go
func MapItemListToSlice(l MapItemList) []MapItem { items := make([]MapItem, 0, l.Size()) // explicitly ignoring since we know there will not be an error _ = l.ForEach(func(v MapItem) error { items = append(items, v) return nil }) return items }
[ "func", "MapItemListToSlice", "(", "l", "MapItemList", ")", "[", "]", "MapItem", "{", "items", ":=", "make", "(", "[", "]", "MapItem", ",", "0", ",", "l", ".", "Size", "(", ")", ")", "\n", "// explicitly ignoring since we know there will not be an error", "_", "=", "l", ".", "ForEach", "(", "func", "(", "v", "MapItem", ")", "error", "{", "items", "=", "append", "(", "items", ",", "v", ")", "\n", "return", "nil", "\n", "}", ")", "\n", "return", "items", "\n", "}" ]
// MapItemListToSlice builds a slice of values from the given MapItemList.
[ "MapItemListToSlice", "builds", "a", "slice", "of", "values", "from", "the", "given", "MapItemList", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/wire/lazy_list.go#L145-L153
17,598
thriftrw/thriftrw-go
internal/frame/client.go
NewClient
func NewClient(w io.Writer, r io.Reader) *Client { return &Client{ r: NewReader(r), w: NewWriter(w), } }
go
func NewClient(w io.Writer, r io.Reader) *Client { return &Client{ r: NewReader(r), w: NewWriter(w), } }
[ "func", "NewClient", "(", "w", "io", ".", "Writer", ",", "r", "io", ".", "Reader", ")", "*", "Client", "{", "return", "&", "Client", "{", "r", ":", "NewReader", "(", "r", ")", ",", "w", ":", "NewWriter", "(", "w", ")", ",", "}", "\n", "}" ]
// NewClient builds a new Client which uses the given writer to send requests // and the given reader to read their responses.
[ "NewClient", "builds", "a", "new", "Client", "which", "uses", "the", "given", "writer", "to", "send", "requests", "and", "the", "given", "reader", "to", "read", "their", "responses", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/internal/frame/client.go#L42-L47
17,599
thriftrw/thriftrw-go
internal/frame/client.go
Send
func (c *Client) Send(b []byte) ([]byte, error) { c.Lock() defer c.Unlock() if err := c.w.Write(b); err != nil { return nil, err } return c.r.Read() }
go
func (c *Client) Send(b []byte) ([]byte, error) { c.Lock() defer c.Unlock() if err := c.w.Write(b); err != nil { return nil, err } return c.r.Read() }
[ "func", "(", "c", "*", "Client", ")", "Send", "(", "b", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n\n", "if", "err", ":=", "c", ".", "w", ".", "Write", "(", "b", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "c", ".", "r", ".", "Read", "(", ")", "\n", "}" ]
// Send sends the given frame and returns its response.
[ "Send", "sends", "the", "given", "frame", "and", "returns", "its", "response", "." ]
a9a6ad793beab07cc3385954d2e8af8abfaa83e2
https://github.com/thriftrw/thriftrw-go/blob/a9a6ad793beab07cc3385954d2e8af8abfaa83e2/internal/frame/client.go#L50-L58