# src/allographer/query_builder/models/postgres/postgres_exec

Theme:

- Index

Search:
Group by:

# Imports

../../libs/postgres/postgres_lib, ../../libs/postgres/postgres_impl, ../../log, ../database_types, query/postgres_builder, postgres_types

# Procs

    proc avg(self: PostgresQuery; column: string): Future[Option[float]] {.
        ...stackTrace: false, raises: [Exception, ValueError, KeyError, OSError,
                                    IOError, DbError, JsonParsingError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc begin(self: PostgresConnections): owned(Future[void]) {....stackTrace: false,
        raises: [Exception, OSError, IOError, ValueError, KeyError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc columns(self: PostgresQuery): Future[seq[string]] {....stackTrace: false,
        raises: [Exception, ValueError, KeyError, IOError, OSError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

  get columns sequence from table

    proc commit(self: PostgresConnections): owned(Future[void]) {....stackTrace: false,
        raises: [Exception, OSError, IOError, KeyError, DbError, ValueError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc count(self: PostgresQuery): Future[int] {....stackTrace: false, raises: [
        Exception, ValueError, KeyError, OSError, IOError, DbError, JsonParsingError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc delete(self: PostgresQuery): owned(Future[void]) {....stackTrace: false,
        raises: [Exception, KeyError, OSError, IOError, ValueError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc delete(self: PostgresQuery; id: int; key = "id"): owned(Future[void]) {.
        ...stackTrace: false,
        raises: [Exception, KeyError, OSError, IOError, ValueError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc exec(self: RawPostgresQuery): owned(Future[void]) {....stackTrace: false,
        raises: [Exception, OSError, IOError, ValueError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

  It is only used with raw()

    proc find(self: PostgresQuery; id: int; key = "id"): Future[Option[JsonNode]] {.
        ...stackTrace: false,
        raises: [Exception, ValueError, KeyError, IOError, OSError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc find(self: PostgresQuery; id: string; key = "id"): Future[Option[JsonNode]] {.
        ...stackTrace: false,
        raises: [Exception, ValueError, KeyError, IOError, OSError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc findPlain(self: PostgresQuery; id: int; key = "id"): Future[seq[string]] {.
        ...stackTrace: false,
        raises: [Exception, ValueError, KeyError, IOError, OSError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc findPlain(self: PostgresQuery; id: string; key = "id"): Future[seq[string]] {.
        ...stackTrace: false,
        raises: [Exception, ValueError, KeyError, IOError, OSError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc first(self: PostgresQuery): Future[Option[JsonNode]] {....stackTrace: false,
        raises: [Exception, ValueError, KeyError, IOError, OSError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc first(self: RawPostgresQuery): Future[Option[JsonNode]] {.
        ...stackTrace: false, raises: [Exception, ValueError, OSError, IOError,
                                    DbError, JsonParsingError], tags: [RootEffect,
        WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect, TimeEffect],
        forbids: [].}

  It is only used with raw()

    proc firstPlain(self: PostgresQuery): Future[seq[string]] {....stackTrace: false,
        raises: [Exception, ValueError, KeyError, IOError, OSError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc firstPlain(self: RawPostgresQuery): Future[seq[string]] {.
        ...stackTrace: false,
        raises: [Exception, ValueError, OSError, IOError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

  It is only used with raw()

    proc get(self: PostgresQuery): Future[seq[JsonNode]] {....stackTrace: false,
        raises: [Exception, ValueError, KeyError, IOError, OSError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc get(self: RawPostgresQuery): Future[seq[JsonNode]] {....stackTrace: false, raises: [
        Exception, ValueError, OSError, IOError, DbError, JsonParsingError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

  It is only used with raw()

    proc getPlain(self: PostgresQuery): Future[seq[seq[string]]] {.
        ...stackTrace: false,
        raises: [Exception, ValueError, KeyError, IOError, OSError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc getPlain(self: RawPostgresQuery): Future[seq[seq[string]]] {.
        ...stackTrace: false,
        raises: [Exception, ValueError, OSError, IOError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

  It is only used with raw()

    proc insert(self: PostgresQuery; items: JsonNode): owned(Future[void]) {.
        ...stackTrace: false,
        raises: [Exception, KeyError, OSError, IOError, ValueError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

  items is `JObject`

    proc insert(self: PostgresQuery; items: seq[JsonNode]): owned(Future[void]) {.
        ...stackTrace: false,
        raises: [Exception, KeyError, OSError, IOError, ValueError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc insert[T](self: PostgresQuery; items: seq[T]): owned(Future[void]) {.
        ...stackTrace: false.}

    proc insert[T](self: PostgresQuery; items: T): owned(Future[void]) {.
        ...stackTrace: false.}

    proc insertId(self: PostgresQuery; items: JsonNode; key = "id"): Future[string] {.
        ...stackTrace: false,
        raises: [Exception, ValueError, KeyError, OSError, IOError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc insertId(self: PostgresQuery; items: seq[JsonNode]; key = "id"): Future[
        seq[string]] {....stackTrace: false, raises: [Exception, ValueError, KeyError,
        OSError, IOError, DbError], tags: [RootEffect, WriteDirEffect,
                                           ReadDirEffect, ReadIOEffect,
                                           WriteIOEffect, TimeEffect], forbids: [].}

    proc insertId[T](self: PostgresQuery; items: seq[T]; key = "id"): Future[
        seq[string]] {....stackTrace: false.}

    proc insertId[T](self: PostgresQuery; items: T; key = "id"): Future[string] {.
        ...stackTrace: false.}

    proc max(self: PostgresQuery; column: string): Future[Option[string]] {.
        ...stackTrace: false, raises: [Exception, ValueError, KeyError, OSError,
                                    IOError, DbError, JsonParsingError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc min(self: PostgresQuery; column: string): Future[Option[string]] {.
        ...stackTrace: false, raises: [Exception, ValueError, KeyError, OSError,
                                    IOError, DbError, JsonParsingError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc rollback(self: PostgresConnections): owned(Future[void]) {.
        ...stackTrace: false,
        raises: [Exception, OSError, IOError, KeyError, DbError, ValueError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc sum(self: PostgresQuery; column: string): Future[Option[float]] {.
        ...stackTrace: false, raises: [Exception, ValueError, KeyError, OSError,
                                    IOError, DbError, JsonParsingError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc update(self: PostgresQuery; items: JsonNode): owned(Future[void]) {.
        ...stackTrace: false,
        raises: [Exception, KeyError, OSError, IOError, ValueError, DbError], tags: [
        RootEffect, WriteDirEffect, ReadDirEffect, ReadIOEffect, WriteIOEffect,
        TimeEffect], forbids: [].}

    proc update[T](self: PostgresQuery; items: T): owned(Future[void]) {.
        ...stackTrace: false.}

# Templates

    template seeder(rdb: PostgresConnections; 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: PostgresConnections; tableName: string; body: untyped): untyped

  The `seeder` block allows the code in the block to work only when the table is empty.