forked from yarpc/yarpc-go
/
store_forget.go
166 lines (144 loc) · 3.77 KB
/
store_forget.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// Code generated by thriftrw v1.8.0. DO NOT EDIT.
// @generated
package atomic
import (
"fmt"
"go.uber.org/thriftrw/wire"
"strings"
)
// Store_Forget_Args represents the arguments for the Store.forget function.
//
// The arguments for forget are sent and received over the wire as this struct.
type Store_Forget_Args struct {
Key *string `json:"key,omitempty"`
}
// ToWire translates a Store_Forget_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
// x, err := v.ToWire()
// if err != nil {
// return err
// }
//
// if err := binaryProtocol.Encode(x, writer); err != nil {
// return err
// }
func (v *Store_Forget_Args) ToWire() (wire.Value, error) {
var (
fields [1]wire.Field
i int = 0
w wire.Value
err error
)
if v.Key != nil {
w, err = wire.NewValueString(*(v.Key)), error(nil)
if err != nil {
return w, err
}
fields[i] = wire.Field{ID: 1, Value: w}
i++
}
return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}
// FromWire deserializes a Store_Forget_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a Store_Forget_Args struct
// from the provided intermediate representation.
//
// x, err := binaryProtocol.Decode(reader, wire.TStruct)
// if err != nil {
// return nil, err
// }
//
// var v Store_Forget_Args
// if err := v.FromWire(x); err != nil {
// return nil, err
// }
// return &v, nil
func (v *Store_Forget_Args) FromWire(w wire.Value) error {
var err error
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 1:
if field.Value.Type() == wire.TBinary {
var x string
x, err = field.Value.GetString(), error(nil)
v.Key = &x
if err != nil {
return err
}
}
}
}
return nil
}
// String returns a readable string representation of a Store_Forget_Args
// struct.
func (v *Store_Forget_Args) String() string {
if v == nil {
return "<nil>"
}
var fields [1]string
i := 0
if v.Key != nil {
fields[i] = fmt.Sprintf("Key: %v", *(v.Key))
i++
}
return fmt.Sprintf("Store_Forget_Args{%v}", strings.Join(fields[:i], ", "))
}
// Equals returns true if all the fields of this Store_Forget_Args match the
// provided Store_Forget_Args.
//
// This function performs a deep comparison.
func (v *Store_Forget_Args) Equals(rhs *Store_Forget_Args) bool {
if !_String_EqualsPtr(v.Key, rhs.Key) {
return false
}
return true
}
// GetKey returns the value of Key if it is set or its
// zero value if it is unset.
func (v *Store_Forget_Args) GetKey() (o string) {
if v.Key != nil {
return *v.Key
}
return
}
// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "forget" for this struct.
func (v *Store_Forget_Args) MethodName() string {
return "forget"
}
// EnvelopeType returns the kind of value inside this struct.
//
// This will always be OneWay for this struct.
func (v *Store_Forget_Args) EnvelopeType() wire.EnvelopeType {
return wire.OneWay
}
// Store_Forget_Helper provides functions that aid in handling the
// parameters and return values of the Store.forget
// function.
var Store_Forget_Helper = struct {
// Args accepts the parameters of forget in-order and returns
// the arguments struct for the function.
Args func(
key *string,
) *Store_Forget_Args
}{}
func init() {
Store_Forget_Helper.Args = func(
key *string,
) *Store_Forget_Args {
return &Store_Forget_Args{
Key: key,
}
}
}