thriftrw: go.uber.org/thriftrw/plugin/api Index | Files

package api

import "go.uber.org/thriftrw/plugin/api"

Index

Package Files

api.go plugin.go plugin_client.go plugin_handler.go servicegenerator.go servicegenerator_client.go servicegenerator_handler.go

Constants

const APIVersion int32 = 4

API_VERSION is the version of the plugin API.

This MUST be provided in the HandshakeResponse.

Variables

var Plugin_Goodbye_Helper = struct {
    // Args accepts the parameters of goodbye in-order and returns
    // the arguments struct for the function.
    Args func() *Plugin_Goodbye_Args

    // IsException returns true if the given error can be thrown
    // by goodbye.
    //
    // An error can be thrown by goodbye only if the
    // corresponding exception type was mentioned in the 'throws'
    // section for it in the Thrift file.
    IsException func(error) bool

    // WrapResponse returns the result struct for goodbye
    // given the error returned by it. The provided error may
    // be nil if goodbye did not fail.
    //
    // This allows mapping errors returned by goodbye into a
    // serializable result struct. WrapResponse returns a
    // non-nil error if the provided error cannot be thrown by
    // goodbye
    //
    //   err := goodbye(args)
    //   result, err := Plugin_Goodbye_Helper.WrapResponse(err)
    //   if err != nil {
    //     return fmt.Errorf("unexpected error from goodbye: %v", err)
    //   }
    //   serialize(result)
    WrapResponse func(error) (*Plugin_Goodbye_Result, error)

    // UnwrapResponse takes the result struct for goodbye
    // and returns the erorr returned by it (if any).
    //
    // The error is non-nil only if goodbye threw an
    // exception.
    //
    //   result := deserialize(bytes)
    //   err := Plugin_Goodbye_Helper.UnwrapResponse(result)
    UnwrapResponse func(*Plugin_Goodbye_Result) error
}{}

Plugin_Goodbye_Helper provides functions that aid in handling the parameters and return values of the Plugin.goodbye function.

var Plugin_Handshake_Helper = struct {
    // Args accepts the parameters of handshake in-order and returns
    // the arguments struct for the function.
    Args func(
        request *HandshakeRequest,
    ) *Plugin_Handshake_Args

    // IsException returns true if the given error can be thrown
    // by handshake.
    //
    // An error can be thrown by handshake only if the
    // corresponding exception type was mentioned in the 'throws'
    // section for it in the Thrift file.
    IsException func(error) bool

    // WrapResponse returns the result struct for handshake
    // given its return value and error.
    //
    // This allows mapping values and errors returned by
    // handshake into a serializable result struct.
    // WrapResponse returns a non-nil error if the provided
    // error cannot be thrown by handshake
    //
    //   value, err := handshake(args)
    //   result, err := Plugin_Handshake_Helper.WrapResponse(value, err)
    //   if err != nil {
    //     return fmt.Errorf("unexpected error from handshake: %v", err)
    //   }
    //   serialize(result)
    WrapResponse func(*HandshakeResponse, error) (*Plugin_Handshake_Result, error)

    // UnwrapResponse takes the result struct for handshake
    // and returns the value or error returned by it.
    //
    // The error is non-nil only if handshake threw an
    // exception.
    //
    //   result := deserialize(bytes)
    //   value, err := Plugin_Handshake_Helper.UnwrapResponse(result)
    UnwrapResponse func(*Plugin_Handshake_Result) (*HandshakeResponse, error)
}{}

Plugin_Handshake_Helper provides functions that aid in handling the parameters and return values of the Plugin.handshake function.

var ServiceGenerator_Generate_Helper = struct {
    // Args accepts the parameters of generate in-order and returns
    // the arguments struct for the function.
    Args func(
        request *GenerateServiceRequest,
    ) *ServiceGenerator_Generate_Args

    // IsException returns true if the given error can be thrown
    // by generate.
    //
    // An error can be thrown by generate only if the
    // corresponding exception type was mentioned in the 'throws'
    // section for it in the Thrift file.
    IsException func(error) bool

    // WrapResponse returns the result struct for generate
    // given its return value and error.
    //
    // This allows mapping values and errors returned by
    // generate into a serializable result struct.
    // WrapResponse returns a non-nil error if the provided
    // error cannot be thrown by generate
    //
    //   value, err := generate(args)
    //   result, err := ServiceGenerator_Generate_Helper.WrapResponse(value, err)
    //   if err != nil {
    //     return fmt.Errorf("unexpected error from generate: %v", err)
    //   }
    //   serialize(result)
    WrapResponse func(*GenerateServiceResponse, error) (*ServiceGenerator_Generate_Result, error)

    // UnwrapResponse takes the result struct for generate
    // and returns the value or error returned by it.
    //
    // The error is non-nil only if generate threw an
    // exception.
    //
    //   result := deserialize(bytes)
    //   value, err := ServiceGenerator_Generate_Helper.UnwrapResponse(result)
    UnwrapResponse func(*ServiceGenerator_Generate_Result) (*GenerateServiceResponse, error)
}{}

ServiceGenerator_Generate_Helper provides functions that aid in handling the parameters and return values of the ServiceGenerator.generate function.

var ThriftModule = &thriftreflect.ThriftModule{
    Name:     "api",
    Package:  "go.uber.org/thriftrw/plugin/api",
    FilePath: "api.thrift",
    SHA1:     "2ec53cec3e4ed0e3d00c1d88c002ea0a5af97572",
    Raw:      rawIDL,
}

