plugin

package
v0.0.0-...-fa1d311 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncResult

func AsyncResult(in *proto.CommandReq) (res *proto.CommandRes, err error)

func GetStatus

func GetStatus() proto.Status

func GetStatusResponse

func GetStatusResponse() *proto.StatusRes

func NotFoundResult

func NotFoundResult(in *proto.CommandReq) (*proto.CommandRes, error)

func SendResult

func SendResult(uuid string, cmd string, result proto.Result, data any) (err error)

func SetError

func SetError(e error)

func SetReady

func SetReady() bool

func Shutdown

func Shutdown(delay *string) *proto.ShutdownRes

func Start

func Start(opts StartOptions)

func SuccessResult

func SuccessResult(in *proto.CommandReq, data any) (res *proto.CommandRes, err error)

func UnmarshalData

func UnmarshalData[T any](in *proto.CommandReq) (res T, err error)

Types

type Config

type Config struct {
	AppPort   string `env:"APP_PORT" validate:"required"`
	ID        string `env:"PLUGIN_ID" validate:"required"`
	Port      string `env:"PLUGIN_PORT" validate:"required"`
	ConnRetry int    `env:"CONN_RETRY" envDefault:"3" validate:"omitempty"`
	ConnDelay string `env:"CONN_DELAY" envDefault:"1s" validate:"omitempty"`
	Marshal   string `env:"MARSHAL" envDefault:"msgpack" validate:"required,oneof=json msgpack gob"`
}

type StartOptions

type StartOptions struct {
	Service  proto.PluginServiceServer
	Callback func() error
}

Jump to

Keyboard shortcuts

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