nats

package
v0.0.0-...-b513cba Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAppJwt

func CreateAppJwt(seed string) (string, error)

Types

type Config

type Config struct {
	URI  string
	Opts []nats.Option
}

type Handler

type Handler func([]byte) error

type MultiError

type MultiError []error

func (MultiError) Error

func (me MultiError) Error() string

type NatsService

type NatsService struct {
	// contains filtered or unexported fields
}

func Connect

func Connect(cfg Config) (*NatsService, error)

func MustConnect

func MustConnect(cfg Config) *NatsService

func (*NatsService) AddHandler

func (sn *NatsService) AddHandler(subject string, handlerFn Handler)

func (*NatsService) CloseConnection

func (sn *NatsService) CloseConnection()

func (*NatsService) Serve

func (sn *NatsService) Serve(ctx context.Context) (err error)

type Payload

type Payload struct {
	Jti  string                 `json:"jti"`
	Iat  int64                  `json:"iat"`
	Iss  string                 `json:"iss"`
	Name string                 `json:"name"`
	Sub  string                 `json:"sub"`
	Nats map[string]interface{} `json:"nats"`
}

Jump to

Keyboard shortcuts

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