# src/allographer/query_builder/models/postgres/postgres_types

Theme:

- Index

Search:
Group by:

created by `let rdb = dbOpen(PostgreSQL, "localhost", 5432)`created by `rdb.select("columnName")` or `rdb.table("tableName")`

# Imports

../database_types, ../../log, ../../libs/postgres/postgres_rdb

# Types

    Connection = ref object
      conn*: PPGconn
      isBusy*: bool
      createdAt*: int64

    Connections = ref object
      conns*: seq[Connection]
      timeout*: int              ## `getFreeConn` が接続を待つときに積む Future。`returnConn` が先頭から 1 件だけ完了させる。
      waiters*: Deque[Future[void]] ## `exec` / `insertId` 用。テーブルごとに information_schema 相当の列型を初回のみ取得して保持する。
      columnTypeCache*: Table[string, seq[Row]]

    PostgresConnections = ref object
      log*: LogSetting
      pools*: Connections
      isInTransaction*: bool
      transactionConn*: int

    PostgreSQL = object

    PostgresQuery = ref object
      log*: LogSetting
      pools*: Connections
      query*: JsonNode
      queryString*: string
      placeHolder*: JsonNode
      isInTransaction*: bool
      transactionConn*: int

    RawPostgresQuery = ref object
      log*: LogSetting
      pools*: Connections
      query*: JsonNode
      queryString*: string
      placeHolder*: JsonNode
      isInTransaction*: bool
      transactionConn*: int

# Procs

    proc `$`(self: PostgresConnections | PostgresQuery | RawPostgresQuery): string

    proc isConnected(self: PostgresConnections | PostgresQuery | RawPostgresQuery): bool