event

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Parsers  ParseEventsMap
	Commands CommandParseEventsMap
	PARSE    = "parse"
	COMMAND  = "command"
)

Functions

func Command

func Command(eventKey string, data string, client e.Client)

func DoWebhook

func DoWebhook(topic string, data map[string]any, identifier string, eventType string, clientId string, name string, description string)

func GetClientId

func GetClientId(identifier string) string

func GetResolverInfo

func GetResolverInfo(commandName string, sn string) config.ContextInfo

获取解析对象,优先从缓存取

func Parse

func Parse(eventKey string, data string, client e.Client) (bool, string, map[string]any, string)

func ParseHandle

func ParseHandle(data string, client e.Client, info config.ContextInfo) (map[string]any, *config.ParseHandleInfo, string)

func RegisterEvent

func RegisterEvent(topic string, event HandleEvent, eventType string)

func ResolveHandle

func ResolveHandle(data string, client e.Client, info config.ContextInfo) []model.CommandModel

func UpdateResolveInfoCacheValue

func UpdateResolveInfoCacheValue(commandName string, sn string, field string, value string, digit int)

更新解析指命的缓存值

Types

type CallbackHandler

type CallbackHandler func(client e.Client, sn string, data map[string]interface{})

type CommandEventHandleFun

type CommandEventHandleFun func(data string, client e.Client, info config.ContextInfo) (bool, error)

type CommandParseEventsMap

type CommandParseEventsMap map[string]CommandEventHandleFun

type Events

type Events struct {
	OnProcessMessage e.OnProcessMessage
	OnMessage        e.OnMessage
	OnError          e.OnError
	OnConnect        e.OnConnect
	OnDisconnect     e.OnDisconnect
	OnSubscribe      e.OnSubscribe
	OnUnsubscribe    e.OnUnsubscribe
	OnWsMessage      func(clientId string, res http.ResponseWriter, req *http.Request, data map[string]any) *map[string]any
}

func (Events) Default

func (evs Events) Default() *Events

type HandleEvent

type HandleEvent func(data model.DataModel, client e.Client) error

type ParseEventHandleFun

type ParseEventHandleFun func(data string, client e.Client, info config.ContextInfo) (bool, string, map[string]interface{}, string)

type ParseEventsMap

type ParseEventsMap map[string]ParseEventHandleFun

Jump to

Keyboard shortcuts

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