Documentation ¶
Index ¶
- func RegisterContext(typ ContextType, ctor ContextContructor)
- func RegisterType(typ Type)
- type Context
- type ContextContructor
- type ContextIterator
- type ContextRegistry
- type ContextType
- type Contexts
- func (c Contexts) Bind(v interface{})
- func (c Contexts) Get(ct ContextType) (Context, bool)
- func (c Contexts) Iter() ContextIterator
- func (c Contexts) List() []string
- func (c Contexts) Map() map[string]interface{}
- func (c Contexts) MarshalJSON() ([]byte, error)
- func (c *Contexts) UnmarshalJSON(b []byte) error
- func (c Contexts) Visit(fn func(ctx Context))
- type Event
- type EventConstructor
- type EventRegistry
- type Option
- func Anonymous(b bool) Option
- func Channel(c string) Option
- func DeviceID(id string) Option
- func GroupID(id string) Option
- func Interactive() Option
- func NonInteractive() Option
- func Platform(p string) Option
- func SessionID(id string) Option
- func TrackingID(id string) Option
- func UserID(id string) Option
- func WithContext(ctx Context) Option
- func WithContexts(ctx ...Context) Option
- func WithValidator(v Validator) Option
- type Rule
- type Type
- type Validator
- type ValidatorOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterContext ¶
func RegisterContext(typ ContextType, ctor ContextContructor)
func RegisterType ¶
func RegisterType(typ Type)
Types ¶
type Context ¶
type Context interface { Type() ContextType Values() map[string]interface{} Interface() interface{} Validate() bool }
type ContextContructor ¶
type ContextContructor func() Context
type ContextIterator ¶
type ContextRegistry ¶
type ContextRegistry map[ContextType]ContextContructor
type ContextType ¶
type ContextType string
const (
ContextInvalid ContextType = "invalid"
)
func GetContextType ¶
func GetContextType(typ string) ContextType
type Contexts ¶
func (Contexts) Iter ¶
func (c Contexts) Iter() ContextIterator
func (Contexts) MarshalJSON ¶
func (*Contexts) UnmarshalJSON ¶
type Event ¶
type Event struct { ID string `json:"id" structs:"id" mapstructure:"id"` TrackingID string `json:"trackingId" structs:"trackingID" mapstructure:"trackingID"` UserID string `json:"userId,omitempty" structs:"userID,omitempty" mapstructure:"userID,omitempty"` Anonymous bool `json:"anonymous" structs:"anonymous" mapstructure:"anonymous"` GroupID string `json:"groupId,omitempty" structs:"groupID,omitempty" mapstructure:"groupID,omitempty"` SessionID string `json:"sessionId,omitempty" structs:"sessionID,omitempty" mapstructure:"sessionID,omitempty"` DeviceID string `json:"deviceId,omitempty" structs:"deviceID,omitempty" mapstructure:"deviceID,omitempty"` Event Type `json:"event" structs:"event" mapstructure:"event"` NonInteractive bool `json:"nonInteractive,omitempty" structs:"nonInteractive,omitempty" mapstructure:"nonInteractive,omitempty"` Channel string `json:"channel,omitempty" structs:"channel,omitempty" mapstructure:"channel,omitempty"` Platform string `json:"platform,omitempty" structs:"platform,omitempty" mapstructure:"platform,omitempty"` Timestamp time.Time `json:"timestamp" structs:"timestamp" mapstructure:"timestamp"` Context Contexts `json:"context,omitempty" structs:"context,omitempty" mapstructure:"context,omitempty"` // contains filtered or unexported fields }
func (*Event) SetContext ¶
func (*Event) SetContexts ¶
type EventConstructor ¶
type EventRegistry ¶
type Option ¶
type Option func(*Event)
func Interactive ¶
func Interactive() Option
func NonInteractive ¶
func NonInteractive() Option
func TrackingID ¶
func WithContext ¶
func WithContexts ¶
func WithValidator ¶
type Rule ¶
func ContextContains ¶
func ContextContains(ct ContextType, k string, nonZero bool) Rule
func ContextValid ¶
func ContextValid(ct ContextType) Rule
func HasContext ¶
func HasContext(ct ContextType) Rule
type Validator ¶
func NewValidator ¶
func NewValidator(opts ...ValidatorOption) Validator
type ValidatorOption ¶
type ValidatorOption func(Validator)
func WithRule ¶
func WithRule(n string, rule Rule) ValidatorOption
func WithRules ¶
func WithRules(m map[string]Rule) ValidatorOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.