Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NullBoolBinder = revel.Binder{ Bind: revel.ValueBinder(func(val string, typ reflect.Type) reflect.Value { boolValue, err := strconv.ParseBool(val) if err != nil { return reflect.Zero(typ) } pValue := reflect.New(typ) nBool := null.NewBool(boolValue, true) pValue.Elem().Set(reflect.ValueOf(nBool)) return pValue.Elem() }), Unbind: func(output map[string]string, name string, val interface{}) { var v, ok = val.(null.Bool) if ok { output[name] = fmt.Sprintf("%b", v.Bool) } }, }
View Source
var NullFloatBinder = revel.Binder{ Bind: revel.ValueBinder(func(val string, typ reflect.Type) reflect.Value { floatValue, err := strconv.ParseFloat(val, 64) if err != nil { return reflect.Zero(typ) } pValue := reflect.New(typ) nFloat := null.NewFloat(floatValue, true) pValue.Elem().Set(reflect.ValueOf(nFloat)) return pValue.Elem() }), Unbind: func(output map[string]string, name string, val interface{}) { var v, ok = val.(null.Float) if ok { output[name] = fmt.Sprintf("%d", v.Float64) } }, }
View Source
var NullIntBinder = revel.Binder{ Bind: revel.ValueBinder(func(val string, typ reflect.Type) reflect.Value { intValue, err := strconv.ParseInt(val, 10, 64) if err != nil { return reflect.Zero(typ) } pValue := reflect.New(typ) nInt := null.NewInt(intValue, true) pValue.Elem().Set(reflect.ValueOf(nInt)) return pValue.Elem() }), Unbind: func(output map[string]string, name string, val interface{}) { var v, ok = val.(null.Int) if ok { output[name] = fmt.Sprintf("%d", v.Int64) } }, }
View Source
var NullStringBinder = revel.Binder{ Bind: revel.ValueBinder(func(val string, typ reflect.Type) reflect.Value { pValue := reflect.New(typ) nString := null.NewString(val, true) pValue.Elem().Set(reflect.ValueOf(nString)) return pValue.Elem() }), Unbind: func(output map[string]string, name string, val interface{}) { var v, ok = val.(null.String) if ok { output[name] = fmt.Sprintf("%s", v.String) } }, }
Functions ¶
func AddTypeBinders ¶
func AddTypeBinders()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.