ThriftModule represents the IDL file used to generate this package.

type Argument Uses

type Argument struct {
    // Name of the argument. This is also the name of the argument field
    // inside the args/result struct for that function.
    Name string `json:"name,required"`
    // Argument type.
    Type *Type `json:"type,required"`
    // Annotations defined on this argument.
    //
    // Given,
    //
    //   void setValue(
    //     1: SetValueRequest req
    //   ) throws (
    //     1: BadRequestError badRequestError (cache = "false")
    //   )
    //
    // The annotations for the Argument representing badRequestError will be,
    //
    //  {
    //    "cache": "false",
    //  }
    Annotations map[string]string `json:"annotations,omitempty"`
}

Argument is a single Argument inside a Function. For,

void setValue(1: string key, 2: string value)

You get the arguments,

Argument{Name: "Key", Type: Type{SimpleType: SimpleTypeString}}

Argument{Name: "Value", Type: Type{SimpleType: SimpleTypeString}}

func (*Argument) Equals Uses

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

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

This function performs a deep comparison.

func (*Argument) FromWire Uses

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

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

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

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

func (*Argument) GetAnnotations Uses

func (v *Argument) GetAnnotations() (o map[string]string)

GetAnnotations returns the value of Annotations if it is set or its zero value if it is unset.

func (*Argument) GetName Uses

func (v *Argument) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*Argument) GetType Uses

func (v *Argument) GetType() (o *Type)

GetType returns the value of Type if it is set or its zero value if it is unset.

func (*Argument) IsSetAnnotations Uses

func (v *Argument) IsSetAnnotations() bool

IsSetAnnotations returns true if Annotations is not nil.

func (*Argument) IsSetType Uses

func (v *Argument) IsSetType() bool

IsSetType returns true if Type is not nil.

func (*Argument) MarshalLogObject Uses

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

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

func (*Argument) String Uses

func (v *Argument) String() string

String returns a readable string representation of a Argument struct.

func (*Argument) ToWire Uses

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

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

type Feature Uses

type Feature int32

Feature is a functionality offered by a ThriftRW plugin.

const (
    // SERVICE_GENERATOR specifies that the plugin may generate arbitrary code
    // for services defined in the Thrift file.
    //
    // If a plugin provides this, it MUST implement the ServiceGenerator
    // service.
    FeatureServiceGenerator Feature = 1
)

func Feature_Values Uses

func Feature_Values() []Feature

Feature_Values returns all recognized values of Feature.

func (Feature) Equals Uses

func (v Feature) Equals(rhs Feature) bool

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

func (*Feature) FromWire Uses

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

FromWire deserializes Feature from its Thrift-level representation.

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

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

func (Feature) MarshalJSON Uses

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

MarshalJSON serializes Feature into JSON.

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

This implements json.Marshaler.

func (Feature) MarshalLogObject Uses

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

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

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

MarshalText encodes Feature to text.

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

This implements the TextMarshaler interface.

func (Feature) Ptr Uses

func (v Feature) Ptr() *Feature

Ptr returns a pointer to this enum value.

func (Feature) String Uses

func (v Feature) String() string

String returns a readable string representation of Feature.

func (Feature) ToWire Uses

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

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

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

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

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

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

var v Feature
err := v.UnmarshalText([]byte("SERVICE_GENERATOR"))

type Function Uses

type Function struct {
    // Name of the Go function.
    Name string `json:"name,required"`
    // Name of the function as defined in the Thrift file.
    ThriftName string `json:"thriftName,required"`
    // List of arguments accepted by the function.
    //
    // This list is in the order specified by the user in the Thrift file.
    Arguments []*Argument `json:"arguments,required"`
    // Return type of the function, if any. If this is not set, the function
    // is a void function.
    ReturnType *Type `json:"returnType,omitempty"`
    // List of exceptions raised by the function.
    //
    // This list is in the order specified by the user in the Thrift file.
    Exceptions []*Argument `json:"exceptions,omitempty"`
    // Whether this function is oneway or not. This should be assumed to be
    // false unless explicitly stated otherwise. If this is true, the
    // returnType and exceptions will be null or empty.
    OneWay *bool `json:"oneWay,omitempty"`
    // Annotations defined on this function.
    //
    // Given,
    //
    //   void setValue(1: SetValueRequest req) (cache = "false")
    //
    // The annotations will be,
    //
    //  {
    //    "cache": "false",
    //  }
    Annotations map[string]string `json:"annotations,omitempty"`
}

Function is a single function on a Thrift service.

func (*Function) Equals Uses

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

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

This function performs a deep comparison.

func (*Function) FromWire Uses

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

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

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

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

func (*Function) GetAnnotations Uses

func (v *Function) GetAnnotations() (o map[string]string)

GetAnnotations returns the value of Annotations if it is set or its zero value if it is unset.

func (*Function) GetArguments Uses

func (v *Function) GetArguments() (o []*Argument)

GetArguments returns the value of Arguments if it is set or its zero value if it is unset.

func (*Function) GetExceptions Uses

func (v *Function) GetExceptions() (o []*Argument)

GetExceptions returns the value of Exceptions if it is set or its zero value if it is unset.

func (*Function) GetName Uses

func (v *Function) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*Function) GetOneWay Uses

func (v *Function) GetOneWay() (o bool)

GetOneWay returns the value of OneWay if it is set or its zero value if it is unset.

func (*Function) GetReturnType Uses

