enums

package
v1.20.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ThriftModule = &thriftreflect.ThriftModule{
	Name:     "enums",
	Package:  "go.uber.org/thriftrw/gen/internal/tests/enums",
	FilePath: "enums.thrift",
	SHA1:     "16921e977d77e214a9bac398d279f60889b055de",
	Raw:      rawIDL,
}

ThriftModule represents the IDL file used to generate this package.

Functions

This section is empty.

Types

type EmptyEnum

type EmptyEnum int32

func EmptyEnum_Values

func EmptyEnum_Values() []EmptyEnum

EmptyEnum_Values returns all recognized values of EmptyEnum.

func (EmptyEnum) Equals

func (v EmptyEnum) Equals(rhs EmptyEnum) bool

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

func (*EmptyEnum) FromWire

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

FromWire deserializes EmptyEnum from its Thrift-level representation.

x, err := binaryProtocol.Decode(reader, wire.TI32)
if err != nil {
  return EmptyEnum(0), err
}

var v EmptyEnum
if err := v.FromWire(x); err != nil {
  return EmptyEnum(0), err
}
return v, nil

func (EmptyEnum) MarshalJSON

func (v EmptyEnum) MarshalJSON() ([]byte, error)

MarshalJSON serializes EmptyEnum into JSON.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements json.Marshaler.

func (EmptyEnum) MarshalLogObject

func (v EmptyEnum) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of EmptyEnum. 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 (EmptyEnum) MarshalText

func (v EmptyEnum) MarshalText() ([]byte, error)

MarshalText encodes EmptyEnum to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (EmptyEnum) Ptr

func (v EmptyEnum) Ptr() *EmptyEnum

Ptr returns a pointer to this enum value.

func (EmptyEnum) String

func (v EmptyEnum) String() string

String returns a readable string representation of EmptyEnum.

func (EmptyEnum) ToWire

func (v EmptyEnum) ToWire() (wire.Value, error)

ToWire translates EmptyEnum 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 (*EmptyEnum) UnmarshalJSON

func (v *EmptyEnum) UnmarshalJSON(text []byte) error

UnmarshalJSON attempts to decode EmptyEnum 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 (*EmptyEnum) UnmarshalText

func (v *EmptyEnum) UnmarshalText(value []byte) error

UnmarshalText tries to decode EmptyEnum from a byte slice containing its name.

type EnumDefault

type EnumDefault int32
const (
	EnumDefaultFoo EnumDefault = 0
	EnumDefaultBar EnumDefault = 1
	EnumDefaultBaz EnumDefault = 2
)

func EnumDefault_Values

func EnumDefault_Values() []EnumDefault

EnumDefault_Values returns all recognized values of EnumDefault.

func (EnumDefault) Equals

func (v EnumDefault) Equals(rhs EnumDefault) bool

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

func (*EnumDefault) FromWire

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

FromWire deserializes EnumDefault from its Thrift-level representation.

x, err := binaryProtocol.Decode(reader, wire.TI32)
if err != nil {
  return EnumDefault(0), err
}

var v EnumDefault
if err := v.FromWire(x); err != nil {
  return EnumDefault(0), err
}
return v, nil

func (EnumDefault) MarshalJSON

func (v EnumDefault) MarshalJSON() ([]byte, error)

MarshalJSON serializes EnumDefault into JSON.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements json.Marshaler.

func (EnumDefault) MarshalLogObject

func (v EnumDefault) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of EnumDefault. 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 (EnumDefault) MarshalText

func (v EnumDefault) MarshalText() ([]byte, error)

MarshalText encodes EnumDefault to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (EnumDefault) Ptr

func (v EnumDefault) Ptr() *EnumDefault

Ptr returns a pointer to this enum value.

func (EnumDefault) String

func (v EnumDefault) String() string

String returns a readable string representation of EnumDefault.

func (EnumDefault) ToWire

func (v EnumDefault) ToWire() (wire.Value, error)

ToWire translates EnumDefault 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 (*EnumDefault) UnmarshalJSON

func (v *EnumDefault) UnmarshalJSON(text []byte) error

UnmarshalJSON attempts to decode EnumDefault 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 (*EnumDefault) UnmarshalText

