attrs

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2015 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package attrs provide two attributes containers, designed for embed to other types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attrs

type Attrs interface {
	Attr(name string) interface{}
	AttrDef(name string, defVal interface{}) interface{}
	// if value is nil, remove it
	SetAttr(name string, value interface{})
	GetSetAttr(name string, value interface{}) interface{}
	IsAttrExist(name string) bool

	AllAttrs() Values
	Clear()
}

Attrs is a common container store attribute

func New

func New() Attrs

func NewLocked

func NewLocked() Attrs

type LockedValues

type LockedValues struct {
	Values
	sync.RWMutex
}

func (*LockedValues) AllAttrs

func (v *LockedValues) AllAttrs() Values

func (*LockedValues) Attr

func (v *LockedValues) Attr(key string) interface{}

func (*LockedValues) AttrDef added in v0.2.3

func (v *LockedValues) AttrDef(key string, def interface{}) interface{}

func (*LockedValues) Clear

func (v *LockedValues) Clear()

func (*LockedValues) GetSetAttr

func (v *LockedValues) GetSetAttr(key string, val interface{}) interface{}

func (*LockedValues) IsAttrExist

func (v *LockedValues) IsAttrExist(key string) bool

func (*LockedValues) SetAttr

func (v *LockedValues) SetAttr(key string, val interface{})

type Values

type Values map[string]interface{}

func (Values) AllAttrs

func (v Values) AllAttrs() Values

func (Values) Attr

func (v Values) Attr(key string) interface{}

func (Values) AttrDef added in v0.2.3

func (v Values) AttrDef(key string, def interface{}) interface{}

func (Values) Clear

func (v Values) Clear()

func (Values) GetSetAttr

func (v Values) GetSetAttr(key string, val interface{}) interface{}

func (Values) IsAttrExist

func (v Values) IsAttrExist(key string) bool

func (Values) SetAttr

func (v Values) SetAttr(key string, val interface{})

Jump to

Keyboard shortcuts

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