surrealpatch/sql/funcs.go

252 lines
6.8 KiB
Go
Raw Normal View History

// Copyright © 2016 Abcum Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package sql
2017-11-16 20:53:13 +00:00
var rolls = map[string]bool{
2017-11-16 20:53:13 +00:00
"distinct": true,
2016-11-21 14:34:15 +00:00
2017-11-16 20:53:13 +00:00
// Count implementation
2016-11-21 14:34:15 +00:00
2017-11-16 20:53:13 +00:00
"count": true,
"count.if": true,
"count.not": true,
2016-11-21 14:34:15 +00:00
2017-11-16 20:53:13 +00:00
// Math implementation
2016-11-21 14:34:15 +00:00
"math.max": true,
"math.mean": true,
"math.min": true,
"math.stddev": true,
"math.sum": true,
"math.variance": true,
2017-11-16 20:53:13 +00:00
}
2017-11-16 20:53:13 +00:00
var aggrs = map[string]bool{
"distinct": true,
// Count implementation
"count": true,
"count.if": true,
"count.not": true,
// Math implementation
"math.bottom": true,
"math.geometricmean": true,
"math.harmonicmean": true,
"math.interquartile": true,
"math.max": true,
"math.mean": true,
"math.median": true,
"math.midhinge": true,
"math.min": true,
"math.mode": true,
2018-04-29 13:02:58 +00:00
"math.nearestrank": true,
2017-11-16 20:53:13 +00:00
"math.percentile": true,
"math.sample": true,
"math.spread": true,
"math.stddev": true,
"math.sum": true,
"math.top": true,
"math.trimean": true,
"math.variance": true,
}
2017-11-16 20:53:13 +00:00
var funcs = map[string]map[int]interface{}{
2017-12-12 00:54:18 +00:00
"array": {-1: nil},
2017-11-16 20:53:13 +00:00
"batch": {2: nil},
"difference": {-1: nil},
"distinct": {1: nil},
"either": {-1: nil},
2017-11-16 20:53:13 +00:00
"get": {2: nil},
"if": {3: nil},
"intersect": {-1: nil},
"model": {2: nil, 3: nil, 4: nil},
"regex": {1: nil},
2017-11-16 20:53:13 +00:00
"table": {1: nil},
"thing": {2: nil},
"union": {-1: nil},
// Count implementation
"count": {1: nil},
"count.if": {2: nil},
"count.not": {2: nil},
2018-04-20 20:34:54 +00:00
// Purge implementation
"purge": {1: nil},
"purge.if": {2: nil},
"purge.not": {2: nil},
2017-11-16 20:53:13 +00:00
// Json implementation
"json.decode": {1: nil},
"json.encode": {1: nil},
// Geo implementation
"geo.point": {1: nil, 2: nil},
"geo.circle": {2: nil},
"geo.polygon": {-1: nil},
"geo.distance": {2: nil},
"geo.inside": {2: nil},
"geo.intersects": {2: nil},
"geo.hash.decode": {1: nil},
"geo.hash.encode": {2: nil},
// Http implementation
"http.head": {1: nil, 2: nil},
"http.get": {1: nil, 2: nil},
"http.put": {1: nil, 2: nil, 3: nil},
"http.post": {1: nil, 2: nil, 3: nil},
"http.patch": {1: nil, 2: nil, 3: nil},
"http.delete": {1: nil, 2: nil},
"http.async.head": {1: nil, 2: nil},
"http.async.get": {1: nil, 2: nil},
"http.async.put": {1: nil, 2: nil, 3: nil},
"http.async.post": {1: nil, 2: nil, 3: nil},
"http.async.patch": {1: nil, 2: nil, 3: nil},
"http.async.delete": {1: nil, 2: nil},
// Math implementation
"math.abs": {1: nil},
"math.bottom": {2: nil},
"math.ceil": {1: nil},
"math.correlation": {2: nil},
"math.covariance": {2: nil},
"math.fixed": {2: nil},
2017-11-16 20:53:13 +00:00
"math.floor": {1: nil},
"math.geometricmean": {1: nil},
"math.harmonicmean": {1: nil},
"math.interquartile": {1: nil},
"math.max": {1: nil},
"math.mean": {1: nil},
"math.median": {1: nil},
"math.midhinge": {1: nil},
"math.min": {1: nil},
"math.mode": {1: nil},
2018-04-29 13:02:58 +00:00
"math.nearestrank": {2: nil},
2017-11-16 20:53:13 +00:00
"math.percentile": {2: nil},
"math.round": {1: nil},
"math.sample": {2: nil},
"math.spread": {1: nil},
2018-04-29 13:02:19 +00:00
"math.sqrt": {1: nil},
2017-11-16 20:53:13 +00:00
"math.stddev": {1: nil},
"math.sum": {1: nil},
"math.top": {2: nil},
"math.trimean": {1: nil},
"math.variance": {1: nil},
// String implementation
"string.concat": {-1: nil},
"string.contains": {2: nil},
"string.endsWith": {2: nil},
"string.format": {-1: nil},
"string.includes": {2: nil},
"string.join": {-1: nil},
"string.length": {1: nil},
"string.lowercase": {1: nil},
"string.repeat": {2: nil},
"string.replace": {3: nil},
"string.reverse": {1: nil},
2017-11-16 20:53:13 +00:00
"string.search": {2: nil},
"string.slice": {3: nil},
"string.split": {2: nil},
"string.startsWith": {2: nil},
"string.substr": {3: nil},
"string.trim": {1: nil},
"string.uppercase": {1: nil},
"string.words": {1: nil},
// Hash implementation
"hash.md5": {1: nil},
"hash.sha1": {1: nil},
"hash.sha256": {1: nil},
"hash.sha512": {1: nil},
// Time implementation
"time.now": {0: nil},
"time.add": {2: nil},
"time.age": {2: nil},
"time.floor": {2: nil},
"time.round": {2: nil},
"time.day": {0: nil, 1: nil},
"time.hour": {0: nil, 1: nil},
"time.mins": {0: nil, 1: nil},
"time.month": {0: nil, 1: nil},
"time.nano": {0: nil, 1: nil},
"time.secs": {0: nil, 1: nil},
"time.unix": {0: nil, 1: nil},
"time.year": {0: nil, 1: nil},
2017-12-04 10:06:01 +00:00
// Url implementation
"url.domain": {1: nil},
"url.host": {1: nil},
"url.port": {1: nil},
"url.path": {1: nil},
2017-11-16 20:53:13 +00:00
// Email implementation
"email.user": {1: nil},
"email.domain": {1: nil},
"email.valid": {1: nil},
2017-11-16 20:53:13 +00:00
// Bcrypt implementation
"bcrypt.compare": {2: nil},
"bcrypt.generate": {1: nil},
2017-11-16 20:53:13 +00:00
// Scrypt implementation
"scrypt.compare": {2: nil},
"scrypt.generate": {1: nil},
// Random implementation
"rand": {0: nil},
2017-11-27 11:35:26 +00:00
"guid": {0: nil},
2017-11-16 20:53:13 +00:00
"uuid": {0: nil},
"rand.bool": {0: nil},
2017-11-27 11:35:26 +00:00
"rand.guid": {0: nil},
2017-11-16 20:53:13 +00:00
"rand.uuid": {0: nil},
"rand.enum": {-1: nil},
"rand.time": {0: nil, 2: nil},
"rand.string": {0: nil, 1: nil, 2: nil},
"rand.integer": {0: nil, 2: nil},
"rand.decimal": {0: nil, 2: nil},
"rand.sentence": {0: nil, 2: nil},
"rand.paragraph": {0: nil, 2: nil},
"rand.person.email": {0: nil},
"rand.person.phone": {0: nil},
"rand.person.fullname": {0: nil},
"rand.person.firstname": {0: nil},
"rand.person.lastname": {0: nil},
"rand.person.username": {0: nil},
"rand.person.jobtitle": {0: nil},
"rand.company.name": {0: nil},
"rand.company.industry": {0: nil},
"rand.location.name": {0: nil},
"rand.location.address": {0: nil},
"rand.location.street": {0: nil},
"rand.location.city": {0: nil},
"rand.location.state": {0: nil},
"rand.location.county": {0: nil},
"rand.location.zipcode": {0: nil},
"rand.location.postcode": {0: nil},
"rand.location.country": {0: nil},
"rand.location.altitude": {0: nil},
"rand.location.latitude": {0: nil},
"rand.location.longitude": {0: nil},
}