apiserver

package
v0.0.0-...-0143282 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiServer

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

func New

func New(listeners ...Listener) *ApiServer

New api server

func NewDefault

func NewDefault(callback Caller) *ApiServer

func (*ApiServer) Listen

func (as *ApiServer) Listen()

type Caller

type Caller interface {
	Call(string)
}

type HttpListener

type HttpListener struct {
	Addr     string
	Callback Caller
}

func NewDefaultHttpListener

func NewDefaultHttpListener(callback Caller) *HttpListener

func (*HttpListener) Listen

func (hl *HttpListener) Listen()

func (*HttpListener) OnMessage

func (hl *HttpListener) OnMessage(b []byte)

type Listener

type Listener interface {
	Listen()
	OnMessage([]byte)
}

type NatsListener

type NatsListener struct {
	Name     string
	Topic    string
	URL      string
	Token    string
	Callback Caller
}

func NewDefaultNatsListener

func NewDefaultNatsListener(callback Caller) *NatsListener

func (*NatsListener) Listen

func (nl *NatsListener) Listen()

func (*NatsListener) OnMessage

func (nl *NatsListener) OnMessage(b []byte)

type NatsMessage

type NatsMessage struct {
	Name string `json:"name"`
	// Data *json.RawMessage `json:"data"`
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

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