Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/pg_mem/table.ts>MemoryTable

An in memory postgres DB instance for your unit tests
Latest
class MemoryTable
implements IMemoryTable<any>, _ITable
import { MemoryTable } from "https://deno.land/x/pg_mem@3.0.3/table.ts";

Constructors

new
MemoryTable(
schema: _ISchema,
_schema: Schema,
)

Properties

private
optional
_reg: Reg
private
changeHandlers: Map<_Column | null, ChangeSub>
private
constraintsByName: Map<string, _IConstraint>
private
cstGen: number
private
dataId: symbol
private
drophandlers: Set<DropHandler>
private
handlers: Map<TableEvent, Set<() => void>>
private
hasPrimary: BIndex | null
private
indexByHashAndName: Map<string, Map<string, { index: BIndex; expressions: IValue[]; }>>
private
indexHandlers: Set<IndexHandler>
private
it: number
private
readonly: boolean
private
serialsId: symbol
private
truncateHandlers: Set<TruncateHandler>
readonly
columnMgr: ColumnManager
readonly
columns
readonly
debugId
hidden: boolean
readonly
isExecutionWithNoResult: boolean
name: string
readonly
primaryIndex: IndexDef | null
readonly
reg: Reg
readonly
selection: Alias
readonly
type

Methods

private
_subChange(
key: keyof ChangeSub,
columns: "all" | (string | _Column)[],
): ISubscription
private
changePlan(
old: Row | null,
neu: Row | null,
_opts: ChangeOpts | nil,
): ChangePlan
private
checkNoConstraint(name: string)
private
determineIndexRelName(
indexName: string | nil,
ihash: string,
ifNotExists: boolean | nil,
sufix: string,
): string | nil
private
indexElt(t: _Transaction, toInsert: Row)
addCheck(
check: Expr,
constraintName?: string,
): _IConstraint
constraintNameGen(constraintName?: string)
createIndex(
expressions: Name[],
type: "primary" | "unique",
indexName?: string | nil,
): _IConstraint
delete(t: _Transaction, toDelete: Row)
doInsert(
toInsert: Row,
opts?: ChangeOpts,
): Row | null
drop(t: _Transaction, cascade: boolean)
dropIndex(t: _Transaction, uName: string)
enumerate(t: _Transaction): Iterable<Row>
find(template?: Row, columns?: (keyof Row)[]): Row[]
getColumn(column: string | ExprRef): IValue
getColumn(column: string | ExprRef, nullIfNotFound?: boolean): IValue | nil
getColumnRef(column: string): ColRef
getColumnRef(column: string, nullIfNotFound?: boolean): ColRef | nil
getColumns(): Iterable<ColumnDef>
getConstraint(constraint: string): _IConstraint | nil
getIndex(...forValues: IValue[]): _IIndex | nil
insert(toInsert: Row): Row | null
isOriginOf(a: IValue): boolean
on(event: TableEvent, handler: () => any): ISubscription
onBeforeChange(columns: "all" | (string | _Column)[], check: ChangeHandler): ISubscription
onCheckChange(columns: string[], check: ChangeHandler): ISubscription
remapData(t: _Transaction, modify: (newCopy: Row) => any)
rename(name: string)
setBin(t: _Transaction, val: Raw)
update(t: _Transaction, toUpdate: Row): Row