client

package
v0.0.0-...-cdf2f2c Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2015 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(ctx context.Context, request Request, response interface{}) error

func CallRemote

func CallRemote(ctx context.Context, address string, request Request, response interface{}) error

Types

type Client

type Client interface {
	NewRequest(string, string, interface{}) Request
	NewProtoRequest(string, string, interface{}) Request
	NewJsonRequest(string, string, interface{}) Request
	Call(context.Context, Request, interface{}) error
	CallRemote(context.Context, string, Request, interface{}) error
	Stream(context.Context, Request, interface{}) (Streamer, error)
	StreamRemote(context.Context, string, Request, interface{}) (Streamer, error)
}
var (
	DefaultClient Client = newRpcClient()
)

func NewClient

func NewClient(opt ...Option) Client

type Option

type Option func(*options)

func Registry

func Registry(r registry.Registry) Option

func Transport

func Transport(t transport.Transport) Option

type Request

type Request interface {
	Service() string
	Method() string
	ContentType() string
	Request() interface{}
}

func NewJsonRequest

func NewJsonRequest(service, method string, request interface{}) Request

func NewProtoRequest

func NewProtoRequest(service, method string, request interface{}) Request

func NewRequest

func NewRequest(service, method string, request interface{}) Request

type Streamer

type Streamer interface {
	Request() Request
	Error() error
	Close() error
}

func Stream

func Stream(ctx context.Context, request Request, responseChan interface{}) (Streamer, error)

func StreamRemote

func StreamRemote(ctx context.Context, address string, request Request, responseChan interface{}) (Streamer, error)

Jump to

Keyboard shortcuts

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