/opt/canhelp/node_modules/drizzle-orm
Edit: /opt/canhelp/node_modules/drizzle-orm/table.d.cts (3855B)
import type { Column, GetColumnData } from "./column.cjs";
import { entityKind } from "./entity.cjs";
import type { OptionalKeyOnly, RequiredKeyOnly } from "./operations.cjs";
import type { SQLWrapper } from "./sql/sql.cjs";
import type { Simplify, Update } from "./utils.cjs";
export interface TableConfig
> {
name: string;
schema: string | undefined;
columns: Record;
dialect: string;
}
export type UpdateTableConfig> = Required>;
export interface Table extends SQLWrapper {
}
export declare class Table implements SQLWrapper {
static readonly [entityKind]: string;
readonly _: {
readonly brand: 'Table';
readonly config: T;
readonly name: T['name'];
readonly schema: T['schema'];
readonly columns: T['columns'];
readonly inferSelect: InferSelectModel>;
readonly inferInsert: InferInsertModel>;
};
readonly $inferSelect: InferSelectModel>;
readonly $inferInsert: InferInsertModel>;
constructor(name: string, schema: string | undefined, baseName: string);
}
export declare function isTable(table: unknown): table is Table;
/**
* Any table with a specified boundary.
*
* @example
```ts
// Any table with a specific name
type AnyUsersTable = AnyTable<{ name: 'users' }>;
```
*
* To describe any table with any config, simply use `Table` without any type arguments, like this:
*
```ts
function needsTable(table: Table) {
...
}
```
*/
export type AnyTable> = Table>;
export declare function getTableName(table: T): T['_']['name'];
export declare function getTableUniqueName(table: T): `${T['_']['schema']}.${T['_']['name']}`;
export type MapColumnName = TDBColumNames extends true ? TColumn['_']['name'] : TName;
export type InferModelFromColumns, TInferMode extends 'select' | 'insert' = 'select', TConfig extends {
dbColumnNames: boolean;
override?: boolean;
} = {
dbColumnNames: false;
override: false;
}> = Simplify, TColumns[Key]>]: GetColumnData;
} & {
[Key in keyof TColumns & string as OptionalKeyOnly, TColumns[Key], TConfig['override']>]?: GetColumnData | undefined;
} : {
[Key in keyof TColumns & string as MapColumnName]: GetColumnData;
}>;
/** @deprecated Use one of the alternatives: {@link InferSelectModel} / {@link InferInsertModel}, or `table.$inferSelect` / `table.$inferInsert`
*/
export type InferModel = InferModelFromColumns;
export type InferSelectModel = InferModelFromColumns;
export type InferInsertModel = InferModelFromColumns;