enum_text_marshal_strict

package
v1.29.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ThriftModule = &thriftreflect.ThriftModule{
	Name:     "enum-text-marshal-strict",
	Package:  "go.uber.org/thriftrw/gen/internal/tests/enum-text-marshal-strict",
	FilePath: "enum-text-marshal-strict.thrift",
	SHA1:     "7d9566a0ff9eccda2ed5be518f321cfcba028dcb",
	Raw:      rawIDL,
}

ThriftModule represents the IDL file used to generate this package.

Functions

This section is empty.

Types

type EnumMarshalStrict

type EnumMarshalStrict int32
const (
	EnumMarshalStrictFoo EnumMarshalStrict = 0
	EnumMarshalStrictBar EnumMarshalStrict = 1
	EnumMarshalStrictBaz EnumMarshalStrict = 2
	EnumMarshalStrictBat EnumMarshalStrict = 3
)

func EnumMarshalStrict_Values

func EnumMarshalStrict_Values() []EnumMarshalStrict

EnumMarshalStrict_Values returns all recognized values of EnumMarshalStrict.

func (*EnumMarshalStrict) Decode added in v1.29.0

func (v *EnumMarshalStrict) Decode(sr stream.Reader) error

Decode reads off the encoded EnumMarshalStrict directly off of the wire.

sReader := BinaryStreamer.Reader(reader)

var v EnumMarshalStrict
if err := v.Decode(sReader); err != nil {
  return EnumMarshalStrict(0), err
}
return v, nil

func (EnumMarshalStrict) Encode added in v1.29.0

func (v EnumMarshalStrict) Encode(sw stream.Writer) error

Encode encodes EnumMarshalStrict directly to bytes.

sWriter := BinaryStreamer.Writer(writer)

var v EnumMarshalStrict
return v.Encode(sWriter)

func (EnumMarshalStrict) Equals

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

func (*EnumMarshalStrict) FromWire

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

FromWire deserializes EnumMarshalStrict from its Thrift-level representation.

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

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

func (EnumMarshalStrict) MarshalJSON

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

MarshalJSON serializes EnumMarshalStrict into JSON.

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

This implements json.Marshaler.

func (EnumMarshalStrict) MarshalLogObject

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

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

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

MarshalText encodes EnumMarshalStrict to text.

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

This implements the TextMarshaler interface.

func (EnumMarshalStrict) Ptr

Ptr returns a pointer to this enum value.

func (EnumMarshalStrict) String

func (v EnumMarshalStrict) String() string

String returns a readable string representation of EnumMarshalStrict.

func (EnumMarshalStrict) ToWire

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

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

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

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

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

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

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

Jump to

Keyboard shortcuts

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