func (v *Function) GetReturnType() (o *Type)

GetReturnType returns the value of ReturnType if it is set or its zero value if it is unset.

func (*Function) GetThriftName Uses

func (v *Function) GetThriftName() (o string)

GetThriftName returns the value of ThriftName if it is set or its zero value if it is unset.

func (*Function) IsSetAnnotations Uses

func (v *Function) IsSetAnnotations() bool

IsSetAnnotations returns true if Annotations is not nil.

func (*Function) IsSetArguments Uses

func (v *Function) IsSetArguments() bool

IsSetArguments returns true if Arguments is not nil.

func (*Function) IsSetExceptions Uses

func (v *Function) IsSetExceptions() bool

IsSetExceptions returns true if Exceptions is not nil.

func (*Function) IsSetOneWay Uses

func (v *Function) IsSetOneWay() bool

IsSetOneWay returns true if OneWay is not nil.

func (*Function) IsSetReturnType Uses

func (v *Function) IsSetReturnType() bool

IsSetReturnType returns true if ReturnType is not nil.

func (*Function) MarshalLogObject Uses

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

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

func (*Function) String Uses

func (v *Function) String() string

String returns a readable string representation of a Function struct.

func (*Function) ToWire Uses

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

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

type GenerateServiceRequest Uses

type GenerateServiceRequest struct {
    // IDs of services for which code should be generated.
    //
    // Note that the services map contains information about both, the
    // services being generated and their transitive dependencies. Code should
    // only be generated for service IDs listed here.
    RootServices []ServiceID `json:"rootServices,required"`
    // Map of service ID to service.
    //
    // Any service IDs present in this request will have a corresponding
    // service definition in this map, including services for which code does
    // not need to be generated.
    Services map[ServiceID]*Service `json:"services,required"`
    // Map of module ID to module.
    //
    // Any module IDs present in the request will have a corresponding module
    // definition in this map.
    Modules map[ModuleID]*Module `json:"modules,required"`
    // Prefix for import paths of generated module. In general, plugins should
    // not need to use the package prefix unless instantiating a new
    // Generator for more custom plugin generation.
    PackagePrefix string `json:"packagePrefix,required"`
    // Directory whose descendants contain all Thrift files. In general,
    // plugins should not need to use the thrift root unless instantiating a
    // new Generator for more custom plugin generation.
    ThriftRoot string `json:"thriftRoot,required"`
}

GenerateServiceRequest is a request to generate code for zero or more Thrift services.

func (*GenerateServiceRequest) Equals Uses

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

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

This function performs a deep comparison.

func (*GenerateServiceRequest) FromWire Uses

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

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

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

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

func (*GenerateServiceRequest) GetModules Uses

func (v *GenerateServiceRequest) GetModules() (o map[ModuleID]*Module)

GetModules returns the value of Modules if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) GetPackagePrefix Uses

func (v *GenerateServiceRequest) GetPackagePrefix() (o string)

GetPackagePrefix returns the value of PackagePrefix if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) GetRootServices Uses

func (v *GenerateServiceRequest) GetRootServices() (o []ServiceID)

GetRootServices returns the value of RootServices if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) GetServices Uses

func (v *GenerateServiceRequest) GetServices() (o map[ServiceID]*Service)

GetServices returns the value of Services if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) GetThriftRoot Uses

func (v *GenerateServiceRequest) GetThriftRoot() (o string)

GetThriftRoot returns the value of ThriftRoot if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) IsSetModules Uses

func (v *GenerateServiceRequest) IsSetModules() bool

IsSetModules returns true if Modules is not nil.

func (*GenerateServiceRequest) IsSetRootServices Uses

func (v *GenerateServiceRequest) IsSetRootServices() bool

IsSetRootServices returns true if RootServices is not nil.

func (*GenerateServiceRequest) IsSetServices Uses

func (v *GenerateServiceRequest) IsSetServices() bool

IsSetServices returns true if Services is not nil.

func (*GenerateServiceRequest) MarshalLogObject Uses

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

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

func (*GenerateServiceRequest) String Uses

func (v *GenerateServiceRequest) String() string

String returns a readable string representation of a GenerateServiceRequest struct.

func (*GenerateServiceRequest) ToWire Uses

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

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

type GenerateServiceResponse Uses

type GenerateServiceResponse struct {
    // Map of file path to file contents.
    //
    // All paths MUST be relative to the output directory into which ThriftRW
    // is generating code. Plugins SHOULD NOT make any assumptions about the
    // absolute location of the directory.
    //
    // The paths MUST NOT contain the string ".." or the request will fail.
    Files map[string][]byte `json:"files,omitempty"`
}

GenerateServiceResponse is response to a GenerateServiceRequest.

func (*GenerateServiceResponse) Equals Uses

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

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

This function performs a deep comparison.

func (*GenerateServiceResponse) FromWire Uses

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

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

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

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

func (*GenerateServiceResponse) GetFiles Uses

func (v *GenerateServiceResponse) GetFiles() (o map[string][]byte)

GetFiles returns the value of Files if it is set or its zero value if it is unset.

func (*GenerateServiceResponse) IsSetFiles Uses

func (v *GenerateServiceResponse) IsSetFiles() bool

IsSetFiles returns true if Files is not nil.

func (*GenerateServiceResponse) MarshalLogObject Uses

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

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

func (*GenerateServiceResponse) String Uses

func (v *GenerateServiceResponse) String() string

