micro

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseMsg added in v1.1.7

func ParseMsg[T any](data []byte) (*T, error)

Types

type AnyMessage added in v1.1.4

type AnyMessage = Message[any]

func NewAnyMessage added in v1.1.4

func NewAnyMessage(data any, err error) *AnyMessage

type BaseController

type BaseController interface {
	MessageSender
	network.BaseController
}

func NewBaseController

func NewBaseController(basePath string, authProvider network.AuthenticationProvider, authorizeProvider network.AuthorizationProvider) BaseController

type Config

type Config struct {
	NatsUrl            string
	NatsServiceName    string
	NatsServiceVersion string
	Timeout            time.Duration
}

type Controller

type Controller interface {
	BaseController
	MountNats(group NatsGroup)
}

type Message

type Message[T any] struct {
	Data  T       `json:"data,omitempty"`
	Error *string `json:"error,omitempty"`
}

func NewMessage

func NewMessage[T any](data T, err error) *Message[T]

type MessageSender added in v1.1.4

type MessageSender interface {
	SendNats(req NatsRequest) SendMessage
}

func NewMessageSender added in v1.1.4

func NewMessageSender() MessageSender

type Module added in v1.1.2

type Module[T any] interface {
	network.BaseModule[T]
	Controllers() []Controller
}

type NatsClient

type NatsClient interface {
	GetInstance() *natsClient
	Disconnect()
}

func NewNatsClient

func NewNatsClient(config *Config) NatsClient

type NatsGroup

type NatsGroup = micro.Group

type NatsHandlerFunc

type NatsHandlerFunc = micro.HandlerFunc

type NatsRequest

type NatsRequest = micro.Request

type Request

type Request[T any] interface {
	Nats() (*T, error)
}

type RequestBuilder added in v1.1.4

type RequestBuilder[T any] interface {
	NatsClient() NatsClient
	Request(data any) Request[T]
}

func NewRequestBuilder added in v1.1.4

func NewRequestBuilder[T any](natsClient NatsClient, subject string) RequestBuilder[T]

type Router

type Router interface {
	network.BaseRouter
	NatsClient() NatsClient
	LoadControllers(controllers []Controller)
}

func NewRouter

func NewRouter(mode string, natsClient NatsClient) Router

type SendMessage added in v1.1.4

type SendMessage interface {
	Message(data any)
	Error(err error)
}

Jump to

Keyboard shortcuts

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