attrs

package
v0.0.0-...-96c172f Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttrTypeStr  string = "str"
	AttrTypeI64  string = "i64"
	AttrTypeF64  string = "f64"
	AttrTypeBool string = "bool"
)

Variables

View Source
var (
	// sentinel errors
	ErrAttrNotFound  = errors.New("ErrAttrNotFound")
	ErrAttrWrongType = errors.New("ErrAttrWrongType")
	ErrAttrBadName   = errors.New("ErrAttrWrongType")
)

Functions

func ApplyAttrs

func ApplyAttrs(a Attributable, attrMap map[string]interface{})

Types

type AttrDefinition

type AttrDefinition struct {
	Name        string `json:"name"`
	StrAttrType string `json:"attr_type"`
}

type AttrDefinitionList

type AttrDefinitionList []AttrDefinition

func (AttrDefinitionList) CleanUp

func (l AttrDefinitionList) CleanUp() (AttrDefinitionList, []error)

func (AttrDefinitionList) Names

func (l AttrDefinitionList) Names() []string

type Attributable

type Attributable interface {
	// Str adds a tag to the message of type string.
	Str(key, val string)
	// I64 adds a tag to the message of type int64.
	I64(key string, val int64)
	// F64 adds a tag to the message of type float64.
	F64(key string, val float64)
	// Bool adds a tag to the message of type bool.
	Bool(key string, val bool)

	SetAttrs(vals map[string]interface{})
}

func SetAttr

func SetAttr(a Attributable, k string, v interface{}) Attributable

Jump to

Keyboard shortcuts

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