String returns a readable string representation of a GenerateServiceResponse struct.

func (*GenerateServiceResponse) ToWire Uses

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

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

type HandshakeRequest Uses

type HandshakeRequest struct {
}

HandshakeRequest is the initial request sent to the plugin as part of establishing communication and feature negotiation.

func (*HandshakeRequest) Equals Uses

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

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

This function performs a deep comparison.

func (*HandshakeRequest) FromWire Uses

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

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

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

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

func (*HandshakeRequest) MarshalLogObject Uses

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

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

func (*HandshakeRequest) String Uses

func (v *HandshakeRequest) String() string

String returns a readable string representation of a HandshakeRequest struct.

func (*HandshakeRequest) ToWire Uses

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

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

type HandshakeResponse Uses

type HandshakeResponse struct {
    // Name of the plugin. This MUST match the name of the plugin specified
    // over the command line or the program will fail.
    Name string `json:"name,required"`
    // Version of the plugin API.
    //
    // This MUST be set to API_VERSION by the plugin.
    APIVersion int32 `json:"apiVersion,required"`
    // List of features the plugin provides.
    Features []Feature `json:"features,required"`
    // Version of ThriftRW with which the plugin was built.
    //
    // This MUST be set to go.uber.org/thriftrw/version.Version by the plugin
    // explicitly.
    LibraryVersion *string `json:"libraryVersion,omitempty"`
}

HandshakeResponse is the response from the plugin for a HandshakeRequest.

func (*HandshakeResponse) Equals Uses

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

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

This function performs a deep comparison.

func (*HandshakeResponse) FromWire Uses

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

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

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

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

func (*HandshakeResponse) GetAPIVersion Uses

func (v *HandshakeResponse) GetAPIVersion() (o int32)

GetAPIVersion returns the value of APIVersion if it is set or its zero value if it is unset.

func (*HandshakeResponse) GetFeatures Uses

func (v *HandshakeResponse) GetFeatures() (o []Feature)

GetFeatures returns the value of Features if it is set or its zero value if it is unset.

func (*HandshakeResponse) GetLibraryVersion Uses

func (v *HandshakeResponse) GetLibraryVersion() (o string)

GetLibraryVersion returns the value of LibraryVersion if it is set or its zero value if it is unset.

func (*HandshakeResponse) GetName Uses

func (v *HandshakeResponse) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*HandshakeResponse) IsSetFeatures Uses

func (v *HandshakeResponse) IsSetFeatures() bool

IsSetFeatures returns true if Features is not nil.

func (*HandshakeResponse) IsSetLibraryVersion Uses

func (v *HandshakeResponse) IsSetLibraryVersion() bool

IsSetLibraryVersion returns true if LibraryVersion is not nil.

func (*HandshakeResponse) MarshalLogObject Uses

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

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

func (*HandshakeResponse) String Uses

func (v *HandshakeResponse) String() string

String returns a readable string representation of a HandshakeResponse struct.

func (*HandshakeResponse) ToWire Uses

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

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

type Module Uses

type Module struct {
    // Import path for the package defining the types for this module.
    ImportPath string `json:"importPath,required"`
    // Path to the directory containing the code for this module.
    //
    // The path is relative to the output directory into which ThriftRW is
    // generating code. Plugins SHOULD NOT make any assumptions about the
    // absolute location of the directory.
    Directory string `json:"directory,required"`
    // Path to the Thrift file from which this module was generated.
    ThriftFilePath string `json:"thriftFilePath,required"`
}

Module is a module generated from a single Thrift file. Each module corresponds to exactly one Thrift file and contains all the types and constants defined in that Thrift file.

func (*Module) Equals Uses

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

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

This function performs a deep comparison.

func (*Module) FromWire Uses

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

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

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

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

func (*Module) GetDirectory Uses

func (v *Module) GetDirectory() (o string)

GetDirectory returns the value of Directory if it is set or its zero value if it is unset.

func (*Module) GetImportPath Uses

func (v *Module) GetImportPath() (o string)

GetImportPath returns the value of ImportPath if it is set or its zero value if it is unset.

func (*Module) GetThriftFilePath Uses

func (v *Module) GetThriftFilePath() (o string)

GetThriftFilePath returns the value of ThriftFilePath if it is set or its zero value if it is unset.

func (*Module) MarshalLogObject Uses

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

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

func (*Module) String Uses

func (v *Module) String() string

String returns a readable string representation of a Module struct.

func (*Module) ToWire Uses

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

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

type ModuleID Uses

type ModuleID int32

ModuleID is an arbitrary unique identifier to reference the different modules in this request.

func (ModuleID) Equals Uses

func (lhs ModuleID) Equals(rhs ModuleID) bool

Equals returns true if this ModuleID is equal to the provided ModuleID.

func (*ModuleID) FromWire Uses

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

FromWire deserializes ModuleID from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.

func (ModuleID) Ptr Uses

func (v ModuleID) Ptr() *ModuleID

ModuleIDPtr returns a pointer to a ModuleID

func (ModuleID) String Uses

func (v ModuleID) String() string

String returns a readable string representation of ModuleID.

func (ModuleID) ToWire Uses

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

ToWire translates ModuleID into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.

type Plugin Uses

type Plugin interface {
    Goodbye() error

    Handshake(
        Request *HandshakeRequest,
    ) (*HandshakeResponse, error)
}

func NewPluginClient Uses

func NewPluginClient(c envelope.Client) Plugin

