hessian

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

README

gohessian

Build Status GoCover GoDoc


It's a golang hessian library used by Apache/dubbo-go.

Feature List

Basic Usage Examples

Encode To Bytes
type Circular struct {
	Num      int
	Previous *Circular
	Next     *Circular
}

func (Circular) JavaClassName() string {
	return "com.company.Circular"
}

c := &Circular{}
c.Num = 12345
c.Previous = c
c.Next = c

e := NewEncoder()
err := e.Encode(c)
if err != nil {
    panic(err)
}

bytes := e.Buffer()
Decode From Bytes
decodedObject, err := NewDecoder(bytes).Decode()
if err != nil {
    panic(err)
}
circular, ok := obj.(*Circular)
// ...

Customize Usage Examples

Encoding filed name

Hessian encoder default converts filed names of struct to lower camelcase, but you can customize it using hessian tag.

Example:

type MyUser struct {
	UserFullName      string   `hessian:"user_full_name"`
	FamilyPhoneNumber string   // default convert to => familyPhoneNumber
}

func (MyUser) JavaClassName() string {
	return "com.company.myuser"
}

user := &MyUser{
    UserFullName:      "username",
    FamilyPhoneNumber: "010-12345678",
}

e := hessian.NewEncoder()
err := e.Encode(user)
if err != nil {
    panic(err)
}

The encoded bytes of the struct MyUser is as following:

 00000000  43 12 63 6f 6d 2e 63 6f  6d 70 61 6e 79 2e 6d 79  |C.com.company.my|
 00000010  75 73 65 72 92 0e 75 73  65 72 5f 66 75 6c 6c 5f  |user..user_full_|
 00000020  6e 61 6d 65 11 66 61 6d  69 6c 79 50 68 6f 6e 65  |name.familyPhone|
 00000030  4e 75 6d 62 65 72 60 08  75 73 65 72 6e 61 6d 65  |Number`.username|
 00000040  0c 30 31 30 2d 31 32 33  34 35 36 37 38           |.010-12345678|
Decoding filed name

Hessian decoder finds the correct target field though comparing all filed names of struct one by one until matching.

The following example shows the order of the matching rules:

type MyUser struct {
	MobilePhone      string   `hessian:"mobile-phone"`
}

// You must define the tag of struct for lookup filed form encoded binary bytes, in this case:
// 00000000  43 12 63 6f 6d 2e 63 6f  6d 70 61 6e 79 2e 6d 79  |C.com.company.my|
// 00000010  75 73 65 72 91 0c 6d 6f  62 69 6c 65 2d 70 68 6f  |user..mobile-pho|
// 00000020  6e 65 60 0b 31 37 36 31  32 33 34 31 32 33 34     |ne`.17612341234|
//
// mobile-phone(tag lookup) => mobilePhone(lowerCameCase) => MobilePhone(SameCase) => mobilephone(lowercase)
// ^ will matched


type MyUser struct {
	MobilePhone      string
}

// The following encoded binary bytes will be hit automatically:
//
// 00000000  43 12 63 6f 6d 2e 63 6f  6d 70 61 6e 79 2e 6d 79  |C.com.company.my|
// 00000010  75 73 65 72 91 0b 6d 6f  62 69 6c 65 50 68 6f 6e  |user..mobilePhon|
// 00000020  65 60 0b 31 37 36 31 32  33 34 31 32 33 34        |e`.17612341234|
//
// mobile-phone(tag lookup) => mobilePhone(lowerCameCase) => MobilePhone(SameCase) => mobilephone(lowercase)
//                             ^ will matched
//
// 00000000  43 12 63 6f 6d 2e 63 6f  6d 70 61 6e 79 2e 6d 79  |C.com.company.my|
// 00000010  75 73 65 72 91 0b 4d 6f  62 69 6c 65 50 68 6f 6e  |user..MobilePhon|
// 00000020  65 60 0b 31 37 36 31 32  33 34 31 32 33 34        |e`.17612341234|
//
// mobile-phone(tag lookup) => mobilePhone(lowerCameCase) => MobilePhone(SameCase) => mobilephone(lowercase)
//                                                           ^ will matched
//
// 00000000  43 12 63 6f 6d 2e 63 6f  6d 70 61 6e 79 2e 6d 79  |C.com.company.my|
// 00000010  75 73 65 72 91 0b 6d 6f  62 69 6c 65 70 68 6f 6e  |user..mobilephon|
// 00000020  65 60 0b 31 37 36 31 32  33 34 31 32 33 34        |e`.17612341234|
//
// mobile-phone(tag lookup) => mobilePhone(lowerCameCase) => MobilePhone(SameCase) => mobilephone(lowercase)
//                                                                                    ^ will matched

