natsclient

package
v0.0.0-...-a5d5012 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithGuidOpt

func WithGuidOpt(guid int64) func(r *Request)

func WithIPOpt

func WithIPOpt(ip string) func(r *Request)

func WithTimeout

func WithTimeout(d time.Duration) func(r *Request)

Types

type MessageOpt

type MessageOpt func(r *Request)

type NATSClient

type NATSClient struct {
	*nats.Conn
	// contains filtered or unexported fields
}

func NewNATSClient

func NewNATSClient(log *logger.Logger, urls []string) (*NATSClient, error)

func (*NATSClient) NotifyProto

func (this_ *NATSClient) NotifyProto(reqs ...proto.Message)

func (*NATSClient) RequestProto

func (this_ *NATSClient) RequestProto(req proto.Message, out proto.Message, opts ...MessageOpt) error

type Request

type Request struct {
	Guid     int64           `json:"guid"`
	Path     string          `json:"path"`
	Body     json.RawMessage `json:"post_body,omitempty"`
	IP       string          `json:"ip"`
	UniqueID string          `json:"unique_id"`
	Timeout  time.Duration   `json:"-"`
}

type Response

type Response struct {
	Code    int64       `json:"code"`
	Message string      `json:"message"`
	Display string      `json:"display"`
	Fields  []string    `json:"fields"`
	Data    interface{} `json:"data"`
}

func (*Response) Error

func (this_ *Response) Error() string

Jump to

Keyboard shortcuts

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