NewPluginClient builds a new Plugin client.

type PluginHandler Uses

type PluginHandler struct {
    // contains filtered or unexported fields
}

PluginHandler serves an implementation of the Plugin service.

func NewPluginHandler Uses

func NewPluginHandler(service Plugin) PluginHandler

NewPluginHandler builds a new Plugin handler.

func (PluginHandler) Handle Uses

func (h PluginHandler) Handle(name string, reqValue wire.Value) (wire.Value, error)

Handle receives and handles a request for the Plugin service.

type Plugin_Goodbye_Args Uses

type Plugin_Goodbye_Args struct {
}

Plugin_Goodbye_Args represents the arguments for the Plugin.goodbye function.

The arguments for goodbye are sent and received over the wire as this struct.

func (*Plugin_Goodbye_Args) EnvelopeType Uses

func (v *Plugin_Goodbye_Args) EnvelopeType() wire.EnvelopeType

EnvelopeType returns the kind of value inside this struct.

This will always be Call for this struct.

func (*Plugin_Goodbye_Args) Equals Uses

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

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

This function performs a deep comparison.

func (*Plugin_Goodbye_Args) FromWire Uses

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

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

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

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

func (*Plugin_Goodbye_Args) MarshalLogObject Uses

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

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

func (*Plugin_Goodbye_Args) MethodName Uses

func (v *Plugin_Goodbye_Args) MethodName() string

MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the arguments.

This will always be "goodbye" for this struct.

func (*Plugin_Goodbye_Args) String Uses

func (v *Plugin_Goodbye_Args) String() string

String returns a readable string representation of a Plugin_Goodbye_Args struct.

func (*Plugin_Goodbye_Args) ToWire Uses

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

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

type Plugin_Goodbye_Result Uses

type Plugin_Goodbye_Result struct {
}

Plugin_Goodbye_Result represents the result of a Plugin.goodbye function call.

The result of a goodbye execution is sent and received over the wire as this struct.

func (*Plugin_Goodbye_Result) EnvelopeType Uses

func (v *Plugin_Goodbye_Result) EnvelopeType() wire.EnvelopeType

EnvelopeType returns the kind of value inside this struct.

This will always be Reply for this struct.

func (*Plugin_Goodbye_Result) Equals Uses

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

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

This function performs a deep comparison.

func (*Plugin_Goodbye_Result) FromWire Uses

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

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

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

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

func (*Plugin_Goodbye_Result) MarshalLogObject Uses

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

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

func (*Plugin_Goodbye_Result) MethodName Uses

func (v *Plugin_Goodbye_Result) MethodName() string

MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the result.

This will always be "goodbye" for this struct.

func (*Plugin_Goodbye_Result) String Uses

func (v *Plugin_Goodbye_Result) String() string

String returns a readable string representation of a Plugin_Goodbye_Result struct.

func (*Plugin_Goodbye_Result) ToWire Uses

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

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

type Plugin_Handshake_Args Uses

type Plugin_Handshake_Args struct {
    Request *HandshakeRequest `json:"request,omitempty"`
}

Plugin_Handshake_Args represents the arguments for the Plugin.handshake function.

The arguments for handshake are sent and received over the wire as this struct.

func (*Plugin_Handshake_Args) EnvelopeType Uses

func (v *Plugin_Handshake_Args) EnvelopeType() wire.EnvelopeType

EnvelopeType returns the kind of value inside this struct.

This will always be Call for this struct.

func (*Plugin_Handshake_Args) Equals Uses

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

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

This function performs a deep comparison.

func (*Plugin_Handshake_Args) FromWire Uses

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

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

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

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

func (*Plugin_Handshake_Args) GetRequest Uses

func (v *Plugin_Handshake_Args) GetRequest() (o *HandshakeRequest)

GetRequest returns the value of Request if it is set or its zero value if it is unset.

func (*Plugin_Handshake_Args) IsSetRequest Uses

func (v *Plugin_Handshake_Args) IsSetRequest() bool

IsSetRequest returns true if Request is not nil.

func (*Plugin_Handshake_Args) MarshalLogObject Uses

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

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

func (*Plugin_Handshake_Args) MethodName Uses

func (v *Plugin_Handshake_Args) MethodName() string

MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the arguments.

This will always be "handshake" for this struct.

func (*Plugin_Handshake_Args) String Uses

func (v *Plugin_Handshake_Args) String() string

String returns a readable string representation of a Plugin_Handshake_Args struct.

func (*Plugin_Handshake_Args) ToWire Uses

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

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

type Plugin_Handshake_Result Uses

type Plugin_Handshake_Result struct {
    // Value returned by handshake after a successful execution.
    Success *HandshakeResponse `json:"success,omitempty"`
}

Plugin_Handshake_Result represents the result of a Plugin.handshake function call.

The result of a handshake execution is sent and received over the wire as this struct.

Success is set only if the function did not throw an exception.

func (*Plugin_Handshake_Result) EnvelopeType Uses

func (v *Plugin_Handshake_Result) EnvelopeType() wire.EnvelopeType

EnvelopeType returns the kind of value inside this struct.

This will always be Reply for this struct.

func (*Plugin_Handshake_Result) Equals Uses

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

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

This function performs a deep comparison.

func (*Plugin_Handshake_Result) FromWire Uses

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

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

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

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

func (*Plugin_Handshake_Result) GetSuccess Uses

func (v *Plugin_Handshake_Result) GetSuccess() (o *HandshakeResponse)