hessian.SetTagIdentifier

You can use hessian.SetTagIdentifier to customize tag-identifier of hessian, which takes effect to both encoder and decoder.

Example:

hessian.SetTagIdentifier("json")

type MyUser struct {
	UserFullName      string   `json:"user_full_name"`
	FamilyPhoneNumber string   // default convert to => familyPhoneNumber
}

func (MyUser) JavaClassName() string {
	return "com.company.myuser"
}

user := &MyUser{
    UserFullName:      "username",
    FamilyPhoneNumber: "010-12345678",
}

e := hessian.NewEncoder()
err := e.Encode(user)
if err != nil {
    panic(err)
}

The encoded bytes of the struct MyUser is as following:

 00000000  43 12 63 6f 6d 2e 63 6f  6d 70 61 6e 79 2e 6d 79  |C.com.company.my|
 00000010  75 73 65 72 92 0e 75 73  65 72 5f 66 75 6c 6c 5f  |user..user_full_|
 00000020  6e 61 6d 65 11 66 61 6d  69 6c 79 50 68 6f 6e 65  |name.familyPhone|
 00000030  4e 75 6d 62 65 72 60 08  75 73 65 72 6e 61 6d 65  |Number`.username|
 00000040  0c 30 31 30 2d 31 32 33  34 35 36 37 38           |.010-12345678|

Documentation

Overview

pack/unpack fixed length variable

Index

Constants

View Source
const (
	TAG_READ        = int32(-1)
	ASCII_GAP       = 32
	CHUNK_SIZE      = 4096
	BC_BINARY       = byte('B') // final chunk
	BC_BINARY_CHUNK = byte('A') // non-final chunk

	BC_BINARY_DIRECT  = byte(0x20) // 1-byte length binary
	BINARY_DIRECT_MAX = byte(0x0f)
	BC_BINARY_SHORT   = byte(0x34) // 2-byte length binary
	BINARY_SHORT_MAX  = 0x3ff      // 0-1023 binary

	BC_DATE        = byte(0x4a) // 64-bit millisecond UTC date
	BC_DATE_MINUTE = byte(0x4b) // 32-bit minute UTC date

	BC_DOUBLE = byte('D') // IEEE 64-bit double

	BC_DOUBLE_ZERO  = byte(0x5b)
	BC_DOUBLE_ONE   = byte(0x5c)
	BC_DOUBLE_BYTE  = byte(0x5d)
	BC_DOUBLE_SHORT = byte(0x5e)
	BC_DOUBLE_MILL  = byte(0x5f)

	BC_FALSE = byte('F') // boolean false

	BC_INT = byte('I') // 32-bit int

	INT_DIRECT_MIN = -0x10
	INT_DIRECT_MAX = byte(0x2f)
	BC_INT_ZERO    = byte(0x90)

	INT_BYTE_MIN     = -0x800
	INT_BYTE_MAX     = 0x7ff
	BC_INT_BYTE_ZERO = byte(0xc8)

	BC_END = byte('Z')

	INT_SHORT_MIN     = -0x40000
	INT_SHORT_MAX     = 0x3ffff
	BC_INT_SHORT_ZERO = byte(0xd4)

	BC_LIST_VARIABLE         = byte(0x55)
	BC_LIST_FIXED            = byte('V')
	BC_LIST_VARIABLE_UNTYPED = byte(0x57)
	BC_LIST_FIXED_UNTYPED    = byte(0x58)

	BC_LIST_DIRECT         = byte(0x70)
	BC_LIST_DIRECT_UNTYPED = byte(0x78)
	LIST_DIRECT_MAX        = byte(0x7)

	BC_LONG         = byte('L') // 64-bit signed integer
	LONG_DIRECT_MIN = -0x08
	LONG_DIRECT_MAX = byte(0x0f)
	BC_LONG_ZERO    = byte(0xe0)

	LONG_BYTE_MIN     = -0x800
	LONG_BYTE_MAX     = 0x7ff
	BC_LONG_BYTE_ZERO = byte(0xf8)

	LONG_SHORT_MIN     = -0x40000
	LONG_SHORT_MAX     = 0x3ffff
	BC_LONG_SHORT_ZERO = byte(0x3c)

	BC_LONG_INT = byte(0x59)

	BC_MAP         = byte('M')
	BC_MAP_UNTYPED = byte('H')

	BC_NULL = byte('N') // x4e

	BC_OBJECT     = byte('O')
	BC_OBJECT_DEF = byte('C')

	BC_OBJECT_DIRECT  = byte(0x60)
	OBJECT_DIRECT_MAX = byte(0x0f)

	BC_REF = byte(0x51)

	BC_STRING       = byte('S') // final string
	BC_STRING_CHUNK = byte('R') // non-final string

	BC_STRING_DIRECT  = byte(0x00)
	STRING_DIRECT_MAX = byte(0x1f)
	BC_STRING_SHORT   = byte(0x30)
	STRING_SHORT_MAX  = 0x3ff

	BC_TRUE = byte('T')

	P_PACKET_CHUNK = byte(0x4f)
	P_PACKET       = byte('P')

	P_PACKET_DIRECT   = byte(0x80)
	PACKET_DIRECT_MAX = byte(0x7f)

	P_PACKET_SHORT   = byte(0x70)
	PACKET_SHORT_MAX = 0xfff
	ARRAY_STRING     = "[string"
	ARRAY_INT        = "[int"
	ARRAY_DOUBLE     = "[double"
	ARRAY_FLOAT      = "[float"
	ARRAY_BOOL       = "[boolean"
	ARRAY_LONG       = "[long"

	PATH_KEY      = "path"
	GROUP_KEY     = "group"
	INTERFACE_KEY = "interface"
	VERSION_KEY   = "version"
	TIMEOUT_KEY   = "timeout"

	STRING_NIL   = ""
	STRING_TRUE  = "true"
	STRING_FALSE = "false"
	STRING_ZERO  = "0.0"
	STRING_ONE   = "1.0"
)

constansts

View Source
const (
	Response_OK                byte = 20
	Response_CLIENT_TIMEOUT    byte = 30
	Response_SERVER_TIMEOUT    byte = 31
	Response_BAD_REQUEST       byte = 40
	Response_BAD_RESPONSE      byte = 50
	Response_SERVICE_NOT_FOUND byte = 60
	Response_SERVICE_ERROR     byte = 70
	Response_SERVER_ERROR      byte = 80
	Response_CLIENT_ERROR      byte = 90

	// According to "java dubbo" There are two cases of response:
	// 		1. with attachments
	// 		2. no attachments
	RESPONSE_WITH_EXCEPTION                  int32 = 0
	RESPONSE_VALUE                           int32 = 1
	RESPONSE_NULL_VALUE                      int32 = 2
	RESPONSE_WITH_EXCEPTION_WITH_ATTACHMENTS int32 = 3
	RESPONSE_VALUE_WITH_ATTACHMENTS          int32 = 4
	RESPONSE_NULL_VALUE_WITH_ATTACHMENTS     int32 = 5
)

Response related consts

View Source
const (
	// header length.
	HEADER_LENGTH = 16

	// magic header
	MAGIC      = uint16(0xdabb)
	MAGIC_HIGH = byte(0xda)
	MAGIC_LOW  = byte(0xbb)

	// message flag.
	FLAG_REQUEST = byte(0x80)
	FLAG_TWOWAY  = byte(0x40)
	FLAG_EVENT   = byte(0x20) // for heartbeat
	SERIAL_MASK  = 0x1f

	DUBBO_VERSION                          = "2.5.4"
	DUBBO_VERSION_KEY                      = "dubbo"
	DEFAULT_DUBBO_PROTOCOL_VERSION         = "2.0.2" // Dubbo RPC protocol version, for compatibility, it must not be between 2.0.10 ~ 2.6.2
	LOWEST_VERSION_FOR_RESPONSE_ATTACHMENT = 2000200
	DEFAULT_LEN                            = 8388608 // 8 * 1024 * 1024 default body max length
)

*

  • the dubbo protocol header length is 16 Bytes.
  • the first 2 Bytes is magic code '0xdabb'
  • the next 1 Byte is message flags, in which its 16-20 bit is serial id, 21 for event, 22 for two way, 23 for request/response flag
  • the next 1 Bytes is response state.
  • the next 8 Bytes is package DI.
  • the next 4 Bytes is package length. *
View Source
const (
	JAVA_IDENT_REGEX = "(?:[_$a-zA-Z][_$a-zA-Z0-9]*)"
	CLASS_DESC       = "(?:L" + JAVA_IDENT_REGEX + "(?:\\/" + JAVA_IDENT_REGEX + ")*;)"
	ARRAY_DESC       = "(?:\\[+(?:(?:[VZBCDFIJS])|" + CLASS_DESC + "))"
	DESC_REGEX       = "(?:(?:[VZBCDFIJS])|" + CLASS_DESC + "|" + ARRAY_DESC + ")"
)

regular

View Source
const (
	PackageError              = PackageType(0x01)
	PackageRequest            = PackageType(0x02)
	PackageResponse           = PackageType(0x04)
	PackageHeartbeat          = PackageType(0x08)
	PackageRequest_TwoWay     = PackageType(0x10)
	PackageResponse_Exception = PackageType(0x20)
	PackageType_BitSize       = 0x2f
)

enum part

View Source
const (
	// Zero : byte zero
	Zero = byte(0x00)
)

Variables

View Source
var (
	DubboRequestHeaderBytesTwoWay = [HEADER_LENGTH]byte{MAGIC_HIGH, MAGIC_LOW, FLAG_REQUEST | FLAG_TWOWAY}
	DubboRequestHeaderBytes       = [HEADER_LENGTH]byte{MAGIC_HIGH, MAGIC_LOW, FLAG_REQUEST}
	DubboResponseHeaderBytes      = [HEADER_LENGTH]byte{MAGIC_HIGH, MAGIC_LOW, Zero, Response_OK}
	DubboRequestHeartbeatHeader   = [HEADER_LENGTH]byte{MAGIC_HIGH, MAGIC_LOW, FLAG_REQUEST | FLAG_TWOWAY | FLAG_EVENT}
	DubboResponseHeartbeatHeader  = [HEADER_LENGTH]byte{MAGIC_HIGH, MAGIC_LOW, FLAG_EVENT}
)

Dubbo request response related consts

View Source
var (
	ErrHeaderNotEnough = perrors.New("header buffer too short")
	ErrBodyNotEnough   = perrors.New("body buffer too short")
	ErrJavaException   = perrors.New("got java exception")
	ErrIllegalPackage  = perrors.New("illegal package!")
)

Error part

View Source
var (
	ErrNotEnoughBuf    = perrors.Errorf("not enough buf")
	ErrIllegalRefIndex = perrors.Errorf("illegal ref index")
)

Error part

View Source
var DescRegex, _ = regexp.Compile(DESC_REGEX)

DescRegex ...

View Source
var NilValue = reflect.Zero(reflect.TypeOf((*interface{})(nil)).Elem())
View Source
var ZeroDate = time.Time{}

Functions

func AddrEqual

func AddrEqual(x, y interface{}) bool

AddrEqual compares addrs

func ConvertSliceValueType

func ConvertSliceValueType(destTyp reflect.Type, v reflect.Value) (reflect.Value, error)

ConvertSliceValueType convert to slice of destination type

func CopyMap

func CopyMap(inMapValue, outMapValue reflect.Value) error

CopyMap copy from in map to out map

func CopySlice

func CopySlice(inSlice, outSlice reflect.Value) error

CopySlice copy from inSlice to outSlice

func EnsureFloat64

func EnsureFloat64(i interface{}) float64

EnsureFloat64 convert i to float64

func EnsureInt64

func EnsureInt64(i interface{}) int64

EnsureInt64 convert i to int64

func EnsureInterface

func EnsureInterface(in interface{}, err error) (interface{}, error)

EnsureInterface get value of reflect.Value return original value if not reflect.Value

func EnsurePackValue

func EnsurePackValue(in interface{}) reflect.Value

EnsurePackValue pack the interface with value

func EnsureRawValue

func EnsureRawValue(in interface{}) reflect.Value

EnsureRawValue pack the interface with value, and make sure it's not a ref holder

func EnsureUint64

func EnsureUint64(i interface{}) uint64

EnsureUint64 convert i to uint64

func PackFloat64

func PackFloat64(v float64) []byte

PackFloat64 packs float64 to byte array [10].pack('G').bytes => [64, 36, 0, 0, 0, 0, 0, 0] PackFloat64 invokes go's official math library function Float64bits.

func PackInt16

func PackInt16(v int16) []byte

PackInt16 packs int16 to byte array [10].pack('N').bytes => [0, 0, 0, 10]

func PackInt32

func PackInt32(v int32) []byte

PackInt32 packs int32 to byte array [10].pack('N').bytes => [0, 0, 0, 10]

func PackInt64

func PackInt64(v int64) []byte

PackInt64 packs int64 to byte array [10].pack('q>').bytes => [0, 0, 0, 0, 0, 0, 0, 10]

func PackInt8

func PackInt8(v int8, b []byte) []byte

PackInt8 packs int to byte array

func PackPtr

func PackPtr(v reflect.Value) reflect.Value

PackPtr pack a Ptr value

func PackUint16

func PackUint16(v uint16) []byte

PackUint16 packs uint16 to byte array [10].pack('N').bytes => [0, 0, 0, 10]

func ReflectResponse

func ReflectResponse(in interface{}, out interface{}) error

ReflectResponse reflect return value TODO response object should not be copied again to another object, it should be the exact type of the object

func RegisterJavaEnum

func RegisterJavaEnum(o POJOEnum) int

RegisterJavaEnum Register a value type JavaEnum variable.

func RegisterPOJO

func RegisterPOJO(o POJO) int

RegisterPOJO Register a POJO instance. The return value is -1 if @o has been registered.

func RegisterPOJOs

func RegisterPOJOs(os ...POJO) []int

RegisterPOJOs register a POJO instance arr @os. The return value is @os's mathching index array, in which "-1" means its matching POJO has been registered.

func SetSerializer

func SetSerializer(key string, codec Serializer)

func SetSlice

func SetSlice(dest reflect.Value, objects interface{}) error

SetSlice set value into slice object

func SetTagIdentifier

func SetTagIdentifier(s string)

SetTagIdentifier for customize struct filed tag of hessian, your can use it like:

hessian.SetTagIdentifier("json")

type MyUser struct {
	UserFullName      string   `json:"user_full_name"`
	FamilyPhoneNumber string   // default convert to => familyPhoneNumber
}

var user MyUser hessian.NewEncoder().Encode(user)

func SetValue

func SetValue(dest, v reflect.Value)

SetValue set the value to dest. It will auto check the Ptr pack level and unpack/pack to the right level. It make sure success to set value

func Slice

func Slice(s string) (b []byte)

Slice convert string to byte slice

func SprintHex

func SprintHex(b []byte) (rs string)

SprintHex converts the []byte to a Hex string.

func ToMapStringString

func ToMapStringString(origin map[interface{}]interface{}) map[string]string

func UnpackFloat64

func UnpackFloat64(b []byte) float64

UnpackFloat64 unpacks float64 from byte array Double (0,8).unpack('G)

func UnpackInt16

func UnpackInt16(b []byte) int16

UnpackInt16 unpacks int16 from byte array (0,2).unpack('n')

func UnpackInt32

func UnpackInt32(b []byte) int32

UnpackInt32 unpacks int32 from byte array (0,4).unpack('N')

func UnpackInt64

func UnpackInt64(b []byte) int64

UnpackInt64 unpacks int64 from byte array long (0,8).unpack('q>')

func UnpackPtr

func UnpackPtr(v reflect.Value) reflect.Value

UnpackPtr unpack pointer value to original value

func UnpackPtrType

func UnpackPtrType(typ reflect.Type) reflect.Type

UnpackPtrType unpack pointer type to original type

func UnpackPtrValue

func UnpackPtrValue(v reflect.Value) reflect.Value

UnpackPtrValue unpack pointer value to original value return the pointer if its elem is zero value, because lots of operations on zero value is invalid

func UnpackUint16

func UnpackUint16(b []byte) uint16

UnpackUint16 unpacks int16 from byte array (0,2).unpack('n')

Types

type DecimalSerializer

type DecimalSerializer struct{}

func (DecimalSerializer) DecObject

func (DecimalSerializer) DecObject(d *Decoder) (interface{}, error)

func (DecimalSerializer) EncObject

func (DecimalSerializer) EncObject(e *Encoder, v POJO) error

type Decoder

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

Decoder struct

func NewDecoder

func NewDecoder(b []byte) *Decoder

NewDecoder generate a decoder instance

func NewDecoderWithSkip

func NewDecoderWithSkip(b []byte) *Decoder

NewDecoder generate a decoder instance with skip

func (*Decoder) Decode

func (d *Decoder) Decode() (interface{}, error)

Decode parse hessian data, and ensure the reflection value unpacked

func (*Decoder) DecodeValue

func (d *Decoder) DecodeValue() (interface{}, error)

DecodeValue parse hessian data, the return value maybe a reflection value when it's a map, list, object, or ref.

type DubboHeader

type DubboHeader struct {
	SerialID       byte
	Type           PackageType
	ID             int64
	BodyLen        int
	ResponseStatus byte
}

DubboHeader dubbo header

type Encoder

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

Encoder struct

func NewEncoder

func NewEncoder() *Encoder

NewEncoder generate an encoder instance

func (*Encoder) Append

func (e *Encoder) Append(buf []byte)

Append byte arr to encoder buffer

func (*Encoder) Buffer

func (e *Encoder) Buffer() []byte

Buffer returns byte buffer

func (*Encoder) Encode

func (e *Encoder) Encode(v interface{}) error

Encode If @v can not be encoded, the return value is nil. At present only struct may can not be encoded.

type HessianCodec

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

HessianCodec defines hessian codec

func NewHessianCodec

func NewHessianCodec(reader *bufio.Reader) *HessianCodec

NewHessianCodec generate a new hessian codec instance

func NewHessianCodecCustom

func NewHessianCodecCustom(pkgType PackageType, reader *bufio.Reader, bodyLen int) *HessianCodec

NewHessianCodec generate a new hessian codec instance

func (*HessianCodec) ReadAttachments

func (h *HessianCodec) ReadAttachments() (map[string]string, error)

ignore body, but only read attachments

func (*HessianCodec) ReadBody

func (h *HessianCodec) ReadBody(rspObj interface{}) error

ReadBody uses hessian codec to read response body

func (*HessianCodec) ReadHeader

func (h *HessianCodec) ReadHeader(header *DubboHeader) error

ReadHeader uses hessian codec to read dubbo header

func (*HessianCodec) Write

func (h *HessianCodec) Write(service Service, header DubboHeader, body interface{}) ([]byte, error)

type JavaEnum

type JavaEnum int32

JavaEnum type

const (
	InvalidJavaEnum JavaEnum = -1
)

invalid consts

type JavaEnumClass

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

JavaEnumClass struct

type Object

type Object interface{}

Object is equal to Object of java When encoding

type POJO

type POJO interface {
	JavaClassName() string // got a go struct's Java Class package name which should be a POJO class.
}

POJO interface !!! Pls attention that Every field name should be upper case. Otherwise the app may panic.

type POJOEnum

type POJOEnum interface {
	POJO
	String() string
	EnumValue(string) JavaEnum
}

POJOEnum enum for POJO

type POJORegistry

type POJORegistry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

POJORegistry pojo registry struct

type PackageType

type PackageType int

PackageType ...

type Request

type Request struct {
	Params      interface{}
	Attachments map[string]string
}

func EnsureRequest

func EnsureRequest(body interface{}) *Request

func NewRequest

func NewRequest(params interface{}, atta map[string]string) *Request

NewRequest create a new Request

type Response

type Response struct {
	RspObj      interface{}
	Exception   error
	Attachments map[string]string
}

func EnsureResponse

func EnsureResponse(body interface{}) *Response

func NewResponse

func NewResponse(rspObj interface{}, exception error, attachments map[string]string) *Response

NewResponse create a new Response

type Serializer

type Serializer interface {
	EncObject(*Encoder, POJO) error
	DecObject(*Decoder) (interface{}, error)
}

func GetSerializer

func GetSerializer(key string) (Serializer, bool)

type Service

type Service struct {
	Path      string
	Interface string
	Group     string
	Version   string
	Method    string
	Timeout   time.Duration // request timeout
}

Service defines service instance

type TypeRefs

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

/////////////////////////////////////// typeRefs ///////////////////////////////////////

func (*TypeRefs) Get

func (t *TypeRefs) Get(index int) reflect.Type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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