Documentation ¶
Index ¶
- Constants
- Variables
- type RecordType
- func (v RecordType) Equals(rhs RecordType) bool
- func (v *RecordType) FromWire(w wire.Value) error
- func (v RecordType) MarshalJSON() ([]byte, error)
- func (v RecordType) MarshalLogObject(enc zapcore.ObjectEncoder) error
- func (v RecordType) MarshalText() ([]byte, error)
- func (v RecordType) Ptr() *RecordType
- func (v RecordType) String() string
- func (v RecordType) ToWire() (wire.Value, error)
- func (v *RecordType) UnmarshalJSON(text []byte) error
- func (v *RecordType) UnmarshalText(value []byte) error
- type Records
- func (v *Records) Equals(rhs *Records) bool
- func (v *Records) FromWire(w wire.Value) error
- func (v *Records) GetOtherRecordType() (o enums.RecordType)
- func (v *Records) GetRecordType() (o RecordType)
- func (v *Records) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)
- func (v *Records) String() string
- func (v *Records) ToWire() (wire.Value, error)
Constants ¶
const DefaultOtherRecordType enums.RecordType = enums.RecordTypeName
Variables ¶
var ThriftModule = &thriftreflect.ThriftModule{ Name: "enum_conflict", Package: "go.uber.org/thriftrw/gen/internal/tests/enum_conflict", FilePath: "enum_conflict.thrift", SHA1: "75e0e6472e2f0c74412512d61531cf1a0da7429c", Includes: []*thriftreflect.ThriftModule{ enums.ThriftModule, }, Raw: rawIDL, }
ThriftModule represents the IDL file used to generate this package.
Functions ¶
This section is empty.
Types ¶
type RecordType ¶
type RecordType int32
const ( RecordTypeName RecordType = 0 RecordTypeEmail RecordType = 1 )
const DefaultRecordType RecordType = RecordTypeName
func RecordType_Values ¶
func RecordType_Values() []RecordType
RecordType_Values returns all recognized values of RecordType.
func (RecordType) Equals ¶
func (v RecordType) Equals(rhs RecordType) bool
Equals returns true if this RecordType value matches the provided value.
func (*RecordType) FromWire ¶
func (v *RecordType) FromWire(w wire.Value) error
FromWire deserializes RecordType from its Thrift-level representation.
x, err := binaryProtocol.Decode(reader, wire.TI32) if err != nil { return RecordType(0), err } var v RecordType if err := v.FromWire(x); err != nil { return RecordType(0), err } return v, nil
func (RecordType) MarshalJSON ¶
func (v RecordType) MarshalJSON() ([]byte, error)
MarshalJSON serializes RecordType into JSON.
If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.
This implements json.Marshaler.
func (RecordType) MarshalLogObject ¶
func (v RecordType) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of RecordType. 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".
func (RecordType) MarshalText ¶
func (v RecordType) MarshalText() ([]byte, error)
MarshalText encodes RecordType to text.
If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.
This implements the TextMarshaler interface.
func (RecordType) Ptr ¶
func (v RecordType) Ptr() *RecordType
Ptr returns a pointer to this enum value.
func (RecordType) String ¶
func (v RecordType) String() string
String returns a readable string representation of RecordType.
func (RecordType) ToWire ¶
func (v RecordType) ToWire() (wire.Value, error)
ToWire translates RecordType 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.
func (*RecordType) UnmarshalJSON ¶
func (v *RecordType) UnmarshalJSON(text []byte) error
UnmarshalJSON attempts to decode RecordType from its JSON representation.
This implementation supports both, numeric and string inputs. If a string is provided, it must be a known enum name.
This implements json.Unmarshaler.
func (*RecordType) UnmarshalText ¶
func (v *RecordType) UnmarshalText(value []byte) error
UnmarshalText tries to decode RecordType from a byte slice containing its name.
var v RecordType err := v.UnmarshalText([]byte("Name"))
type Records ¶
type Records struct { RecordType *RecordType `json:"recordType,omitempty"` OtherRecordType *enums.RecordType `json:"otherRecordType,omitempty"` }
func (*Records) Equals ¶
Equals returns true if all the fields of this Records match the provided Records.
This function performs a deep comparison.
func (*Records) FromWire ¶
FromWire deserializes a Records 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 Records struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Records if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Records) GetOtherRecordType ¶
func (v *Records) GetOtherRecordType() (o enums.RecordType)
GetOtherRecordType returns the value of OtherRecordType if it is set or its default value if it is unset.
func (*Records) GetRecordType ¶
func (v *Records) GetRecordType() (o RecordType)
GetRecordType returns the value of RecordType if it is set or its default value if it is unset.
func (*Records) MarshalLogObject ¶
func (v *Records) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)
MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Records.
func (*Records) ToWire ¶
ToWire translates a Records 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 }