Module

x/pg_mem/interfaces-private.ts>_ITable

An in memory postgres DB instance for your unit tests
Go to Latest
interface _ITable
import { type _ITable } from "https://dotland.deno.dev/x/pg_mem@2.6.3/interfaces-private.ts";

Type Parameters

optional
T = any

Properties

readonly
type: "table"
readonly
hidden: boolean
readonly
db: _IDb
readonly
selection: _ISelection<T>
readonly
ownerSchema: _ISchema

Methods

doInsert(
toInsert: T,
opts?: ChangeOpts,
): T
setHidden(): this
setReadonly(): this
delete(t: _Transaction, toDelete: T): void
update(t: _Transaction, toUpdate: T): T
createIndex(t: _Transaction, expressions: CreateIndexDef): _IConstraint | nil
createIndex(
expressions: Name[],
type: "primary" | "unique",
indexName?: string,
): _IConstraint
setReadonly(): this

Create a column

getColumnRef(column: string): _Column

Get a column to modify it

getColumnRef(column: string, nullIfNotFound?: boolean): _Column | nil
rename(to: string): this
getConstraint(constraint: string): _IConstraint | nil
addConstraint(constraint: TableConstraint, t: _Transaction): _IConstraint | nil
getIndex(...forValues: IValue[]): _IIndex | nil
dropIndex(t: _Transaction, name: string): void
drop(t: _Transaction, cascade: boolean): void
onBeforeChange(columns: (string | _Column)[], check: ChangeHandler<T>): ISubscription

Will be executed when one of the given columns is affected (update/delete)

onCheckChange(columns: "all" | (string | _Column)[], check: ChangeHandler<T>): ISubscription

Will be executed once all 'onBeforeChange' handlers have ran (coherency checks)

onTruncate(sub: TruncateHandler): ISubscription
truncate(t: _Transaction, truncateOpts?: TruncateOpts): void