/
stringdef.go
69 lines (57 loc) · 1.85 KB
/
stringdef.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Code generated by thriftrw v1.31.0. DO NOT EDIT.
// @generated
package stringdef
import (
stream "go.uber.org/thriftrw/protocol/stream"
thriftreflect "go.uber.org/thriftrw/thriftreflect"
wire "go.uber.org/thriftrw/wire"
)
type StringDef string
// StringDefPtr returns a pointer to a StringDef
func (v StringDef) Ptr() *StringDef {
return &v
}
// ToWire translates StringDef into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
func (v StringDef) ToWire() (wire.Value, error) {
x := (string)(v)
return wire.NewValueString(x), error(nil)
}
// String returns a readable string representation of StringDef.
func (v StringDef) String() string {
x := (string)(v)
return (string)(x)
}
func (v StringDef) Encode(sw stream.Writer) error {
x := (string)(v)
return sw.WriteString(x)
}
// FromWire deserializes StringDef from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
func (v *StringDef) FromWire(w wire.Value) error {
x, err := w.GetString(), error(nil)
*v = (StringDef)(x)
return err
}
// Decode deserializes StringDef directly off the wire.
func (v *StringDef) Decode(sr stream.Reader) error {
x, err := sr.ReadString()
*v = (StringDef)(x)
return err
}
// Equals returns true if this StringDef is equal to the provided
// StringDef.
func (lhs StringDef) Equals(rhs StringDef) bool {
return ((string)(lhs) == (string)(rhs))
}
// ThriftModule represents the IDL file used to generate this package.
var ThriftModule = &thriftreflect.ThriftModule{
Name: "stringdef",
Package: "go.uber.org/thriftrw/gen/internal/tests/stringdef",
FilePath: "stringdef.thrift",
SHA1: "313c35c10839a4442eb270df8e6acda528af9293",
Raw: rawIDL,
}
const rawIDL = "typedef string StringDef\n"