GetSuccess returns the value of Success if it is set or its zero value if it is unset.

func (*Plugin_Handshake_Result) IsSetSuccess Uses

func (v *Plugin_Handshake_Result) IsSetSuccess() bool

IsSetSuccess returns true if Success is not nil.

func (*Plugin_Handshake_Result) MarshalLogObject Uses

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

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

func (*Plugin_Handshake_Result) MethodName Uses

func (v *Plugin_Handshake_Result) MethodName() string

MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the result.

This will always be "handshake" for this struct.

func (*Plugin_Handshake_Result) String Uses

func (v *Plugin_Handshake_Result) String() string

String returns a readable string representation of a Plugin_Handshake_Result struct.

func (*Plugin_Handshake_Result) ToWire Uses

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

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

type Service Uses

type Service struct {
    // Name of the Thrift service in Go code.
    Name string `json:"name,required"`
    // Name of the service as defined in the Thrift file.
    ThriftName string `json:"thriftName,required"`
    // ID of the parent service.
    ParentID *ServiceID `json:"parentID,omitempty"`
    // List of functions defined for this service.
    Functions []*Function `json:"functions,required"`
    // ID of the module where this service was declared.
    ModuleID ModuleID `json:"moduleID,required"`
    // Annotations defined on this service.
    //
    // Given,
    //
    //   service KeyValue {
    //   } (private = "true")
    //
    // The annotations will be,
    //
    //  {
    //    "private": "true",
    //  }
    Annotations map[string]string `json:"annotations,omitempty"`
}

Service is a service defined by the user in the Thrift file.

func (*Service) Equals Uses

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

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

This function performs a deep comparison.

func (*Service) FromWire Uses

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

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

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

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

func (*Service) GetAnnotations Uses

func (v *Service) GetAnnotations() (o map[string]string)

GetAnnotations returns the value of Annotations if it is set or its zero value if it is unset.

func (*Service) GetFunctions Uses

func (v *Service) GetFunctions() (o []*Function)

GetFunctions returns the value of Functions if it is set or its zero value if it is unset.

func (*Service) GetModuleID Uses

func (v *Service) GetModuleID() (o ModuleID)

GetModuleID returns the value of ModuleID if it is set or its zero value if it is unset.

func (*Service) GetName Uses

func (v *Service) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*Service) GetParentID Uses

func (v *Service) GetParentID() (o ServiceID)

GetParentID returns the value of ParentID if it is set or its zero value if it is unset.

func (*Service) GetThriftName Uses

func (v *Service) GetThriftName() (o string)

GetThriftName returns the value of ThriftName if it is set or its zero value if it is unset.

func (*Service) IsSetAnnotations Uses

func (v *Service) IsSetAnnotations() bool

IsSetAnnotations returns true if Annotations is not nil.

func (*Service) IsSetFunctions Uses

func (v *Service) IsSetFunctions() bool

IsSetFunctions returns true if Functions is not nil.

func (*Service) IsSetParentID Uses

func (v *Service) IsSetParentID() bool

IsSetParentID returns true if ParentID is not nil.

func (*Service) MarshalLogObject Uses

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

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

func (*Service) String Uses

func (v *Service) String() string

String returns a readable string representation of a Service struct.

func (*Service) ToWire Uses

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

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

type ServiceGenerator Uses

type ServiceGenerator interface {
    Generate(
        Request *GenerateServiceRequest,
    ) (*GenerateServiceResponse, error)
}

func NewServiceGeneratorClient Uses

func NewServiceGeneratorClient(c envelope.Client) ServiceGenerator

NewServiceGeneratorClient builds a new ServiceGenerator client.

type ServiceGeneratorHandler Uses

type ServiceGeneratorHandler struct {
    // contains filtered or unexported fields
}

ServiceGeneratorHandler serves an implementation of the ServiceGenerator service.

func NewServiceGeneratorHandler Uses

func NewServiceGeneratorHandler(service ServiceGenerator) ServiceGeneratorHandler

NewServiceGeneratorHandler builds a new ServiceGenerator handler.

func (ServiceGeneratorHandler) Handle Uses

func (h ServiceGeneratorHandler) Handle(name string, reqValue wire.Value) (wire.Value, error)

Handle receives and handles a request for the ServiceGenerator service.

type ServiceGenerator_Generate_Args Uses

type ServiceGenerator_Generate_Args struct {
    Request *GenerateServiceRequest `json:"request,omitempty"`
}

ServiceGenerator_Generate_Args represents the arguments for the ServiceGenerator.generate function.

The arguments for generate are sent and received over the wire as this struct.

func (*ServiceGenerator_Generate_Args) EnvelopeType Uses

func (v *ServiceGenerator_Generate_Args) EnvelopeType() wire.EnvelopeType

EnvelopeType returns the kind of value inside this struct.

This will always be Call for this struct.

func (*ServiceGenerator_Generate_Args) Equals Uses

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

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

This function performs a deep comparison.

func (*ServiceGenerator_Generate_Args) FromWire Uses

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

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

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

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

func (*ServiceGenerator_Generate_Args) GetRequest Uses

func (v *ServiceGenerator_Generate_Args) GetRequest() (o *GenerateServiceRequest)

GetRequest returns the value of Request if it is set or its zero value if it is unset.

func (*ServiceGenerator_Generate_Args) IsSetRequest Uses

func (v *ServiceGenerator_Generate_Args) IsSetRequest() bool

