# src/allographer/query_builder/models/surreal/surreal_types

Theme:

- Index

Search:
Group by:

created by `let rdb = dbOpen(SurrealDB, "ns", "database", "user", "pass", "http://surreal", 8000)`

# Imports

../../log, ../../libs/surreal/surreal_rdb, ../../error

# Types

    Connection = object
      conn*: SurrealConn
      isBusy*: bool
      createdAt*: int64

    Connections = ref object
      conns*: seq[Connection]
      timeout*: int              ## `getFreeConn` が接続を待つときに積む Future。`returnConn` が先頭から 1 件だけ完了させる。
      waiters*: Deque[Future[void]]

    RawSurrealQuery = ref object
      log*: LogSetting
      pools*: Connections
      query*: JsonNode
      queryString*: string
      placeHolder*: JsonNode

    SurrealConnections = ref object
      log*: LogSetting
      pools*: Connections

    SurrealDB = object

    SurrealId = object
      table*: string

    SurrealQuery = ref object
      log*: LogSetting
      pools*: Connections
      query*: JsonNode
      queryString*: string
      placeHolder*: JsonNode

  created by `rdb.select("columnName")` or `rdb.table("tableName")`

# Procs

    proc `$`(self: SurrealConnections | SurrealQuery | RawSurrealQuery): string

    proc `$`(self: SurrealId): string {....raises: [], tags: [], forbids: [].}

    proc `%`(self: SurrealId): JsonNode {....raises: [], tags: [], forbids: [].}

    proc new(_: type SurrealId): SurrealId

  create empty surreal id

    proc new(_: type SurrealId; rawId: string): SurrealId

      let rawId = "user:z7cr4mz474h4ab7rcd6d"
      let surrealId = SureealId.new(rawId)

    proc new(_: type SurrealId; table, id: string): SurrealId

      let rawId = "user:z7cr4mz474h4ab7rcd6d"
      let table = "user"
      let id = "z7cr4mz474h4ab7rcd6d"
      let surrealId = SureealId.new(table, id)

    proc new(_: type SurrealQuery; log: LogSetting; pools: Connections;
             query: JsonNode): SurrealQuery

    proc rawId(self: SurrealId): string {....raises: [], tags: [], forbids: [].}

      let rawId = "user:z7cr4mz474h4ab7rcd6d"
      let surrealId = SureealId.new(rawId)
      surrealId.rawId() == "user:z7cr4mz474h4ab7rcd6d"