convert

package
v0.0.0-...-ce71dfa Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2012 License: BSD-2-Clause-Views Imports: 3 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(x interface{}) interface{}

Cleans all bson.M s to map[string]interface{} s. Usually called on db query results. Will become obsolete when the mgo driver will return map[string]interface{} maps instead of bson.M ones.

func ListToMap

func ListToMap(i ...interface{}) map[string]interface{}

func MapAdd

func MapAdd(ma map[string]interface{}, key string, value interface{})

func Mapify

func Mapify(a map[string][]string) map[string]interface{}

func OrderKeys

func OrderKeys(d map[string]interface{}) []interface{}

A more generic version of abcKeys. Takes a map[string]interface{} and puts every element of that into an []interface{}, ordered by keys alphabetically. TODO: find the intersecting parts between the two functions and refactor.

func Recurs

func Recurs(v interface{}, converter func(interface{}) (interface{}, bool)) interface{}

Converts all bson.ObjectId s to string. Usually called before displaying a database query result. Input is the result from the database.

func SchemeToFields

func SchemeToFields(scheme interface{}, dat interface{}) ([]map[string]interface{}, error)

Takes an extraction/validation scheme, a document and from that creates a slice which can be easily displayed by a templating engine as a html form. Takes interface{}s and not map[string]interface{}s to include type checking here, and avoid that boilerplate in caller.

func ToStringSlice

func ToStringSlice(i ...interface{}) []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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