giraffe

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: GPL-3.0 Imports: 3 Imported by: 208

README

giraffe-micro

Giraffe 微服务框架

GoDoc Go Report Card LICENSE

Documentation

Index

Constants

View Source
const (
	//SupportPackageIsVersion1 = true 不兼容
	//SupportPackageIsVersion2 = true 不兼容
	SupportPackageIsVersion3 = true
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Host string
	Port int
	Name string
}

func (*Address) String

func (a *Address) String() string

type Client

type Client interface {
	Invoke(ctx context.Context, method Method, in interface{}, out interface{}) error
	NewStream(ctx context.Context, method StreamMethod) (ClientStream, error)
}

type ClientStream

type ClientStream interface {
	SendMsg(m interface{}) error
	RecvMsg(m interface{}) error
	CloseSend() error
}

type Contract

type Contract interface {
	ContractName() string
	ContractVersion() string
}

type Error

type Error interface {
	Code() status.Code
	Error() string
	Message() string
	WithMessage(message string) Error
	Proto() *status.Status
}

type HttpRule

type HttpRule interface {
	Pattern() (string, string)
	Body() string
}

type Method

type Method interface {
	ServiceName() string
	MethodName() string
	RequestMessage() interface{}  // for gRPC handler transform
	ResponseMessage() interface{} // for gRPC handler transform
}

type NameService

type NameService interface {
	GetAddress(method Method) (*Address, error)
	GetAllAddresses(method Method) ([]Address, error)
}

type Server

type Server interface {
	RegisterUnaryEndpoint(method Method, handle UnaryEndpoint)
	RegisterStreamEndpoint(method StreamMethod, handle StreamEndpoint)
}

type ServiceStream

type ServiceStream interface {
	// TODO add support SetHeader() SendHeader() SetTrailer()
	SendMsg(m interface{}) error
	RecvMsg(m interface{}) error
}

type StreamEndpoint

type StreamEndpoint func(ctx context.Context, stream ServiceStream) error

type StreamMethod

type StreamMethod interface {
	Method
	ClientStreams() bool
	ServerStreams() bool
}

type UnaryEndpoint

type UnaryEndpoint func(ctx context.Context, req interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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