/
opt
/
canhelp
/
node_modules
/
drizzle-orm
/
pg-core
/
/opt/canhelp/node_modules/drizzle-orm/pg-core
mkdir
upload
Name
Size
Mode
Actions
columns/
-
0755
rm
query-builders/
-
0755
rm
utils/
-
0755
rm
alias.cjs
1214
0644
edit
dl
rm
alias.cjs.map
716
0644
edit
dl
rm
alias.d.cts
323
0644
edit
dl
rm
alias.d.ts
320
0644
edit
dl
rm
alias.js
211
0644
edit
dl
rm
alias.js.map
678
0644
edit
dl
rm
checks.cjs
1704
0644
edit
dl
rm
checks.cjs.map
1369
0644
edit
dl
rm
checks.d.cts
606
0644
edit
dl
rm
checks.d.ts
603
0644
edit
dl
rm
checks.js
612
0644
edit
dl
rm
checks.js.map
1319
0644
edit
dl
rm
db.cjs
11381
0644
edit
dl
rm
db.cjs.map
29120
0644
edit
dl
rm
db.d.cts
12140
0644
edit
dl
rm
db.d.ts
12122
0644
edit
dl
rm
db.js
9976
0644
edit
dl
rm
db.js.map
29159
0644
edit
dl
rm
dialect.cjs
47536
0644
edit
dl
rm
dialect.cjs.map
69768
0644
edit
dl
rm
dialect.d.cts
3371
0644
edit
dl
rm
dialect.d.ts
3360
0644
edit
dl
rm
dialect.js
43020
0644
edit
dl
rm
dialect.js.map
69749
0644
edit
dl
rm
expressions.cjs
2033
0644
edit
dl
rm
expressions.cjs.map
1471
0644
edit
dl
rm
expressions.d.cts
457
0644
edit
dl
rm
expressions.d.ts
454
0644
edit
dl
rm
expressions.js
604
0644
edit
dl
rm
expressions.js.map
1416
0644
edit
dl
rm
foreign-keys.cjs
3113
0644
edit
dl
rm
foreign-keys.cjs.map
4835
0644
edit
dl
rm
foreign-keys.d.cts
1766
0644
edit
dl
rm
foreign-keys.d.ts
1763
0644
edit
dl
rm
foreign-keys.js
1926
0644
edit
dl
rm
foreign-keys.js.map
4788
0644
edit
dl
rm
index.cjs
3221
0644
edit
dl
rm
index.cjs.map
1176
0644
edit
dl
rm
index.d.cts
683
0644
edit
dl
rm
index.d.ts
662
0644
edit
dl
rm
index.js
695
0644
edit
dl
rm
index.js.map
994
0644
edit
dl
rm
indexes.cjs
4427
0644
edit
dl
rm
indexes.cjs.map
8557
0644
edit
dl
rm
indexes.d.cts
4227
0644
edit
dl
rm
indexes.d.ts
4222
0644
edit
dl
rm
indexes.js
3105
0644
edit
dl
rm
indexes.js.map
8498
0644
edit
dl
rm
policies.cjs
1683
0644
edit
dl
rm
policies.cjs.map
1957
0644
edit
dl
rm
policies.d.cts
1030
0644
edit
dl
rm
policies.d.ts
1026
0644
edit
dl
rm
policies.js
623
0644
edit
dl
rm
policies.js.map
1913
0644
edit
dl
rm
primary-keys.cjs
2164
0644
edit
dl
rm
primary-keys.cjs.map
2647
0644
edit
dl
rm
primary-keys.d.cts
1112
0644
edit
dl
rm
primary-keys.d.ts
1109
0644
edit
dl
rm
primary-keys.js
1006
0644
edit
dl
rm
primary-keys.js.map
2599
0644
edit
dl
rm
roles.cjs
1658
0644
edit
dl
rm
roles.cjs.map
1439
0644
edit
dl
rm
roles.d.cts
429
0644
edit
dl
rm
roles.d.ts
428
0644
edit
dl
rm
roles.js
615
0644
edit
dl
rm
roles.js.map
1395
0644
edit
dl
rm
schema.cjs
2699
0644
edit
dl
rm
schema.cjs.map
2932
0644
edit
dl
rm
schema.d.cts
866
0644
edit
dl
rm
schema.d.ts
860
0644
edit
dl
rm
schema.js
1534
0644
edit
dl
rm
schema.js.map
2924
0644
edit
dl
rm
sequence.cjs
1788
0644
edit
dl
rm
sequence.cjs.map
1469
0644
edit
dl
rm
sequence.d.cts
757
0644
edit
dl
rm
sequence.d.ts
756
0644
edit
dl
rm
sequence.js
617
0644
edit
dl
rm
sequence.js.map
1417
0644
edit
dl
rm
session.cjs
3566
0644
edit
dl
rm
session.cjs.map
7560
0644
edit
dl
rm
session.d.cts
3347
0644
edit
dl
rm
session.d.ts
3339
0644
edit
dl
rm
session.js
2348
0644
edit
dl
rm
session.js.map
7523
0644
edit
dl
rm
subquery.cjs
784
0644
edit
dl
rm
subquery.cjs.map
1630
0644
edit
dl
rm
subquery.d.cts
1465
0644
edit
dl
rm
subquery.d.ts
1460
0644
edit
dl
rm
subquery.js
36
0644
edit
dl
rm
subquery.js.map
71
0644
edit
dl
rm
table.cjs
3699
0644
edit
dl
rm
table.cjs.map
9788
0644
edit
dl
rm
table.d.cts
4373
0644
edit
dl
rm
table.d.ts
4362
0644
edit
dl
rm
table.js
2398
0644
edit
dl
rm
table.js.map
9727
0644
edit
dl
rm
unique-constraint.cjs
2871
0644
edit
dl
rm
unique-constraint.cjs.map
3036
0644
edit
dl
rm
unique-constraint.d.cts
1045
0644
edit
dl
rm
unique-constraint.d.ts
1042
0644
edit
dl
rm
unique-constraint.js
1558
0644
edit
dl
rm
unique-constraint.js.map
2979
0644
edit
dl
rm
utils.cjs
3966
0644
edit
dl
rm
utils.cjs.map
4932
0644
edit
dl
rm
utils.d.cts
2222
0644
edit
dl
rm
utils.d.ts
2213
0644
edit
dl
rm
utils.js
2422
0644
edit
dl
rm
utils.js.map
4872
0644
edit
dl
rm
view-base.cjs
1271
0644
edit
dl
rm
view-base.cjs.map
750
0644
edit
dl
rm
view-base.d.cts
484
0644
edit
dl
rm
view-base.d.ts
482
0644
edit
dl
rm
view-base.js
215
0644
edit
dl
rm
view-base.js.map
714
0644
edit
dl
rm
view-common.cjs
1155
0644
edit
dl
rm
view-common.cjs.map
247
0644
edit
dl
rm
view-common.d.cts
50
0644
edit
dl
rm
view-common.d.ts
50
0644
edit
dl
rm
view-common.js
123
0644
edit
dl
rm
view-common.js.map
204
0644
edit
dl
rm
view.cjs
9339
0644
edit
dl
rm
view.cjs.map
19028
0644
edit
dl
rm
view.d.cts
7548
0644
edit
dl
rm
view.d.ts
7538
0644
edit
dl
rm
view.js
7142
0644
edit
dl
rm
view.js.map
18933
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/drizzle-orm/pg-core/db.d.cts
(12140B)
import { entityKind } from "../entity.cjs"; import type { PgDialect } from "./dialect.cjs"; import { PgDeleteBase, PgInsertBuilder, PgSelectBuilder, PgUpdateBuilder } from "./query-builders/index.cjs"; import type { PgQueryResultHKT, PgQueryResultKind, PgSession, PgTransaction, PgTransactionConfig } from "./session.cjs"; import type { PgTable } from "./table.cjs"; import type { ExtractTablesWithRelations, RelationalSchemaConfig, TablesRelationalConfig } from "../relations.cjs"; import { type SQL, type SQLWrapper } from "../sql/sql.cjs"; import { WithSubquery } from "../subquery.cjs"; import type { DrizzleTypeError, NeonAuthToken } from "../utils.cjs"; import type { PgColumn } from "./columns/index.cjs"; import { PgCountBuilder } from "./query-builders/count.cjs"; import { RelationalQueryBuilder } from "./query-builders/query.cjs"; import { PgRaw } from "./query-builders/raw.cjs"; import { PgRefreshMaterializedView } from "./query-builders/refresh-materialized-view.cjs"; import type { SelectedFields } from "./query-builders/select.types.cjs"; import type { WithBuilder } from "./subquery.cjs"; import type { PgViewBase } from "./view-base.cjs"; import type { PgMaterializedView } from "./view.cjs"; export declare class PgDatabase<TQueryResult extends PgQueryResultHKT, TFullSchema extends Record<string, unknown> = Record<string, never>, TSchema extends TablesRelationalConfig = ExtractTablesWithRelations<TFullSchema>> { static readonly [entityKind]: string; readonly _: { readonly schema: TSchema | undefined; readonly fullSchema: TFullSchema; readonly tableNamesMap: Record<string, string>; readonly session: PgSession<TQueryResult, TFullSchema, TSchema>; }; query: TFullSchema extends Record<string, never> ? DrizzleTypeError<'Seems like the schema generic is missing - did you forget to add it to your DB type?'> : { [K in keyof TSchema]: RelationalQueryBuilder<TSchema, TSchema[K]>; }; constructor( /** @internal */ dialect: PgDialect, /** @internal */ session: PgSession<any, any, any>, schema: RelationalSchemaConfig<TSchema> | undefined); /** * Creates a subquery that defines a temporary named result set as a CTE. * * It is useful for breaking down complex queries into simpler parts and for reusing the result set in subsequent parts of the query. * * See docs: {@link https://orm.drizzle.team/docs/select#with-clause} * * @param alias The alias for the subquery. * * Failure to provide an alias will result in a DrizzleTypeError, preventing the subquery from being referenced in other queries. * * @example * * ```ts * // Create a subquery with alias 'sq' and use it in the select query * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42))); * * const result = await db.with(sq).select().from(sq); * ``` * * To select arbitrary SQL values as fields in a CTE and reference them in other CTEs or in the main query, you need to add aliases to them: * * ```ts * // Select an arbitrary SQL value as a field in a CTE and reference it in the main query * const sq = db.$with('sq').as(db.select({ * name: sql<string>`upper(${users.name})`.as('name'), * }) * .from(users)); * * const result = await db.with(sq).select({ name: sq.name }).from(sq); * ``` */ $with: WithBuilder; $count(source: PgTable | PgViewBase | SQL | SQLWrapper, filters?: SQL<unknown>): PgCountBuilder<PgSession<any, any, any>>; /** * Incorporates a previously defined CTE (using `$with`) into the main query. * * This method allows the main query to reference a temporary named result set. * * See docs: {@link https://orm.drizzle.team/docs/select#with-clause} * * @param queries The CTEs to incorporate into the main query. * * @example * * ```ts * // Define a subquery 'sq' as a CTE using $with * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42))); * * // Incorporate the CTE 'sq' into the main query and select from it * const result = await db.with(sq).select().from(sq); * ``` */ with(...queries: WithSubquery[]): { select: { (): PgSelectBuilder<undefined>; <TSelection extends SelectedFields>(fields: TSelection): PgSelectBuilder<TSelection>; }; selectDistinct: { (): PgSelectBuilder<undefined>; <TSelection extends SelectedFields>(fields: TSelection): PgSelectBuilder<TSelection>; }; selectDistinctOn: { (on: (PgColumn | SQLWrapper)[]): PgSelectBuilder<undefined>; <TSelection extends SelectedFields>(on: (PgColumn | SQLWrapper)[], fields: TSelection): PgSelectBuilder<TSelection>; }; update: <TTable extends PgTable>(table: TTable) => PgUpdateBuilder<TTable, TQueryResult>; insert: <TTable extends PgTable>(table: TTable) => PgInsertBuilder<TTable, TQueryResult>; delete: <TTable extends PgTable>(table: TTable) => PgDeleteBase<TTable, TQueryResult>; }; /** * Creates a select query. * * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select. * * Use `.from()` method to specify which table to select from. * * See docs: {@link https://orm.drizzle.team/docs/select} * * @param fields The selection object. * * @example * * ```ts * // Select all columns and all rows from the 'cars' table * const allCars: Car[] = await db.select().from(cars); * * // Select specific columns and all rows from the 'cars' table * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({ * id: cars.id, * brand: cars.brand * }) * .from(cars); * ``` * * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns: * * ```ts * // Select specific columns along with expression and all rows from the 'cars' table * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({ * id: cars.id, * lowerBrand: sql<string>`lower(${cars.brand})`, * }) * .from(cars); * ``` */ select(): PgSelectBuilder<undefined>; select<TSelection extends SelectedFields>(fields: TSelection): PgSelectBuilder<TSelection>; /** * Adds `distinct` expression to the select query. * * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns. * * Use `.from()` method to specify which table to select from. * * See docs: {@link https://orm.drizzle.team/docs/select#distinct} * * @param fields The selection object. * * @example * ```ts * // Select all unique rows from the 'cars' table * await db.selectDistinct() * .from(cars) * .orderBy(cars.id, cars.brand, cars.color); * * // Select all unique brands from the 'cars' table * await db.selectDistinct({ brand: cars.brand }) * .from(cars) * .orderBy(cars.brand); * ``` */ selectDistinct(): PgSelectBuilder<undefined>; selectDistinct<TSelection extends SelectedFields>(fields: TSelection): PgSelectBuilder<TSelection>; /** * Adds `distinct on` expression to the select query. * * Calling this method will specify how the unique rows are determined. * * Use `.from()` method to specify which table to select from. * * See docs: {@link https://orm.drizzle.team/docs/select#distinct} * * @param on The expression defining uniqueness. * @param fields The selection object. * * @example * ```ts * // Select the first row for each unique brand from the 'cars' table * await db.selectDistinctOn([cars.brand]) * .from(cars) * .orderBy(cars.brand); * * // Selects the first occurrence of each unique car brand along with its color from the 'cars' table * await db.selectDistinctOn([cars.brand], { brand: cars.brand, color: cars.color }) * .from(cars) * .orderBy(cars.brand, cars.color); * ``` */ selectDistinctOn(on: (PgColumn | SQLWrapper)[]): PgSelectBuilder<undefined>; selectDistinctOn<TSelection extends SelectedFields>(on: (PgColumn | SQLWrapper)[], fields: TSelection): PgSelectBuilder<TSelection>; /** * Creates an update query. * * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated. * * Use `.set()` method to specify which values to update. * * See docs: {@link https://orm.drizzle.team/docs/update} * * @param table The table to update. * * @example * * ```ts * // Update all rows in the 'cars' table * await db.update(cars).set({ color: 'red' }); * * // Update rows with filters and conditions * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW')); * * // Update with returning clause * const updatedCar: Car[] = await db.update(cars) * .set({ color: 'red' }) * .where(eq(cars.id, 1)) * .returning(); * ``` */ update<TTable extends PgTable>(table: TTable): PgUpdateBuilder<TTable, TQueryResult>; /** * Creates an insert query. * * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert. * * See docs: {@link https://orm.drizzle.team/docs/insert} * * @param table The table to insert into. * * @example * * ```ts * // Insert one row * await db.insert(cars).values({ brand: 'BMW' }); * * // Insert multiple rows * await db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]); * * // Insert with returning clause * const insertedCar: Car[] = await db.insert(cars) * .values({ brand: 'BMW' }) * .returning(); * ``` */ insert<TTable extends PgTable>(table: TTable): PgInsertBuilder<TTable, TQueryResult>; /** * Creates a delete query. * * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted. * * See docs: {@link https://orm.drizzle.team/docs/delete} * * @param table The table to delete from. * * @example * * ```ts * // Delete all rows in the 'cars' table * await db.delete(cars); * * // Delete rows with filters and conditions * await db.delete(cars).where(eq(cars.color, 'green')); * * // Delete with returning clause * const deletedCar: Car[] = await db.delete(cars) * .where(eq(cars.id, 1)) * .returning(); * ``` */ delete<TTable extends PgTable>(table: TTable): PgDeleteBase<TTable, TQueryResult>; refreshMaterializedView<TView extends PgMaterializedView>(view: TView): PgRefreshMaterializedView<TQueryResult>; protected authToken?: NeonAuthToken; execute<TRow extends Record<string, unknown> = Record<string, unknown>>(query: SQLWrapper | string): PgRaw<PgQueryResultKind<TQueryResult, TRow>>; transaction<T>(transaction: (tx: PgTransaction<TQueryResult, TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig): Promise<T>; } export type PgWithReplicas<Q> = Q & { $primary: Q; }; export declare const withReplicas: <HKT extends PgQueryResultHKT, TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig, Q extends PgDatabase<HKT, TFullSchema, TSchema extends Record<string, unknown> ? ExtractTablesWithRelations<TFullSchema> : TSchema>>(primary: Q, replicas: [Q, ...Q[]], getReplica?: (replicas: Q[]) => Q) => PgWithReplicas<Q>;
Save
cmd:
run