generalizer

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_example_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Generalizer

type Generalizer interface {

	// Generalize generalizes the object to a general struct.
	// For example:
	// map, the type of the `obj` allows a basic type, e.g. string, and a complicated type which is a POJO, see also
	// `hessian.POJO` at [apache/dubbo-go-hessian2](github.com/apache/dubbo-go-hessian2).
	Generalize(obj interface{}) (interface{}, error)

	// Realize realizes a general struct, described in `obj`, to an object for Golang.
	Realize(obj interface{}, typ reflect.Type) (interface{}, error)

	// GetType returns the type of the `obj`
	GetType(obj interface{}) (string, error)
}

func GetGsonGeneralizer

func GetGsonGeneralizer() Generalizer

func GetMapGeneralizer

func GetMapGeneralizer() Generalizer

func GetProtobufJsonGeneralizer

func GetProtobufJsonGeneralizer() Generalizer

type GsonGeneralizer

type GsonGeneralizer struct{}

func (GsonGeneralizer) Generalize

func (GsonGeneralizer) Generalize(obj interface{}) (interface{}, error)

func (GsonGeneralizer) GetType

func (GsonGeneralizer) GetType(obj interface{}) (typ string, err error)

func (GsonGeneralizer) Realize

func (GsonGeneralizer) Realize(obj interface{}, typ reflect.Type) (interface{}, error)

type MapGeneralizer

type MapGeneralizer struct{}

func (*MapGeneralizer) Generalize

func (g *MapGeneralizer) Generalize(obj interface{}) (gobj interface{}, err error)

func (*MapGeneralizer) GetType

func (g *MapGeneralizer) GetType(obj interface{}) (typ string, err error)

func (*MapGeneralizer) Realize

func (g *MapGeneralizer) Realize(obj interface{}, typ reflect.Type) (interface{}, error)

type ProtobufJsonGeneralizer

type ProtobufJsonGeneralizer struct{}

ProtobufJsonGeneralizer generalizes an object to json and realizes an object from json using protobuf. Currently, ProtobufJsonGeneralizer is disabled temporarily until the triple protocol is ready.

func (*ProtobufJsonGeneralizer) Generalize

func (g *ProtobufJsonGeneralizer) Generalize(obj interface{}) (interface{}, error)

func (*ProtobufJsonGeneralizer) GetType

func (g *ProtobufJsonGeneralizer) GetType(_ interface{}) (string, error)

GetType returns empty string for "protobuf-json"

func (*ProtobufJsonGeneralizer) Realize

func (g *ProtobufJsonGeneralizer) Realize(obj interface{}, typ reflect.Type) (interface{}, error)

type RequestType

type RequestType struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestType) Descriptor deprecated

func (*RequestType) Descriptor() ([]byte, []int)

Deprecated: Use RequestType.ProtoReflect.Descriptor instead.

func (*RequestType) GetId

func (x *RequestType) GetId() int64

func (*RequestType) ProtoMessage

func (*RequestType) ProtoMessage()

func (*RequestType) ProtoReflect

func (x *RequestType) ProtoReflect() protoreflect.Message

func (*RequestType) Reset

func (x *RequestType) Reset()

func (*RequestType) String

func (x *RequestType) String() string

type ResponseType

type ResponseType struct {
	Code    int64  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Id      int64  `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	Name    string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*ResponseType) Descriptor deprecated

func (*ResponseType) Descriptor() ([]byte, []int)

Deprecated: Use ResponseType.ProtoReflect.Descriptor instead.

func (*ResponseType) GetCode

func (x *ResponseType) GetCode() int64

func (*ResponseType) GetId

func (x *ResponseType) GetId() int64

func (*ResponseType) GetMessage

func (x *ResponseType) GetMessage() string

func (*ResponseType) GetName

func (x *ResponseType) GetName() string

func (*ResponseType) ProtoMessage

func (*ResponseType) ProtoMessage()

func (*ResponseType) ProtoReflect

func (x *ResponseType) ProtoReflect() protoreflect.Message

func (*ResponseType) Reset

func (x *ResponseType) Reset()

func (*ResponseType) String

func (x *ResponseType) String() string

Jump to

Keyboard shortcuts

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