| 123456789101112131415161718192021222324252627282930313233343536 |
- /*
- copyMap copies a given map.
- */
- func copyMap(m) {
- let ret := {}
- for [k, v] in m {
- ret[k] := v
- }
- return ret
- }
- /*
- max returns the maximum of two numbers.
- */
- func max(a, b) {
- if a > b {
- return a
- }
- return b
- }
- /*
- allNodeKeys returns the keys of all nodes of a certain kind.
- */
- func allNodeKeys(part, kind) {
- let ret := []
- let res := db.graphQL("main", "{ {{kind}} { key } }", {"kind" : kind})
- if len(res.data[kind]) > 0 {
- for o in res.data[kind] {
- ret := add(ret, o.key)
- }
- }
- return ret
- }
|