Documentation ¶
Index ¶
- Variables
- type ErrCannotBeNil
- type ErrCannotSet
- type ErrNotExist
- type ErrNumOverflow
- type ErrOutOfRange
- type ErrTypeUnequal
- type ErrUnsupportedKind
- type Table
- func (t *Table) AList() ([][2]*Table, error)
- func (t *Table) Bool() (bool, error)
- func (t *Table) Bytes() ([]byte, error)
- func (t *Table) Complex128() (complex128, error)
- func (t *Table) Complex64() (complex64, error)
- func (t *Table) ConvTo(value interface{}) error
- func (t *Table) EachDo(f eachDoFunc) error
- func (t *Table) Float32() (float32, error)
- func (t *Table) Float64() (float64, error)
- func (t *Table) Get(k interface{}) (*Table, error)
- func (t *Table) Int() (i int, err error)
- func (t *Table) Int16() (int16, error)
- func (t *Table) Int32() (int32, error)
- func (t *Table) Int64() (int64, error)
- func (t *Table) Int8() (int8, error)
- func (t *Table) Interface() interface{}
- func (t *Table) Map() (map[*Table]*Table, error)
- func (t *Table) MustAList() [][2]*Table
- func (t *Table) MustFloat32() float32
- func (t *Table) MustFloat64() float64
- func (t *Table) MustGet(k interface{}) *Table
- func (t *Table) MustInt() int
- func (t *Table) MustInt16() int16
- func (t *Table) MustInt32() int32
- func (t *Table) MustInt64() int64
- func (t *Table) MustInt8() int8
- func (t *Table) MustMap() map[*Table]*Table
- func (t *Table) MustPList() []*Table
- func (t *Table) MustSlice() []*Table
- func (t *Table) PList() ([]*Table, error)
- func (t *Table) Ptr() uintptr
- func (t *Table) Put(k, v interface{}) (err error)
- func (t *Table) Set(v interface{}) error
- func (t *Table) Slice() ([]*Table, error)
- func (t *Table) String() (string, error)
- func (t *Table) Uint() (i uint, err error)
- func (t *Table) Uint16() (uint16, error)
- func (t *Table) Uint32() (uint32, error)
- func (t *Table) Uint64() (uint64, error)
- func (t *Table) Uint8() (uint8, error)
Constants ¶
This section is empty.
Variables ¶
var (
// TimeLayout default time layout
TimeLayout = "Mon Jan 2 15:04:05 -0700 MST 2006"
)
Functions ¶
This section is empty.
Types ¶
type ErrCannotBeNil ¶
type ErrCannotBeNil struct {
Method string
}
ErrCannotBeNil ...
func (*ErrCannotBeNil) Error ¶
func (e *ErrCannotBeNil) Error() string
type ErrCannotSet ¶
type ErrCannotSet struct {
Method string
}
ErrCannotSet ...
func (*ErrCannotSet) Error ¶
func (e *ErrCannotSet) Error() string
type ErrNumOverflow ¶
ErrNumOverflow ...
func (*ErrNumOverflow) Error ¶
func (e *ErrNumOverflow) Error() string
type ErrOutOfRange ¶ added in v0.1.3
type ErrOutOfRange struct {
Method string
}
ErrOutOfRange ...
func (*ErrOutOfRange) Error ¶ added in v0.1.3
func (e *ErrOutOfRange) Error() string
type ErrTypeUnequal ¶
ErrTypeUnequal ...
func (*ErrTypeUnequal) Error ¶
func (e *ErrTypeUnequal) Error() string
type ErrUnsupportedKind ¶
type ErrUnsupportedKind struct { Method string Kind interface{} }
ErrUnsupportedKind ...
func (*ErrUnsupportedKind) Error ¶
func (e *ErrUnsupportedKind) Error() string
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table ...
func (*Table) AList ¶
AList returns t's underlying value as an association list. It returns error if t's kind is not Map, Array, Slice or Struct.
func (*Table) Bytes ¶
Bytes returns t's underlying value as a []bytes. It returns error if t's underlying value is not a slice of bytes.
func (*Table) Complex128 ¶
func (t *Table) Complex128() (complex128, error)
Complex128 returns t's underlying value as an complex128. It returns error if t's kind is not Uint*, Int*, Float* or Complex*.
func (*Table) Complex64 ¶
Complex64 returns t's underlying value as an complex64. It returns error if t's kind is not Uint*, Int*, Float32 or Complex64.
func (*Table) Float32 ¶
Float32 returns t's underlying value as an float32. It returns error if t's kind is not Uint*, Int* or Float32.
func (*Table) Float64 ¶
Float64 returns t's underlying value as an float64. It returns error if t's kind is not Uint*, Int* or Float*.
func (*Table) Get ¶
Get returns the value with the given key.
If t's kind is Map, Get returns the value associated with key in the map. If t's kind is Array or Slice, Get returns t's k'th element, the k must be int. If t's kind is Struct, Get returns the struct field with the given field name, the k must be string. if t's kind is Interface or Ptr, indirect it. It returns the nil if k is not found in the t. It returns error if t's kind is not Map, Array, Slice or Struct.
func (*Table) Int ¶
Int returns t's underlying value as an int. It returns error if t's kind is not Int, Int8, Int16, Int32, Uint8 or Uint16, and if t's kind is Int64 or Uint32 also Int is 32 bits.
func (*Table) Int16 ¶
Int16 returns t's underlying value as an int16. It returns error if t's kind is not Int, Int8, Int16, or Uint8.
func (*Table) Int32 ¶
Int32 returns t's underlying value as an int32. It returns error if t's kind is not Int, Int8, Int16, Int32, Uint8 or Uint16, and if t's kind is Int also Int is 64 bits.
func (*Table) Int64 ¶
Int64 returns t's underlying value as an int64. It returns error if t's kind is not Int, Int8, Int16, Int32, Uint8, Uint16, Uint32 and if t's kind is Uint also Uint is 64 bits.
func (*Table) Int8 ¶
Int8 returns t's underlying value as an int8. It returns error if t's kind is not Int8.
func (*Table) Map ¶
Map returns t's underlying value as a map. It returns error if t's kind is not Map, Array, Slice or Struct.
func (*Table) MustFloat32 ¶
MustFloat32 must api for Float32()
func (*Table) MustFloat64 ¶
MustFloat64 must api for Float64()
func (*Table) PList ¶
PList returns t's underlying value as an property list. It returns error if t's kind is not Map, Array, Slice or Struct.
func (*Table) Put ¶
Put put k, v to map, array, slice or struct(structed type).
If t's kind is map, the k indicates key of map. If t's kind is array/slice, the k indecates index of array/slice. If t's kind is struct, the k indecates fieldname of struct.
If k in t, and set k's value to v.
If t's kind is not map, array, slice or struct, returns ErrUnsupportedKind.
func (*Table) Set ¶
Set set t's value to v.
If t's value can't setable, returns ErrCannotSet. If t's kind and v's kind is not equivalence, returns ErrTypeUnequal. It returns nil, that set successful.
If set map key, struct field or array/slice index, using Table.Put.
TODO: balala
func (*Table) Slice ¶
Slice returns t's underlying value as a slice. It returns error if t's kind is not Array, Slice or Struct.
func (*Table) Uint ¶
Uint returns t's underlying value as an uint. It returns error if t's kind is not Uint, Uint8, Uint16 or Uint32, and if t's kind is Uint64 also Uint is 32 bits.
func (*Table) Uint16 ¶
Uint16 returns t's underlying value as an uint16. It returns error if t's kind is not Uint8 or Uint16.
func (*Table) Uint32 ¶
Uint32 returns t's underlying value as an uint32. It returns error if t's kind is not Uint8, Uint16 or Uint32, and if t's kind is Uint also Uint is 64 bits.