You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
822 B
40 lines
822 B
package nwweb
|
|
|
|
import "git.nwestland.com/tools/nwjson"
|
|
|
|
type convertable struct {
|
|
stringVal func(string) string
|
|
}
|
|
|
|
func (c convertable) String(key string) string {
|
|
return c.stringVal(key)
|
|
}
|
|
|
|
func (c convertable) Bytes(key string) []byte {
|
|
return stringToBytes(c.String(key))
|
|
}
|
|
|
|
func (c convertable) Int(key string) int {
|
|
return stringToInt(c.String(key))
|
|
}
|
|
|
|
func (c convertable) Bool(key string) bool {
|
|
return stringToBool(c.String(key))
|
|
}
|
|
|
|
func (c convertable) Float32(key string) float32 {
|
|
return stringToFloat32(c.String(key))
|
|
}
|
|
|
|
func (c convertable) Float64(key string) float64 {
|
|
return stringToFloat64(c.String(key))
|
|
}
|
|
|
|
func (c convertable) Object(key string) nwjson.Object {
|
|
return stringToObject(c.String(key))
|
|
}
|
|
|
|
func (c convertable) Array(key string) nwjson.Array {
|
|
return stringToArray(c.String(key))
|
|
}
|