func (v *EnumDefault) UnmarshalText(value []byte) error

UnmarshalText tries to decode EnumDefault from a byte slice containing its name.

var v EnumDefault
err := v.UnmarshalText([]byte("Foo"))

type EnumWithDuplicateName

type EnumWithDuplicateName int32
const (
	EnumWithDuplicateNameA EnumWithDuplicateName = 0
	EnumWithDuplicateNameB EnumWithDuplicateName = 1
	EnumWithDuplicateNameC EnumWithDuplicateName = 2
	EnumWithDuplicateNameP EnumWithDuplicateName = 3
	EnumWithDuplicateNameQ EnumWithDuplicateName = 4
	EnumWithDuplicateNameR EnumWithDuplicateName = 5
	EnumWithDuplicateNameX EnumWithDuplicateName = 6
	EnumWithDuplicateNameY EnumWithDuplicateName = 7
	EnumWithDuplicateNameZ EnumWithDuplicateName = 8
)

func EnumWithDuplicateName_Values

func EnumWithDuplicateName_Values() []EnumWithDuplicateName

EnumWithDuplicateName_Values returns all recognized values of EnumWithDuplicateName.

func (EnumWithDuplicateName) Equals

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

func (*EnumWithDuplicateName) FromWire

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

FromWire deserializes EnumWithDuplicateName from its Thrift-level representation.

x, err := binaryProtocol.Decode(reader, wire.TI32)
if err != nil {
  return EnumWithDuplicateName(0), err
}

var v EnumWithDuplicateName
if err := v.FromWire(x); err != nil {
  return EnumWithDuplicateName(0), err
}
return v, nil

func (EnumWithDuplicateName) MarshalJSON

func (v EnumWithDuplicateName) MarshalJSON() ([]byte, error)

MarshalJSON serializes EnumWithDuplicateName into JSON.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements json.Marshaler.

func (EnumWithDuplicateName) MarshalLogObject

func (v EnumWithDuplicateName) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of EnumWithDuplicateName. 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 (EnumWithDuplicateName) MarshalText

func (v EnumWithDuplicateName) MarshalText() ([]byte, error)

MarshalText encodes EnumWithDuplicateName to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (EnumWithDuplicateName) Ptr

Ptr returns a pointer to this enum value.

func (EnumWithDuplicateName) String

func (v EnumWithDuplicateName) String() string

String returns a readable string representation of EnumWithDuplicateName.

func (EnumWithDuplicateName) ToWire

func (v EnumWithDuplicateName) ToWire() (wire.Value, error)

ToWire translates EnumWithDuplicateName 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 (*EnumWithDuplicateName) UnmarshalJSON

func (v *EnumWithDuplicateName) UnmarshalJSON(text []byte) error

UnmarshalJSON attempts to decode EnumWithDuplicateName 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 (*EnumWithDuplicateName) UnmarshalText

func (v *EnumWithDuplicateName) UnmarshalText(value []byte) error

UnmarshalText tries to decode EnumWithDuplicateName from a byte slice containing its name.

var v EnumWithDuplicateName
err := v.UnmarshalText([]byte("A"))

type EnumWithDuplicateValues

type EnumWithDuplicateValues int32
const (
	EnumWithDuplicateValuesP EnumWithDuplicateValues = 0
	EnumWithDuplicateValuesQ EnumWithDuplicateValues = -1
	EnumWithDuplicateValuesR EnumWithDuplicateValues = 0
)

func EnumWithDuplicateValues_Values

func EnumWithDuplicateValues_Values() []EnumWithDuplicateValues

EnumWithDuplicateValues_Values returns all recognized values of EnumWithDuplicateValues.

func (EnumWithDuplicateValues) Equals

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

func (*EnumWithDuplicateValues) FromWire

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

FromWire deserializes EnumWithDuplicateValues from its Thrift-level representation.

x, err := binaryProtocol.Decode(reader, wire.TI32)
if err != nil {
  return EnumWithDuplicateValues(0), err
}

var v EnumWithDuplicateValues
if err := v.FromWire(x); err != nil {
  return EnumWithDuplicateValues(0), err
}
return v, nil

