binder

package
v0.0.0-...-5e61291 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2019 License: GPL-2.0, GPL-2.0-or-later Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MSSBinder = revel.Binder{
	Bind: func(params *revel.Params, name string, typ reflect.Type) reflect.Value {
		var (
			result    = reflect.MakeMap(typ)
			keyType   = typ.Key()
			valueType = typ.Elem()
		)
		for paramName, values := range params.Values {
			key := paramName

			result.SetMapIndex(revel.BindValue(key, keyType), revel.BindValue(values[0], valueType))
		}
		return result
	},

	Unbind: func(output map[string]string, name string, val interface{}) {
		mapValue := reflect.ValueOf(val)
		for _, key := range mapValue.MapKeys() {
			revel.Unbind(output, fmt.Sprintf("%v", key.Interface()),
				mapValue.MapIndex(key).Interface())
		}
	},
}

for test map[string][string]

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL