script

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message added in v0.2.0

type Message struct {
	Subject string `json:"subject"`
	Payload []byte `json:"payload"`
	Method  string `json:"method"`
	URL     string `json:"url"`
}

type NoScriptFoundError added in v0.2.3

type NoScriptFoundError struct{}

func (*NoScriptFoundError) Error added in v0.2.3

func (e *NoScriptFoundError) Error() string

type Reply added in v0.2.1

type Reply struct {
	HTML       []byte `json:"html,omitempty"`
	Results    sync.Map
	Error      string            `json:"error,omitempty"`
	AllResults map[string]string `json:"results,omitempty"`
}

func NewErrReply added in v0.2.1

func NewErrReply(err error) *Reply

func NewReply added in v0.2.1

func NewReply() *Reply

func (*Reply) JSON added in v0.2.1

func (r *Reply) JSON() ([]byte, error)

type Script

type Script struct {
	Name    string
	Subject string
	Content []byte
	LibKeys []string
}

func (*Script) Read added in v0.2.3

func (s *Script) Read(f io.Reader) error

func (*Script) ReadFile added in v0.2.3

func (s *Script) ReadFile(filename string) error

func (*Script) ReadString added in v0.2.3

func (s *Script) ReadString(str string) error

type ScriptExecutor

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

ScriptExecutor defines the structure responsible for managing Lua script execution

func NewScriptExecutor

func NewScriptExecutor(store msgstore.ScriptStore, plugins []msgplugins.PreloadFunc, nc *nats.Conn) *ScriptExecutor

NewScriptExecutor creates a new ScriptExecutor using the provided ScriptStore

func (*ScriptExecutor) HandleMessage

func (se *ScriptExecutor) HandleMessage(ctx context.Context, msg *Message, replyFunc func(r *Reply))

HandleMessage receives a message, matches it to a Lua script, and executes the script in a new goroutine

func (*ScriptExecutor) Stop

func (se *ScriptExecutor) Stop()

Stop gracefully shuts down the ScriptExecutor and stops watching for messages

Jump to

Keyboard shortcuts

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