Documentation
¶
Overview ¶
Package event provides the event definition.
Index ¶
- Variables
- type Action
- type Event
- type Kind
- type Option
- func WithAction(value Action) Option
- func WithAttributes(value types.Map[string]) Option
- func WithData(value []byte) Option
- func WithFormUrlEncodedData(value url.Values) Option
- func WithHappen(value types.DateTime) Option
- func WithID(value string) Option
- func WithJsonData(value any) Option
- func WithKind(value Kind) Option
- func WithMsgPackData(value any) Option
- func WithSchema(value string) Option
- func WithSource(value string) Option
- func WithVersion(value string) Option
- func WithYamlData(value any) Option
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( ActionNames = map[Action]string{ ActionCreate: "Create", ActionRead: "Read", ActionUpdate: "Update", ActionDelete: "Delete", ActionError: "Error", } )
var ( KindNames = map[Kind]string{ KindApplicationTrace: "ApplicationTrace", KindApplicationLog: "ApplicationLog", KindApplicationMetric: "ApplicationMetric", KindKubernetesManifest: "KubernetesManifest", KindKubernetesLog: "KubernetesLog", KindKubernetesMetric: "KubernetesMetric", } )
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action uint8
Action represents the event action.
func (Action) MarshalJSON ¶
MarshalJSON outputs the Action as a json.
func (*Action) UnmarshalJSON ¶
UnmarshalJSON parses the Action from json.
type Kind ¶
type Kind uint16
Kind represents the event topic.
func (Kind) MarshalJSON ¶
MarshalJSON outputs the Kind as a json.
func (*Kind) UnmarshalJSON ¶
UnmarshalJSON parses Kind from json.
type Option ¶
type Option func(o *Options)
Option represents the event option.
func WithAttributes ¶
WithAttributes sets the attributes for the event.
func WithFormUrlEncodedData ¶
WithFormUrlEncodedData sets the form url encoded data for the event.
func WithHappen ¶
WithHappen sets the happen for the event.
func WithJsonData ¶
WithJsonData sets the json data for the event.
func WithMsgPackData ¶
WithMsgPackData sets the msgpack data for the event.
func WithVersion ¶
WithVersion sets the version for the event.
func WithYamlData ¶
WithYamlData sets the yaml data for the event.
type Options ¶
type Options struct {
ID string `json:"id"`
Version string `json:"version"`
Schema types.URI `json:"schema"`
Source types.URI `json:"source"`
Kind Kind `json:"kind"`
Action Action `json:"action"`
Attributes types.Map[string] `json:"attributes"`
Data []byte `json:"data"`
Happen types.DateTime `json:"happen"`
}
Options represents the event options.