https://surrealdb.com/docs/surrealql/operators
Procs
proc `distinct`(self: SurrealQuery): SurrealQuery {....raises: [], tags: [].}
proc avg(self: SurrealQuery; column: string): Future[float] {. ...raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc columns(self: SurrealQuery): Future[seq[string]] {. ...raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc count(self: SurrealQuery): Future[int] {....raises: [Exception, ValueError], tags: [ RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc delete(self: SurrealQuery): owned(Future[void]) {....raises: [Exception], tags: [ RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- https://surrealdb.com/docs/surrealql/statements/delete
proc delete(self: SurrealQuery; id: SurrealId): owned(Future[void]) {. ...raises: [Exception], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- https://surrealdb.com/docs/surrealql/statements/delete
proc exec(self: RawSurrealQuery): owned(Future[void]) {....raises: [Exception], tags: [ RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
-
It is only used with raw()
proc fetch(self: SurrealQuery; columnsArg: varargs[string]): SurrealQuery {. ...raises: [], tags: [].}
proc find(self: SurrealQuery; id: SurrealId; key = "id"): Future[ Option[JsonNode]] {....raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc first(self: RawSurrealQuery): Future[Option[JsonNode]] {. ...raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- It is only used with raw()
proc first(self: SurrealQuery): Future[Option[JsonNode]] {. ...raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc get(self: RawSurrealQuery): Future[seq[JsonNode]] {. ...raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- It is only used with raw()
proc get(self: SurrealQuery): Future[seq[JsonNode]] {. ...raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- https://surrealdb.com/docs/surrealql/statements/select
proc groupBy(self: SurrealQuery; column: string): SurrealQuery {. ...raises: [KeyError], tags: [].}
proc having(self: SurrealQuery; column: string; symbol: string; value: bool | int | float | string): SurrealQuery
proc having(self: SurrealQuery; column: string; symbol: string; value: nil.type): SurrealQuery {. ...raises: [Exception, KeyError], tags: [].}
proc info(self: RawSurrealQuery): Future[JsonNode] {. ...raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
-
Get all response.
proc insert(self: SurrealQuery; items: JsonNode): owned(Future[void]) {. ...raises: [Exception], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- https://surrealdb.com/docs/surrealql/statements/insert
proc insert(self: SurrealQuery; items: seq[JsonNode]): owned(Future[void]) {. ...raises: [Exception], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- https://surrealdb.com/docs/surrealql/statements/insert
proc insertId(self: SurrealQuery; items: JsonNode; key = "id"): Future[SurrealId] {. ...raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- https://surrealdb.com/docs/surrealql/statements/insert
proc insertId(self: SurrealQuery; items: seq[JsonNode]; key = "id"): Future[ seq[SurrealId]] {....raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc limit(self: SurrealQuery; num: int): SurrealQuery {....raises: [], tags: [].}
proc max(self: SurrealQuery; column: string; collaction: Collation = None): Future[ string] {....raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- = ORDER BY {column} {collaction} DESC LIMIT 1
proc min(self: SurrealQuery; column: string; collaction: Collation = None): Future[ string] {....raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- = ORDER BY {column} {collaction} ASC LIMIT 1
proc orderBy(self: SurrealQuery; column: string; collation: Collation; order: Order): SurrealQuery {....raises: [KeyError], tags: [].}
proc orderBy(self: SurrealQuery; column: string; order: Order): SurrealQuery {. ...raises: [KeyError], tags: [].}
proc orWhere(self: SurrealQuery; column: string; symbol: string; value: bool | int | float | string | SurrealId): SurrealQuery
proc orWhere(self: SurrealQuery; column: string; symbol: string; value: nil.type): SurrealQuery {. ...raises: [Exception, KeyError], tags: [].}
proc parallel(self: SurrealQuery): SurrealQuery {....raises: [], tags: [].}
proc start(self: SurrealQuery; num: int): SurrealQuery {....raises: [], tags: [].}
proc sum(self: SurrealQuery; column: string): Future[float] {. ...raises: [Exception, ValueError], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc table(self: SurrealQuery; tableArg: string): SurrealQuery {....raises: [], tags: [].}
proc update(self: SurrealConnections; id: SurrealId; items: JsonNode): owned( Future[void]) {....raises: [Exception], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- https://surrealdb.com/docs/surrealql/statements/update
proc update(self: SurrealQuery; items: JsonNode): owned(Future[void]) {. ...raises: [Exception], tags: [RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
- https://surrealdb.com/docs/surrealql/statements/update
proc where(self: SurrealQuery; column: string; symbol: string; value: bool | int | float | string | SurrealId): SurrealQuery
proc where(self: SurrealQuery; column: string; symbol: string; value: nil.type): SurrealQuery {. ...raises: [Exception, KeyError], tags: [].}
proc whereBetween(self: SurrealQuery; column: string; width: array[2, int | float]): SurrealQuery
-
rdb.table("user").whereBetween("index", [1, 3]).get()
SELECT * FROM user WHERE 1 <= index AND index <= 3
https://surrealdb.com/docs/surrealql/operators#lessthanorequal
proc whereIn(self: SurrealQuery; column: string; width: seq[int | float | string]): SurrealQuery
-
rdb.table("user").whereIn("index", [2, 3]).get()
SELECT * FROM user WHERE [2, 3] CONTAINS index
proc whereNotBetween(self: SurrealQuery; column: string; width: array[2, int | float]): SurrealQuery
-
rdb.table("user").whereNotBetween("index", [1, 3]).get()
SELECT * FROM user WHERE index > 1 AND 3 < index
proc whereNotIn(self: SurrealQuery; column: string; width: seq[int | float | string]): SurrealQuery
-
rdb.table("user").whereNotIn("index", [2, 3]).get()
SELECT * FROM user WHERE [2, 3] CONTAINSNOT index
proc whereNull(self: SurrealQuery; column: string): SurrealQuery {. ...raises: [KeyError], tags: [].}
- https://surrealdb.com/docs/surrealql/operators#equal
Templates
template seeder(rdb: SurrealConnections; tableName, column: string; body: untyped): untyped
- The seeder block allows the code in the block to work only when the table or specified column is empty.
template seeder(rdb: SurrealConnections; tableName: string; body: untyped): untyped
- The seeder block allows the code in the block to work only when the table is empty.