event

package
v0.0.0-...-5c7ffcf Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Title    string                 `json:"title,omitempty"`
	Params   map[string]interface{} `json:"params,omitempty"`
	Messages []*Message             `json:"messages,omitempty"`
	Children []*Event               `json:"children,omitempty"`
}

Event is used to records structured events

func (*Event) AddChild

func (e *Event) AddChild(format string, args ...interface{}) *Event

AddChild adds a child to current event and returns new child

func (*Event) Error

func (e *Event) Error(format string, args ...interface{}) *Event

Error logs with Error level

func (*Event) Info

func (e *Event) Info(format string, args ...interface{}) *Event

Info logs with Info level

func (*Event) Log

func (e *Event) Log(level string, format string, args ...interface{}) *Event

Log message

func (*Event) Set

func (e *Event) Set(key string, value interface{}) *Event

Set sets a property to current event

type Message

type Message struct {
	Level   string `json:"level,omitempty"`
	Content string `json:"content,omitempty"`
}

Message contains level and content

type WhereEvent

type WhereEvent struct {
	// Name is the name of where op, such as 'and', 'contains'.
	Name string `json:"name,omitempty"`
	// Result is the bool result of where op
	Result bool `json:"result"`
	// Children contains sub where op events. For example, 'and' may contain 2 children WhereEvent.
	Children []*WhereEvent `json:"children,omitempty"`
}

WhereEvent is the event for 'where' execution.

func (*WhereEvent) AddChild

func (e *WhereEvent) AddChild() *WhereEvent

AddChild adds a where child event and returns child

Jump to

Keyboard shortcuts

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