service

package
v0.0.0-...-6b27e27 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

README

defines SPI for RPC frameworks

func(ctx *countlog.Context, req unsafe.Pointer) (resp unsafe.Pointer, err error)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHandler

func ConvertHandler(handlerObj interface{}) (Handler, *HandlerTypeInfo)

func ConvertPtrHandler

func ConvertPtrHandler(ptrHandlerObj interface{}) (*Handler, *HandlerTypeInfo)

Types

type Boxer

type Boxer func(ptr unsafe.Pointer) interface{}

type ErrorNumber

type ErrorNumber interface {
	ErrorNumber() int
}

type Handler

type Handler func(ctx *countlog.Context, request unsafe.Pointer) (response unsafe.Pointer, err error)

Handler is the function prototype for both client and server. User should substitute request and response with their own concrete types. For example func(ctx *countlog.Context, request NewOrderRequest) (NewOrderResponse, error)

type HandlerTypeInfo

type HandlerTypeInfo struct {
	RequestType   reflect.Type
	RequestBoxer  Boxer
	ResponseType  reflect.Type
	ResponseBoxer Boxer
}

type Marshaller

type Marshaller interface {
	Marshal(ctx *countlog.Context, output interface{}, obj interface{}) error
}

type Response

type Response struct {
	Object interface{}
	Error  error
}

type Unmarshaller

type Unmarshaller interface {
	Unmarshal(ctx *countlog.Context, obj interface{}, input interface{}) error
}

type WithNumberError

type WithNumberError struct {
	Number  int
	Message string
}

func (*WithNumberError) Error

func (err *WithNumberError) Error() string

func (*WithNumberError) ErrorNumber

func (err *WithNumberError) ErrorNumber() int

Jump to

Keyboard shortcuts

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