func (EnumWithDuplicateValues) MarshalJSON

func (v EnumWithDuplicateValues) MarshalJSON() ([]byte, error)

MarshalJSON serializes EnumWithDuplicateValues into JSON.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements json.Marshaler.

func (EnumWithDuplicateValues) MarshalLogObject

func (v EnumWithDuplicateValues) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of EnumWithDuplicateValues. 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 (EnumWithDuplicateValues) MarshalText

func (v EnumWithDuplicateValues) MarshalText() ([]byte, error)

MarshalText encodes EnumWithDuplicateValues to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (EnumWithDuplicateValues) Ptr

Ptr returns a pointer to this enum value.

func (EnumWithDuplicateValues) String

func (v EnumWithDuplicateValues) String() string

String returns a readable string representation of EnumWithDuplicateValues.

func (EnumWithDuplicateValues) ToWire

func (v EnumWithDuplicateValues) ToWire() (wire.Value, error)

ToWire translates EnumWithDuplicateValues 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 (*EnumWithDuplicateValues) UnmarshalJSON

func (v *EnumWithDuplicateValues) UnmarshalJSON(text []byte) error

UnmarshalJSON attempts to decode EnumWithDuplicateValues 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 (*EnumWithDuplicateValues) UnmarshalText

func (v *EnumWithDuplicateValues) UnmarshalText(value []byte) error

UnmarshalText tries to decode EnumWithDuplicateValues from a byte slice containing its name.

var v EnumWithDuplicateValues
err := v.UnmarshalText([]byte("P"))

type EnumWithLabel

type EnumWithLabel int32
const (
	EnumWithLabelUsername EnumWithLabel = 0
	EnumWithLabelPassword EnumWithLabel = 1
	EnumWithLabelSalt     EnumWithLabel = 2
	EnumWithLabelSugar    EnumWithLabel = 3
	EnumWithLabelRelay    EnumWithLabel = 4
	EnumWithLabelNaive4N1 EnumWithLabel = 5
)

func EnumWithLabel_Values

func EnumWithLabel_Values() []EnumWithLabel

EnumWithLabel_Values returns all recognized values of EnumWithLabel.

func (EnumWithLabel) Equals

func (v EnumWithLabel) Equals(rhs EnumWithLabel) bool

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

func (*EnumWithLabel) FromWire

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

FromWire deserializes EnumWithLabel from its Thrift-level representation.

x, err := binaryProtocol.Decode(reader, wire.TI32)
if err != nil {
  return EnumWithLabel(0), err
}

var v EnumWithLabel
if err := v.FromWire(x); err != nil {
  return EnumWithLabel(0), err
}
return v, nil

func (EnumWithLabel) MarshalJSON

func (v EnumWithLabel) MarshalJSON() ([]byte, error)

MarshalJSON serializes EnumWithLabel into JSON.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements json.Marshaler.

func (EnumWithLabel) MarshalLogObject

func (v EnumWithLabel) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of EnumWithLabel. 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 (EnumWithLabel) MarshalText

func (v EnumWithLabel) MarshalText() ([]byte, error)

MarshalText encodes EnumWithLabel to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (EnumWithLabel) Ptr

func (v EnumWithLabel) Ptr() *EnumWithLabel

Ptr returns a pointer to this enum value.

func (EnumWithLabel) String

func (v EnumWithLabel) String() string

String returns a readable string representation of EnumWithLabel.

func (EnumWithLabel) ToWire

func (v EnumWithLabel) ToWire() (wire.Value, error)

ToWire translates EnumWithLabel 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 (*EnumWithLabel) UnmarshalJSON

func (v *EnumWithLabel) UnmarshalJSON(text []byte) error

UnmarshalJSON attempts to decode EnumWithLabel 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 (*EnumWithLabel) UnmarshalText

func (v *EnumWithLabel) UnmarshalText(value []byte) error

UnmarshalText tries to decode EnumWithLabel from a byte slice containing its name.

var v EnumWithLabel
err := v.UnmarshalText([]byte("USERNAME"))

type EnumWithValues

