thriftrw: go.uber.org/thriftrw/gen/internal/tests/enum_conflict Index | Files

package enum_conflict

import "go.uber.org/thriftrw/gen/internal/tests/enum_conflict"

Index

Package Files

enum_conflict.go

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.

type RecordType Uses

type RecordType int32
const (
    RecordTypeName  RecordType = 0
    RecordTypeEmail RecordType = 1
)
const DefaultRecordType RecordType = RecordTypeName

func RecordType_Values Uses

func RecordType_Values() []RecordType

RecordType_Values returns all recognized values of RecordType.

func (RecordType) Equals Uses

func (v RecordType) Equals(rhs RecordType) bool

Equals returns true if this RecordType value matches the provided value.

func (*RecordType) FromWire Uses

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 Uses

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 Uses

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 Uses

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 Uses

func (v RecordType) Ptr() *RecordType

Ptr returns a pointer to this enum value.

func (RecordType) String Uses

func (v RecordType) String() string

String returns a readable string representation of RecordType.

func (RecordType) ToWire Uses

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 Uses

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 Uses

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 Uses

type Records struct {
    RecordType      *RecordType       `json:"recordType,omitempty"`
    OtherRecordType *enums.RecordType `json:"otherRecordType,omitempty"`
}

func (*Records) Equals Uses

func (v *Records) Equals(rhs *Records) bool

Equals returns true if all the fields of this Records match the provided Records.

This function performs a deep comparison.

func (*Records) FromWire Uses

func (v *Records) FromWire(w wire.Value) error

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 Uses

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 Uses

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) IsSetOtherRecordType Uses

func (v *Records) IsSetOtherRecordType() bool

IsSetOtherRecordType returns true if OtherRecordType is not nil.

func (*Records) IsSetRecordType Uses

func (v *Records) IsSetRecordType() bool

IsSetRecordType returns true if RecordType is not nil.

func (*Records) MarshalLogObject Uses

func (v *Records) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Records.

func (*Records) String Uses

func (v *Records) String() string

String returns a readable string representation of a Records struct.

func (*Records) ToWire Uses

func (v *Records) ToWire() (wire.Value, error)

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
}

Package enum_conflict imports 11 packages (graph) and is imported by 2 packages. Updated 2020-01-22. Refresh now. Tools for package owners.