Documentation ¶
Index ¶
- func SetField(data interface{}, field reflect.Value, fieldType reflect.StructField, ...) (interface{}, error)
- type Attributer
- func Attr(name string, genFunc func() interface{}, options ...string) Attributer
- func Bool(name string, genFunc func() bool, options ...string) Attributer
- func Bytes(name string, genFunc func() []byte, options ...string) Attributer
- func Float(name string, genFunc func() float64, options ...string) Attributer
- func Int(name string, genFunc func() int, options ...string) Attributer
- func Str(name string, genFunc func() string, options ...string) Attributer
- func Time(name string, genFunc func() time.Time, options ...string) Attributer
- func Uint(name string, genFunc func() uint, options ...string) Attributer
- type Processor
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetField ¶
func SetField(data interface{}, field reflect.Value, fieldType reflect.StructField, attr Attributer) (interface{}, error)
Types ¶
type Attributer ¶
type Attributer interface { Name() string ColName() string Kind() Type Gen(data interface{}) (interface{}, error) Process(process Processor) Attributer GetVal() interface{} SetVal(val interface{}) error GetObject() interface{} }
Attributer define attribute interface for factory
func Attr ¶
func Attr(name string, genFunc func() interface{}, options ...string) Attributer
Attr create interface{} attributer with generated function
the return value of generated function must has the specific type
func Bytes ¶
func Bytes(name string, genFunc func() []byte, options ...string) Attributer
Bytes create []byte attributer with generated function
func Float ¶
func Float(name string, genFunc func() float64, options ...string) Attributer
Float create float attributer with generated function
func Int ¶
func Int(name string, genFunc func() int, options ...string) Attributer
Int create int attributer with generated function
type Processor ¶
type Processor func(attr Attributer) error
Processor define process method interface
type Type ¶
type Type int8
Type represent attributes type
const ( // IntAttr int-family attribute IntAttr Type = iota + 1 // UintAttr uint-family attribute UintAttr // FloatAttr float-family attribute FloatAttr // StringAttr string attribute StringAttr // BytesAttr []byte attribute BytesAttr // TimeAttr time.Time attribute TimeAttr // BoolAttr boolean attribute BoolAttr // UnknownAttr interface{} attribute UnknownAttr )
Click to show internal directories.
Click to hide internal directories.