IsSetRequest returns true if Request is not nil.

func (*ServiceGenerator_Generate_Args) MarshalLogObject Uses

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

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

func (*ServiceGenerator_Generate_Args) MethodName Uses

func (v *ServiceGenerator_Generate_Args) MethodName() string

MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the arguments.

This will always be "generate" for this struct.

func (*ServiceGenerator_Generate_Args) String Uses

func (v *ServiceGenerator_Generate_Args) String() string

String returns a readable string representation of a ServiceGenerator_Generate_Args struct.

func (*ServiceGenerator_Generate_Args) ToWire Uses

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

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

type ServiceGenerator_Generate_Result Uses

type ServiceGenerator_Generate_Result struct {
    // Value returned by generate after a successful execution.
    Success *GenerateServiceResponse `json:"success,omitempty"`
}

ServiceGenerator_Generate_Result represents the result of a ServiceGenerator.generate function call.

The result of a generate execution is sent and received over the wire as this struct.

Success is set only if the function did not throw an exception.

func (*ServiceGenerator_Generate_Result) EnvelopeType Uses

func (v *ServiceGenerator_Generate_Result) EnvelopeType() wire.EnvelopeType

EnvelopeType returns the kind of value inside this struct.

This will always be Reply for this struct.

func (*ServiceGenerator_Generate_Result) Equals Uses

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

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

This function performs a deep comparison.

func (*ServiceGenerator_Generate_Result) FromWire Uses

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

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

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

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

func (*ServiceGenerator_Generate_Result) GetSuccess Uses

func (v *ServiceGenerator_Generate_Result) GetSuccess() (o *GenerateServiceResponse)

GetSuccess returns the value of Success if it is set or its zero value if it is unset.

func (*ServiceGenerator_Generate_Result) IsSetSuccess Uses

func (v *ServiceGenerator_Generate_Result) IsSetSuccess() bool

IsSetSuccess returns true if Success is not nil.

func (*ServiceGenerator_Generate_Result) MarshalLogObject Uses

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

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

func (*ServiceGenerator_Generate_Result) MethodName Uses

func (v *ServiceGenerator_Generate_Result) MethodName() string

MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the result.

This will always be "generate" for this struct.

func (*ServiceGenerator_Generate_Result) String Uses

func (v *ServiceGenerator_Generate_Result) String() string

String returns a readable string representation of a ServiceGenerator_Generate_Result struct.

func (*ServiceGenerator_Generate_Result) ToWire Uses

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

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

type ServiceID Uses

type ServiceID int32

ServiceID is an arbitrary unique identifier to reference the different services in this request.

func (ServiceID) Equals Uses

func (lhs ServiceID) Equals(rhs ServiceID) bool

Equals returns true if this ServiceID is equal to the provided ServiceID.

func (*ServiceID) FromWire Uses

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

FromWire deserializes ServiceID from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.

func (ServiceID) Ptr Uses

func (v ServiceID) Ptr() *ServiceID

ServiceIDPtr returns a pointer to a ServiceID

func (ServiceID) String Uses

func (v ServiceID) String() string

String returns a readable string representation of ServiceID.

func (ServiceID) ToWire Uses

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

ToWire translates ServiceID into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.

type SimpleType Uses

type SimpleType int32

SimpleType is a standalone native Go type.

const (
    SimpleTypeBool        SimpleType = 1
    SimpleTypeByte        SimpleType = 2
    SimpleTypeInt8        SimpleType = 3
    SimpleTypeInt16       SimpleType = 4
    SimpleTypeInt32       SimpleType = 5
    SimpleTypeInt64       SimpleType = 6
    SimpleTypeFloat64     SimpleType = 7
    SimpleTypeString      SimpleType = 8
    SimpleTypeStructEmpty SimpleType = 9
)

func SimpleType_Values Uses

func SimpleType_Values() []SimpleType

SimpleType_Values returns all recognized values of SimpleType.

func (SimpleType) Equals Uses

func (v SimpleType) Equals(rhs SimpleType) bool

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

func (*SimpleType) FromWire Uses

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

FromWire deserializes SimpleType from its Thrift-level representation.

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

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

func (SimpleType) MarshalJSON Uses

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

MarshalJSON serializes SimpleType into JSON.

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

This implements json.Marshaler.

func (SimpleType) MarshalLogObject Uses

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

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

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

MarshalText encodes SimpleType to text.

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

This implements the TextMarshaler interface.

func (SimpleType) Ptr Uses

func (v SimpleType) Ptr() *SimpleType

Ptr returns a pointer to this enum value.

func (SimpleType) String Uses

func (v SimpleType) String() string

String returns a readable string representation of SimpleType.

func (SimpleType) ToWire Uses

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

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

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

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

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

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

var v SimpleType
err := v.UnmarshalText([]byte("BOOL"))

type Type Uses

type Type struct {
    SimpleType *SimpleType `json:"simpleType,omitempty"`
    // Slice of a type
    //
    // []$sliceType
    SliceType *Type `json:"sliceType,omitempty"`
    // Slice of key-value pairs of a pair of types.
    //
    // []struct{Key $left, Value $right}
    KeyValueSliceType *TypePair `json:"keyValueSliceType,omitempty"`
    // Map of a pair of types.
    //
    // map[$left]$right
    MapType *TypePair `json:"mapType,omitempty"`
    // Reference to a user-defined type.
    ReferenceType *TypeReference `json:"referenceType,omitempty"`
    // Pointer to a type.
    PointerType *Type `json:"pointerType,omitempty"`
}

