Documentation ¶
Index ¶
- Variables
- func AlphaNumeric(s string) bool
- func Assign(d interface{}, s map[string]interface{}, rds map[string]AssignReader) error
- func FatalIfErr(err error)
- func ForceAssign(d interface{}, s map[string]interface{}, rds map[string]AssignReader) error
- func MilliSecToNano(milli int64) int64
- func MilliSecToSec(milli int64) int64
- func NanoToMilli(nano int64) int64
- func QueryToMap(values url.Values) map[string]string
- func StringSliceContains(s []string, v string) bool
- func ToStringMap(m map[interface{}]interface{}) (map[string]interface{}, error)
- type AssignReader
- type AtomBool
- type JSONDuration
- type MarshallableErrors
Constants ¶
This section is empty.
Variables ¶
View Source
var BoolAssignReader = func(v interface{}, isPtr bool) (reflect.Value, error) { if b, ok := v.(bool); !ok { return reflect.Value{}, errors.New("interface is not a bool") } else { if isPtr { return reflect.ValueOf(&b), nil } else { return reflect.ValueOf(b), nil } } }
View Source
var Cache = &cache{caches: make(map[string]*expirableContent)}
View Source
var DurationAssignReader = func(v interface{}, isPtr bool) (reflect.Value, error) { var d time.Duration var err error if f, ok := v.(float64); ok { d = time.Duration(int64(f)) } else if i, ok := v.(int64); ok { d = time.Duration(i) } else if s, ok := v.(string); ok { d, err = time.ParseDuration(s) if err != nil { return reflect.Value{}, err } } else { return reflect.Value{}, errors.New("interface is not a duration") } if isPtr { return reflect.ValueOf(&d), nil } else { return reflect.ValueOf(d), nil } }
View Source
var Float64AssignReader = func(v interface{}, isPtr bool) (reflect.Value, error) { if f, ok := v.(float64); !ok { return reflect.Value{}, errors.New("interface is not a float64") } else { if isPtr { return reflect.ValueOf(&f), nil } else { return reflect.ValueOf(f), nil } } }
View Source
var Int64AssignReader = func(v interface{}, isPtr bool) (reflect.Value, error) { if i, ok := v.(int64); !ok { if f, ok := v.(float64); !ok { return reflect.Value{}, errors.New("interface is not an int64") } else { if isPtr { pf := int64(f) return reflect.ValueOf(&pf), nil } else { return reflect.ValueOf(int64(f)), nil } } } else { if isPtr { return reflect.ValueOf(&i), nil } else { return reflect.ValueOf(i), nil } } }
View Source
var IntAssignReader = func(v interface{}, isPtr bool) (reflect.Value, error) { if i, ok := v.(int); !ok { if f, ok := v.(float64); !ok { return reflect.Value{}, errors.New("interface is not an int") } else { if isPtr { pf := int(f) return reflect.ValueOf(&pf), nil } else { return reflect.ValueOf(int(f)), nil } } } else { if isPtr { return reflect.ValueOf(&i), nil } else { return reflect.ValueOf(i), nil } } }
View Source
var JSONDurationAssignReader = func(v interface{}, isPtr bool) (reflect.Value, error) { var _d time.Duration var err error if f, ok := v.(float64); ok { _d = time.Duration(int64(f)) } else if i, ok := v.(int64); ok { _d = time.Duration(i) } else if s, ok := v.(string); ok { _d, err = time.ParseDuration(s) if err != nil { return reflect.Value{}, err } } else { return reflect.Value{}, errors.New("interface is not a duration") } d := JSONDuration{Duration: _d} if isPtr { return reflect.ValueOf(&d), nil } else { return reflect.ValueOf(d), nil } }
View Source
var Render *render.Render
View Source
var StringAssignReader = func(v interface{}, isPtr bool) (reflect.Value, error) { if s, ok := v.(string); !ok { return reflect.Value{}, errors.New("interface is not a string") } else { if isPtr { return reflect.ValueOf(&s), nil } else { return reflect.ValueOf(s), nil } } }
View Source
var TagName = "assign"
Functions ¶
func AlphaNumeric ¶
func Assign ¶
func Assign(d interface{}, s map[string]interface{}, rds map[string]AssignReader) error
func FatalIfErr ¶
func FatalIfErr(err error)
func ForceAssign ¶
func ForceAssign(d interface{}, s map[string]interface{}, rds map[string]AssignReader) error
func MilliSecToNano ¶
func MilliSecToSec ¶
func NanoToMilli ¶
func StringSliceContains ¶
func ToStringMap ¶
Types ¶
type JSONDuration ¶
func (*JSONDuration) MarshalJSON ¶
func (d *JSONDuration) MarshalJSON() ([]byte, error)
func (*JSONDuration) UnmarshalJSON ¶
func (d *JSONDuration) UnmarshalJSON(data []byte) error
type MarshallableErrors ¶
func (MarshallableErrors) MarshalJSON ¶
func (m MarshallableErrors) MarshalJSON() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.