id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c17500
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 } }
c17501
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...
c17502
return client{p: p, t: t} }
c17503
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{}, ...
c17504
.Type> = <constantValue .Value .Type>`, c, TemplateFunc("constantValue", ConstantValue), TemplateFunc("canBeConstant", canBeConstant), TemplateFunc("constantName", constantName), ) return wrapGenerateError(c.Name, err) }
c17505
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)) } }
c17506
"item %q with label %q conflicts with item %q in enum %q", i.Name, itemName, conflict.Name, spec.Name) } used[itemName] = i } return nil }
c17507
isUsed { continue } filtered = append(filtered, i) used[i.Value] = struct{}{} } return filtered }
c17508
return nameConflict{name: name, line: line} } n.names[s] = line return nil }
c17509
Name: src.Name, File: file, Type: typ, Doc: src.Doc, Value: compileConstantValue(src.Value), }, nil }
c17510
{ 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 }
c17511
if unicode.IsLetter(r) && !unicode.IsUpper(r) { return false } } return true }
c17512
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(w...
c17513
the string is a single all caps word. // That is, "FOO" is allowed but "FOO_BAR" is changed to "FooBar". }
c17514
NewWriter(w), running: atomic.NewBool(false), } }
c17515
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 }
c17516
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 }
c17517
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: "<.Packa...
c17518
fmt.Sprintf("Type: %v", v.Type) i++ return fmt.Sprintf("Argument{%v}", strings.Join(fields[:i], ", ")) }
c17519
false } if !v.Type.Equals(rhs.Type) { return false } return true }
c17520
enc.AddString("name", v.Name) err = multierr.Append(err, enc.AddObject("type", v.Type)) return err }
c17521
enc.AddString("name", "SERVICE_GENERATOR") } return nil }
c17522
} return fmt.Sprintf("Feature(%d)", w) }
c17523
return ([]byte)(strconv.FormatInt(int64(v), 10)), nil }
c17524
!= 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], ", ")) }
c17525
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 }
c17526
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 }
c17527
{ if v != nil { o = v.Arguments } return }
c17528
v != nil && v.ReturnType != nil { return v.ReturnType } return }
c17529
nil { return v.Exceptions } return }
c17530
v != nil && v.OneWay != nil { return *v.OneWay } return }
c17531
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], ", ")) }
c17532
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 }
c17533
l { enc.AppendInt32((int32)(v)) } return err }
c17534
err = multierr.Append(err, enc.AppendObject(_Map_ServiceID_Service_Item_Zapper{Key: k, Value: v})) } return err }
c17535
multierr.Append(err, enc.AddObject("value", v.Value)) return err }
c17536
err = multierr.Append(err, enc.AppendObject(_Map_ModuleID_Module_Item_Zapper{Key: k, Value: v})) } return err }
c17537
multierr.Append(err, enc.AddArray("modules", (_Map_ModuleID_Module_Zapper)(v.Modules))) enc.AddString("packagePrefix", v.PackagePrefix) enc.AddString("thriftRoot", v.ThriftRoot) return err }
c17538
(o []ServiceID) { if v != nil { o = v.RootServices } return }
c17539
v != nil { o = v.Services } return }
c17540
v != nil { o = v.Modules } return }
c17541
o = v.PackagePrefix } return }
c17542
(o string) { if v != nil { o = v.ThriftRoot } return }
c17543
} return fmt.Sprintf("GenerateServiceResponse{%v}", strings.Join(fields[:i], ", ")) }
c17544
(v.Files != nil && rhs.Files != nil && _Map_String_Binary_Equals(v.Files, rhs.Files))) { return false } return true }
c17545
{ enc.AddString((string)(k), base64.StdEncoding.EncodeToString(v)) } return err }
c17546
multierr.Append(err, enc.AddObject("files", (_Map_String_Binary_Zapper)(v.Files))) } return err }
c17547
{ if v != nil && v.Files != nil { return v.Files } return }
c17548
:= 0 return fmt.Sprintf("HandshakeRequest{%v}", strings.Join(fields[:i], ", ")) }
c17549
if v == nil { return rhs == nil } else if rhs == nil { return false } return true }
c17550
if v == nil { return nil } return err }
c17551
fields[i] = fmt.Sprintf("LibraryVersion: %v", *(v.LibraryVersion)) i++ } return fmt.Sprintf("HandshakeResponse{%v}", strings.Join(fields[:i], ", ")) }
c17552
} if !_List_Feature_Equals(v.Features, rhs.Features) { return false } if !_String_EqualsPtr(v.LibraryVersion, rhs.LibraryVersion) { return false } return true }
c17553
multierr.Append(err, enc.AddArray("features", (_List_Feature_Zapper)(v.Features))) if v.LibraryVersion != nil { enc.AddString("libraryVersion", *v.LibraryVersion) } return err }
c17554
o = v.APIVersion } return }
c17555
(o []Feature) { if v != nil { o = v.Features } return }
c17556
nil { return *v.LibraryVersion } return }
c17557
i++ fields[i] = fmt.Sprintf("ThriftFilePath: %v", v.ThriftFilePath) i++ return fmt.Sprintf("Module{%v}", strings.Join(fields[:i], ", ")) }
c17558
rhs.ImportPath) { return false } if !(v.Directory == rhs.Directory) { return false } if !(v.ThriftFilePath == rhs.ThriftFilePath) { return false } return true }
c17559
} enc.AddString("importPath", v.ImportPath) enc.AddString("directory", v.Directory) enc.AddString("thriftFilePath", v.ThriftFilePath) return err }
c17560
o = v.Directory } return }
c17561
o = v.ThriftFilePath } return }
c17562
{ x := (int32)(v) return wire.NewValueI32(x), error(nil) }
c17563
(int32)(v) return fmt.Sprint(x) }
c17564
((int32)(lhs) == (int32)(rhs)) }
c17565
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], ", ")) }
c17566
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))) { ...
c17567
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 }
c17568
{ return *v.ParentID } return }
c17569
o = v.Functions } return }
c17570
o = v.ModuleID } return }
c17571
(int32)(v) return fmt.Sprint(x) }
c17572
:= w.GetI32(), error(nil) *v = (ServiceID)(x) return err }
c17573
((int32)(lhs) == (int32)(rhs)) }
c17574
SimpleTypeInt64, SimpleTypeFloat64, SimpleTypeString, SimpleTypeStructEmpty, } }
c17575
wire.NewValueI32(int32(v)), nil }
c17576
return "INT64" case 7: return "FLOAT64" case 8: return "STRING" case 9: return "STRUCT_EMPTY" } return fmt.Sprintf("SimpleType(%d)", w) }
c17577
!= 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], ", ")) }
c17578
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.PointerTyp...
c17579
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)...
c17580
return *v.SimpleType } return }
c17581
return v.SliceType } return }
c17582
v != nil && v.KeyValueSliceType != nil { return v.KeyValueSliceType } return }
c17583
if v != nil && v.MapType != nil { return v.MapType } return }
c17584
{ return v.ReferenceType } return }
c17585
return v.PointerType } return }
c17586
fmt.Sprintf("Right: %v", v.Right) i++ return fmt.Sprintf("TypePair{%v}", strings.Join(fields[:i], ", ")) }
c17587
nil { return false } if !v.Left.Equals(rhs.Left) { return false } if !v.Right.Equals(rhs.Right) { return false } return true }
c17588
err = multierr.Append(err, enc.AddObject("right", v.Right)) return err }
c17589
{ if v != nil { o = v.Left } return }
c17590
o = v.Right } return }
c17591
fmt.Sprintf("Annotations: %v", v.Annotations) i++ } return fmt.Sprintf("TypeReference{%v}", strings.Join(fields[:i], ", ")) }
c17592
nil && rhs.Annotations == nil) || (v.Annotations != nil && rhs.Annotations != nil && _Map_String_String_Equals(v.Annotations, rhs.Annotations))) { return false } return true }
c17593
{ err = multierr.Append(err, enc.AddObject("annotations", (_Map_String_String_Zapper)(v.Annotations))) } return err }
c17594
} x, i := utf8.DecodeRuneInString(s) return string(unicode.ToUpper(x)) + string(s[i:]) }
c17595
strings.TrimSuffix(filepath.Base(p), filepath.Ext(p)) }
c17596
strings.IndexRune(s, '.'); i > 0 { return s[:i], s[i+1:] } return "", s }
c17597
error _ = l.ForEach(func(v MapItem) error { items = append(items, v) return nil }) return items }
c17598
{ return &Client{ r: NewReader(r), w: NewWriter(w), } }
c17599
nil { return nil, err } return c.r.Read() }