type EnumWithValues int32
const (
	EnumWithValuesX EnumWithValues = 123
	EnumWithValuesY EnumWithValues = 456
	EnumWithValuesZ EnumWithValues = 789
)

func EnumWithValues_Values

func EnumWithValues_Values() []EnumWithValues

EnumWithValues_Values returns all recognized values of EnumWithValues.

func (EnumWithValues) Equals

func (v EnumWithValues) Equals(rhs EnumWithValues) bool

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

func (*EnumWithValues) FromWire

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

FromWire deserializes EnumWithValues from its Thrift-level representation.

x, err := binaryProtocol.Decode(reader, wire.TI32)
if err != nil {
  return EnumWithValues(0), err
}

var v EnumWithValues
if err := v.FromWire(x); err != nil {
  return EnumWithValues(0), err
}
return v, nil

func (EnumWithValues) MarshalJSON

func (v EnumWithValues) MarshalJSON() ([]byte, error)

MarshalJSON serializes EnumWithValues into JSON.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements json.Marshaler.

func (EnumWithValues) MarshalLogObject

func (v EnumWithValues) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of EnumWithValues. 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 (EnumWithValues) MarshalText

func (v EnumWithValues) MarshalText() ([]byte, error)

MarshalText encodes EnumWithValues to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (EnumWithValues) Ptr

func (v EnumWithValues) Ptr() *EnumWithValues

Ptr returns a pointer to this enum value.

func (EnumWithValues) String

func (v EnumWithValues) String() string

String returns a readable string representation of EnumWithValues.

func (EnumWithValues) ToWire

func (v EnumWithValues) ToWire() (wire.Value, error)

ToWire translates EnumWithValues 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 (*EnumWithValues) UnmarshalJSON

func (v *EnumWithValues) UnmarshalJSON(text []byte) error

UnmarshalJSON attempts to decode EnumWithValues 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 (*EnumWithValues) UnmarshalText

func (v *EnumWithValues) UnmarshalText(value []byte) error

UnmarshalText tries to decode EnumWithValues from a byte slice containing its name.

var v EnumWithValues
err := v.UnmarshalText([]byte("X"))

type LowerCaseEnum

type LowerCaseEnum int32
const (
	LowerCaseEnumContaining LowerCaseEnum = 0
	LowerCaseEnumLowerCase  LowerCaseEnum = 1
	LowerCaseEnumItems      LowerCaseEnum = 2
)

func LowerCaseEnum_Values

func LowerCaseEnum_Values() []LowerCaseEnum

LowerCaseEnum_Values returns all recognized values of LowerCaseEnum.

func (LowerCaseEnum) Equals

func (v LowerCaseEnum) Equals(rhs LowerCaseEnum) bool

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

func (*LowerCaseEnum) FromWire

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

FromWire deserializes LowerCaseEnum from its Thrift-level representation.

x, err := binaryProtocol.Decode(reader, wire.TI32)
if err != nil {
  return LowerCaseEnum(0), err
}

var v LowerCaseEnum
if err := v.FromWire(x); err != nil {
  return LowerCaseEnum(0), err
}
return v, nil

func (LowerCaseEnum) MarshalJSON

func (v LowerCaseEnum) MarshalJSON() ([]byte, error)

MarshalJSON serializes LowerCaseEnum into JSON.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements json.Marshaler.

func (LowerCaseEnum) MarshalLogObject

func (v LowerCaseEnum) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of LowerCaseEnum. 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 (LowerCaseEnum) MarshalText

func (v LowerCaseEnum) MarshalText() ([]byte, error)

MarshalText encodes LowerCaseEnum to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (LowerCaseEnum) Ptr

func (v LowerCaseEnum) Ptr() *LowerCaseEnum

Ptr returns a pointer to this enum value.

func (LowerCaseEnum) String

func (v LowerCaseEnum) String() string

String returns a readable string representation of LowerCaseEnum.

func (LowerCaseEnum) ToWire

func (v LowerCaseEnum) ToWire() (wire.Value, error)

ToWire translates LowerCaseEnum 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 (*LowerCaseEnum) UnmarshalJSON

func (v *LowerCaseEnum) UnmarshalJSON(text []byte) error