Type is a reference to a Go type which may be native or user defined.

func (*Type) Equals Uses

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

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

This function performs a deep comparison.

func (*Type) FromWire Uses

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

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

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

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

func (*Type) GetKeyValueSliceType Uses

func (v *Type) GetKeyValueSliceType() (o *TypePair)

GetKeyValueSliceType returns the value of KeyValueSliceType if it is set or its zero value if it is unset.

func (*Type) GetMapType Uses

func (v *Type) GetMapType() (o *TypePair)

GetMapType returns the value of MapType if it is set or its zero value if it is unset.

func (*Type) GetPointerType Uses

func (v *Type) GetPointerType() (o *Type)

GetPointerType returns the value of PointerType if it is set or its zero value if it is unset.

func (*Type) GetReferenceType Uses

func (v *Type) GetReferenceType() (o *TypeReference)

GetReferenceType returns the value of ReferenceType if it is set or its zero value if it is unset.

func (*Type) GetSimpleType Uses

func (v *Type) GetSimpleType() (o SimpleType)

GetSimpleType returns the value of SimpleType if it is set or its zero value if it is unset.

func (*Type) GetSliceType Uses

func (v *Type) GetSliceType() (o *Type)

GetSliceType returns the value of SliceType if it is set or its zero value if it is unset.

func (*Type) IsSetKeyValueSliceType Uses

func (v *Type) IsSetKeyValueSliceType() bool

IsSetKeyValueSliceType returns true if KeyValueSliceType is not nil.

func (*Type) IsSetMapType Uses

func (v *Type) IsSetMapType() bool

IsSetMapType returns true if MapType is not nil.

func (*Type) IsSetPointerType Uses

func (v *Type) IsSetPointerType() bool

IsSetPointerType returns true if PointerType is not nil.

func (*Type) IsSetReferenceType Uses

func (v *Type) IsSetReferenceType() bool

IsSetReferenceType returns true if ReferenceType is not nil.

func (*Type) IsSetSimpleType Uses

func (v *Type) IsSetSimpleType() bool

IsSetSimpleType returns true if SimpleType is not nil.

func (*Type) IsSetSliceType Uses

func (v *Type) IsSetSliceType() bool

IsSetSliceType returns true if SliceType is not nil.

func (*Type) MarshalLogObject Uses

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

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

func (*Type) String Uses

func (v *Type) String() string

String returns a readable string representation of a Type struct.

func (*Type) ToWire Uses

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

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

type TypePair Uses

type TypePair struct {
    Left  *Type `json:"left,required"`
    Right *Type `json:"right,required"`
}

TypePair is a pair of two types.

func (*TypePair) Equals Uses

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

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

This function performs a deep comparison.

func (*TypePair) FromWire Uses

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

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

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

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

func (*TypePair) GetLeft Uses

func (v *TypePair) GetLeft() (o *Type)

GetLeft returns the value of Left if it is set or its zero value if it is unset.

func (*TypePair) GetRight Uses

func (v *TypePair) GetRight() (o *Type)

GetRight returns the value of Right if it is set or its zero value if it is unset.

func (*TypePair) IsSetLeft Uses

func (v *TypePair) IsSetLeft() bool

IsSetLeft returns true if Left is not nil.

func (*TypePair) IsSetRight Uses

func (v *TypePair) IsSetRight() bool

IsSetRight returns true if Right is not nil.

func (*TypePair) MarshalLogObject Uses

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

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

func (*TypePair) String Uses

func (v *TypePair) String() string

String returns a readable string representation of a TypePair struct.

func (*TypePair) ToWire Uses

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

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

type TypeReference Uses

type TypeReference struct {
    Name string `json:"name,required"`
    // Import path for the package defining this type.
    ImportPath string `json:"importPath,required"`
    // Annotations defined on this type.
    //
    // Note that these are the Thrift annotations listed after the type
    // declaration in the Thrift file.
    //
    // Given,
    //
    //   struct User {
    //     1: required i32 id
    //     2: required string name
    //   } (key = "id", validate)
    //
    // The annotations will be,
    //
    //   {
    //     "key": "id",
    //     "validate": "",
    //   }
    Annotations map[string]string `json:"annotations,omitempty"`
}

TypeReference is a reference to a user-defined type.

func (*TypeReference) Equals Uses

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

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

This function performs a deep comparison.

func (*TypeReference) FromWire Uses

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

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

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

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

func (*TypeReference) GetAnnotations Uses

func (v *TypeReference) GetAnnotations() (o map[string]string)

GetAnnotations returns the value of Annotations if it is set or its zero value if it is unset.

func (*TypeReference) GetImportPath Uses

func (v *TypeReference) GetImportPath() (o string)

GetImportPath returns the value of ImportPath if it is set or its zero value if it is unset.

func (*TypeReference) GetName Uses

func (v *TypeReference) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*TypeReference) IsSetAnnotations Uses

func (v *TypeReference) IsSetAnnotations() bool

IsSetAnnotations returns true if Annotations is not nil.

func (*TypeReference) MarshalLogObject Uses

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

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

func (*TypeReference) String Uses

func (v *TypeReference) String() string

String returns a readable string representation of a TypeReference struct.

func (*TypeReference) ToWire Uses

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

ToWire translates a TypeReference 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 api imports 13 packages (graph) and is imported by 23 packages. Updated 2020-01-22. Refresh now. Tools for package owners.