filter

package
v0.0.0-...-fcbdc9d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsFloat

func AsFloat(v string) float64

AsFloat parses the TagValue an a float64, 0.0 on error

func AsFloatSlice

func AsFloatSlice(v string) []float64

AsFloatSlice parses the TagValue as a comma-separated slice of float64s (0.0 in every unparsable item)

func AsInt

func AsInt(v string) int64

AsInt parses the TagValue as an int, 0 on error

func AsIntSlice

func AsIntSlice(v string) []int64

AsIntSlice parses the TagValue as a comma-separated slice of int64s (0 in every unparsable item)

func AsStringSlice

func AsStringSlice(v string) []string

AsStringSlice parses the TagValue as a comma-separated slice of strings

func UpdateTags

func UpdateTags(tags types.JSONStringMap, updates []*types.TagUpdate) []bool

UpdateTags modifies the tags map (required to be non-nil!) according to the given set of updates. Each types.TagUpdate contains the name of the map entry to update, the type of the entry (one of the TagValueType* consts), an index (for the slice types) and an expression to be applied (the tags are accessible as "Tags", the helper functions for type conversion of the entries are listed above). UpdateTags is supposed to be called from within the persister transactions in persister.UpdateUserTags and persister.UpdateRoomTags

Types

type Client

type Client struct {
	ClientLanguage string
}

Client is the representation of the connected client ws.Client inside the Env

type Env

type Env struct {
	Room
	Source
	Target
	Created       int64
	Language      string
	Name          string
	Tags          map[string]string
	AsInt         func(string) int64
	AsFloat       func(string) float64
	AsStringSlice func(string) []string
	AsIntSlice    func(string) []int64
	AsFloatSlice  func(string) []float64
}

Env is the complete environment of input data for target or plugin filters

type Room

type Room struct {
	Id    string
	Owner User
	Tags  map[string]string
}

Room is the representation of types.Room inside the Env

type Source

type Source struct {
	User
	PluginName string
}

Source is the representation of types.Event.Source inside the Env

type TagsEnv

type TagsEnv struct {
	Tags          map[string]string
	AsInt         func(string) int64
	AsFloat       func(string) float64
	AsStringSlice func(string) []string
	AsIntSlice    func(string) []int64
	AsFloatSlice  func(string) []float64
}

TagsEnv is the environment for tag updates (see UpdateTags)

type Target

type Target struct {
	User
	Client
}

Target represents the User and Client that the event is about to be sent to

type User

type User struct {
	Id         string
	Nick       string
	Language   string
	Tags       map[string]string
	LastOnline int64
}

User is the representation of types.User inside the Env

Jump to

Keyboard shortcuts

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