UnmarshalJSON attempts to decode LowerCaseEnum 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 (*LowerCaseEnum) UnmarshalText

func (v *LowerCaseEnum) UnmarshalText(value []byte) error

UnmarshalText tries to decode LowerCaseEnum from a byte slice containing its name.

var v LowerCaseEnum
err := v.UnmarshalText([]byte("containing"))

type RecordType

type RecordType int32

Kinds of records stored in the database.

const (
	// Name of the user.
	RecordTypeName RecordType = 0
	// Home address of the user.
	//
	// This record is always present.
	RecordTypeHomeAddress RecordType = 1
	// Home address of the user.
	//
	// This record may not be present.
	RecordTypeWorkAddress RecordType = 2
)

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 RecordTypeValues

type RecordTypeValues int32
const (
	RecordTypeValuesFoo RecordTypeValues = 0
	RecordTypeValuesBar RecordTypeValues = 1
)

func RecordTypeValues_Values

func RecordTypeValues_Values() []RecordTypeValues

RecordTypeValues_Values returns all recognized values of RecordTypeValues.

func (RecordTypeValues) Equals

func (v RecordTypeValues) Equals(rhs RecordTypeValues) bool

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

func (*RecordTypeValues) FromWire

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

FromWire deserializes RecordTypeValues from its Thrift-level representation.

x, err := binaryProtocol.Decode(reader, wire.TI32)
if err != nil {
  return RecordTypeValues(0), err
}

var v RecordTypeValues
if err := v.FromWire(x); err != nil {
  return RecordTypeValues(0), err
}
return v, nil

func (RecordTypeValues) MarshalJSON

func (v RecordTypeValues) MarshalJSON() ([]byte, error)

MarshalJSON serializes RecordTypeValues into JSON.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements json.Marshaler.

func (RecordTypeValues) MarshalLogObject

func (v RecordTypeValues) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of RecordTypeValues. 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 (RecordTypeValues) MarshalText

func (v RecordTypeValues) MarshalText() ([]byte, error)

MarshalText encodes RecordTypeValues to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (RecordTypeValues) Ptr

Ptr returns a pointer to this enum value.

func (RecordTypeValues) String

func (v RecordTypeValues) String() string

String returns a readable string representation of RecordTypeValues.

func (RecordTypeValues) ToWire

func (v RecordTypeValues) ToWire() (wire.Value, error)

ToWire translates RecordTypeValues 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 (*RecordTypeValues) UnmarshalJSON

func (v *RecordTypeValues) UnmarshalJSON(text []byte) error

UnmarshalJSON attempts to decode RecordTypeValues 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 (*RecordTypeValues) UnmarshalText

func (v *RecordTypeValues) UnmarshalText(value []byte) error

UnmarshalText tries to decode RecordTypeValues from a byte slice containing its name.

var v RecordTypeValues
err := v.UnmarshalText([]byte("FOO"))

type StructWithOptionalEnum

type StructWithOptionalEnum struct {
	E *EnumDefault `json:"e,omitempty"`
}

func (*StructWithOptionalEnum) Equals

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

This function performs a deep comparison.

func (*StructWithOptionalEnum) FromWire

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

FromWire deserializes a StructWithOptionalEnum 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 StructWithOptionalEnum struct from the provided intermediate representation.

x, err := binaryProtocol.Decode(reader, wire.TStruct)
if err != nil {
  return nil, err
}

var v StructWithOptionalEnum
if err := v.FromWire(x); err != nil {
  return nil, err
}
return &v, nil

func (*StructWithOptionalEnum) GetE

func (v *StructWithOptionalEnum) GetE() (o EnumDefault)

GetE returns the value of E if it is set or its zero value if it is unset.

func (*StructWithOptionalEnum) IsSetE added in v1.14.0

func (v *StructWithOptionalEnum) IsSetE() bool

IsSetE returns true if E is not nil.

func (*StructWithOptionalEnum) MarshalLogObject

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

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

func (*StructWithOptionalEnum) String

func (v *StructWithOptionalEnum) String() string

String returns a readable string representation of a StructWithOptionalEnum struct.

func (*StructWithOptionalEnum) ToWire

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

ToWire translates a StructWithOptionalEnum 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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL