param

package
v0.0.0-...-92398f1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: AGPL-3.0 Imports: 10 Imported by: 5

Documentation

Index

Constants

View Source
const (
	FieldsKey = "fields"
	TagsKey   = "tags"
)

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

func GetInt64OrDefault

func GetInt64OrDefault(v interface{}, defaultV int64) (int64, bool)

Types

type ParaKey

type ParaKey string

type Parameters

type Parameters struct {
	Timestamp time.Time
	Data      util.MapStr `json:"data,omitempty"`
	Meta      util.MapStr `json:"-"`
	// contains filtered or unexported fields
}

func (*Parameters) AddTags

func (para *Parameters) AddTags(tags []string) error

AddTags appends a tag to the tags field of ms. If the tags field does not exist then it will be created. If the tags field exists and is not a []string then an error will be returned. It does not deduplicate the list of tags.

func (*Parameters) AddTagsWithKey

func (para *Parameters) AddTagsWithKey(key string, tags []string) error

AddTagsWithKey appends a tag to the key field of ms. If the field does not exist then it will be created. If the field exists and is not a []string then an error will be returned. It does not deduplicate the list.

func (*Parameters) CloneData

func (para *Parameters) CloneData() util.MapStr

func (*Parameters) Config

func (para *Parameters) Config(key ParaKey, obj interface{})

func (*Parameters) ConfigBinding

func (newPara *Parameters) ConfigBinding(key ParaKey, rt reflect.Type, mutable *reflect.Value)

func (*Parameters) Delete

func (e *Parameters) Delete(key string) error

func (*Parameters) Get

func (para *Parameters) Get(key ParaKey) interface{}

func (*Parameters) GetArray

func (para *Parameters) GetArray(key ParaKey) ([]interface{}, bool)

GetArray will return a array which type of the items are interface {}

func (*Parameters) GetBool

func (para *Parameters) GetBool(key ParaKey, defaultV bool) bool

func (*Parameters) GetBytes

func (para *Parameters) GetBytes(key ParaKey) ([]byte, bool)

func (*Parameters) GetDurationOrDefault

func (para *Parameters) GetDurationOrDefault(key ParaKey, defaultV string) time.Duration

func (*Parameters) GetFloat32

func (para *Parameters) GetFloat32(key ParaKey, defaultV float32) (float32, bool)

func (*Parameters) GetFloat32OrDefault

func (para *Parameters) GetFloat32OrDefault(key ParaKey, defaultV float32) float32

func (*Parameters) GetFloat64

func (para *Parameters) GetFloat64(key ParaKey, defaultV float64) (float64, bool)

func (*Parameters) GetFloat64OrDefault

func (para *Parameters) GetFloat64OrDefault(key ParaKey, defaultV float64) float64

func (*Parameters) GetInt

func (para *Parameters) GetInt(key ParaKey, defaultV int) (int, bool)

func (*Parameters) GetInt64

func (para *Parameters) GetInt64(key ParaKey, defaultV int64) (int64, bool)

func (*Parameters) GetInt64Array

func (para *Parameters) GetInt64Array(key ParaKey) ([]int64, bool)

func (*Parameters) GetInt64OrDefault

func (para *Parameters) GetInt64OrDefault(key ParaKey, defaultV int64) int64

func (*Parameters) GetIntMapOrInit

func (para *Parameters) GetIntMapOrInit(key ParaKey) (map[string]int, bool)

func (*Parameters) GetIntOrDefault

func (para *Parameters) GetIntOrDefault(key ParaKey, defaultV int) int

func (*Parameters) GetMap

func (para *Parameters) GetMap(key ParaKey) (map[string]interface{}, bool)

func (*Parameters) GetMapArray

func (para *Parameters) GetMapArray(key ParaKey) ([]map[string]interface{}, bool)

func (*Parameters) GetOrDefault

func (para *Parameters) GetOrDefault(key ParaKey, val interface{}) interface{}

func (*Parameters) GetString

func (para *Parameters) GetString(key ParaKey) (string, bool)

func (*Parameters) GetStringArray

func (para *Parameters) GetStringArray(key ParaKey) ([]string, bool)

func (*Parameters) GetStringMap

func (para *Parameters) GetStringMap(key ParaKey) (result map[string]string, ok bool)

func (*Parameters) GetStringOrDefault

func (para *Parameters) GetStringOrDefault(key ParaKey, val string) string

func (*Parameters) GetTags

func (para *Parameters) GetTags() (map[string]string, bool)

func (*Parameters) GetTime

func (para *Parameters) GetTime(key ParaKey) (time.Time, bool)

func (*Parameters) GetValue

func (e *Parameters) GetValue(key string) (interface{}, error)

func (*Parameters) Has

func (para *Parameters) Has(key ParaKey) bool

func (*Parameters) HasTag

func (para *Parameters) HasTag(key string) bool

func (*Parameters) Increment

func (e *Parameters) Increment(key string, v int)

func (*Parameters) MustGet

func (para *Parameters) MustGet(key ParaKey) interface{}

func (*Parameters) MustGetArray

func (para *Parameters) MustGetArray(key ParaKey) []interface{}

func (*Parameters) MustGetBytes

func (para *Parameters) MustGetBytes(key ParaKey) []byte

func (*Parameters) MustGetInt

func (para *Parameters) MustGetInt(key ParaKey) int

MustGetInt return 0 if not key was found

func (*Parameters) MustGetInt64

func (para *Parameters) MustGetInt64(key ParaKey) int64

func (*Parameters) MustGetMap

func (para *Parameters) MustGetMap(key ParaKey) map[string]interface{}

func (*Parameters) MustGetString

func (para *Parameters) MustGetString(key ParaKey) string

func (*Parameters) MustGetStringArray

func (para *Parameters) MustGetStringArray(key ParaKey) []string

func (*Parameters) MustGetTime

func (para *Parameters) MustGetTime(key ParaKey) time.Time

func (*Parameters) PutValue

func (e *Parameters) PutValue(key string, v interface{}) (interface{}, error)

func (*Parameters) ResetParameters

func (para *Parameters) ResetParameters()

func (*Parameters) Set

func (para *Parameters) Set(key ParaKey, value interface{})

TODO remove lock async, channel

func (*Parameters) SetErrorWithOption

func (e *Parameters) SetErrorWithOption(jsonErr util.MapStr, addErrKey bool)

SetErrorWithOption sets jsonErr value in the event fields according to addErrKey value.

func (*Parameters) Stats

func (e *Parameters) Stats(key string) int

func (*Parameters) UpdateTags

func (para *Parameters) UpdateTags(addTags, removeTags []string)

Jump to

Keyboard shortcuts

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