Example #1
0
package platform

import (
	"github.com/Mparaiso/go-tiger/funcs"
)

var (
	mapStringsToStrings func([]string, func(string) string) []string
	_                   = funcs.Must(funcs.MakeMap(&mapStringsToStrings))
)
Example #2
0
	result := "metadata : {"
	result += "collectionName: '" + meta.targetDocument + "', "
	result += "idField: '" + meta.idField + "' "
	result += "fields :[\n"
	for i, field := range meta.fields {
		if i > 0 {
			result += ",\n "
		}
		result += "{" + field.String() + "}"
	}
	return result + "\n]}\n"
}

var (
	keyValuesByObjectID func(collection []reflect.Value, selector func(reflect.Value) bson.ObjectId) map[bson.ObjectId]reflect.Value
	_                   = funcs.Must(funcs.MakeKeyBy(&keyValuesByObjectID))

	getKeys func(map[bson.ObjectId]reflect.Value) []bson.ObjectId
	_       = funcs.Must(funcs.MakeGetKeys(&getKeys))

	flatten func([][]interface{}) []interface{}
	_       = funcs.Must(funcs.MakeFlatten(&flatten))

	mapResultsToInterfaces func([]map[string]interface{}, func(map[string]interface{}) []interface{}) [][]interface{}
	_                      = funcs.Must(funcs.MakeMap(&mapResultsToInterfaces))

	keyResultsBySourceID func(results []map[string]interface{}, mapper func(result map[string]interface{}) (id bson.ObjectId)) map[bson.ObjectId]map[string]interface{}
	_                    = funcs.Must(funcs.MakeKeyBy(&keyResultsBySourceID))

	mapResultsToRelatedObjectIds func(results []map[string]interface{}, mapper func(result map[string]interface{}) bson.ObjectId) []bson.ObjectId
	_                            = funcs.Must(funcs.MakeMap(&mapResultsToRelatedObjectIds))