pqb 0.15.0 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as orchid_core from 'orchid-core';
2
- import { QueryResultRow, AdapterBase, QueryInput, Sql, ColumnTypesBase, ColumnShapeOutput, DefaultSelectColumns, DbBase, QueryThen, QueryCatch, TransactionState, SQLQueryArgs, QueryBaseCommon, ColumnsShapeBase, QueryInternal, QueryMetaBase, EmptyObject, Expression, ColumnTypeBase, MaybeArray, TemplateLiteralArgs, ColumnsParsers, getValueKey, StringKey, NullableColumn, EmptyTuple, SetOptional, MergeObjects, RawSQLBase, RawSQLValues, RawSQLArgs, Spread, ColumnOperatorBase, ColumnOperatorFnBase, Code, ArrayMethodsData, arrayMethods, JSONTypeAny, record, BaseStringData, PrimaryKeyColumn, ForeignKeyTable, name, ColumnNameOfTable, BaseNumberData, ColumnWithDefault, numberTypeMethods, DateTypeMethods, DateColumnData, EncodeColumn, ParseColumn, ColumnDataBase, ValidationContext, MessageParam } from 'orchid-core';
2
+ import { QueryResultRow, AdapterBase, QueryInput, Sql, ColumnTypesBase, ColumnShapeOutput, DefaultSelectColumns, DbBase, QueryThen, QueryCatch, TransactionState, SQLQueryArgs, QueryBaseCommon, ColumnsShapeBase, QueryInternal, QueryMetaBase, EmptyObject, Expression, ColumnTypeBase, MaybeArray, TemplateLiteralArgs, ColumnsParsers, getValueKey, StringKey, NullableColumn, EmptyTuple, SetOptional, MergeObjects, RawSQLBase, RawSQLValues, RawSQLArgs, Spread, ColumnOperatorBase, ColumnOperatorFnBase, Code, ArrayMethodsData, arrayMethods, JSONTypeAny, record, BaseStringData, PrimaryKeyColumn, ForeignKeyTable, name, ColumnNameOfTable, BaseNumberData, ColumnWithDefault, numberTypeMethods, DateTypeMethods, DateColumnData, EncodeColumn, ParseColumn, ValidationContext, MessageParam, ColumnDataBase } from 'orchid-core';
3
3
  import { PoolConfig, Pool, PoolClient } from 'pg';
4
4
  import { inspect } from 'util';
5
5
  import { AsyncLocalStorage } from 'node:async_hooks';
@@ -123,6 +123,7 @@ type DbTableOptions = {
123
123
  autoPreparedStatements?: boolean;
124
124
  noPrimaryKey?: NoPrimaryKeyOption;
125
125
  snakeCase?: boolean;
126
+ language?: string;
126
127
  } & QueryLogOptions;
127
128
  declare const anyShape: Record<string, ColumnType<unknown, BaseOperators, unknown>>;
128
129
  interface Db<Table extends string | undefined = undefined, Shape extends ColumnsShape = Record<string, never>, Relations extends Query['relations'] = Query['relations'], CT extends ColumnTypesBase = DefaultColumnTypes, Data = Pick<ColumnShapeOutput<Shape>, DefaultSelectColumns<Shape>[number]>[]> extends DbBase<Adapter, Table, Shape, CT>, QueryMethods<CT> {
@@ -403,6 +404,38 @@ type JsonItem<As extends string = string, Type extends ColumnTypeBase = ColumnTy
403
404
  type SelectItem = string | RelationQuery | {
404
405
  selectAs: Record<string, string | Query | Expression>;
405
406
  } | JsonItem | Expression;
407
+ type OrderTsQueryConfig = true | {
408
+ coverDensity?: boolean;
409
+ weights?: number[];
410
+ normalization?: number;
411
+ dir?: SortDir;
412
+ };
413
+ type QuerySourceItem = {
414
+ queryAs: string;
415
+ as?: string;
416
+ textSQL?: MaybeArray<string>;
417
+ langSQL?: string;
418
+ vectorSQL?: string;
419
+ order?: OrderTsQueryConfig;
420
+ } & ({
421
+ language?: string;
422
+ } | {
423
+ languageColumn: string;
424
+ }) & ({
425
+ text: string | Expression;
426
+ } | {
427
+ in: MaybeArray<string> | Record<string, SearchWeight>;
428
+ } | {
429
+ vector: string;
430
+ }) & ({
431
+ query: string | Expression;
432
+ } | {
433
+ plainQuery: string | Expression;
434
+ } | {
435
+ phraseQuery: string | Expression;
436
+ } | {
437
+ tsQuery: string | Expression;
438
+ });
406
439
  type JoinItem = SimpleJoinItem | JoinLateralItem;
407
440
  type SimpleJoinItem = {
408
441
  type: string;
@@ -429,6 +462,7 @@ type WhereItem = (Omit<Record<string, unknown | Record<string, unknown | Query |
429
462
  IN?: MaybeArray<WhereInItem>;
430
463
  EXISTS?: MaybeArray<SimpleJoinItem['args']>;
431
464
  ON?: WhereOnItem | WhereJsonPathEqualsItem;
465
+ SEARCH?: MaybeArray<WhereSearchItem>;
432
466
  }) | ((q: unknown) => QueryBase) | Query | Expression;
433
467
  type WhereInItem = {
434
468
  columns: string[];
@@ -451,6 +485,11 @@ type WhereOnJoinItem = {
451
485
  as?: string;
452
486
  };
453
487
  } | string;
488
+ type SearchWeight = 'A' | 'B' | 'C' | 'D';
489
+ type WhereSearchItem = {
490
+ as: string;
491
+ vectorSQL: string;
492
+ };
454
493
  type SortDir = 'ASC' | 'DESC' | 'ASC NULLS FIRST' | 'DESC NULLS LAST';
455
494
  type OrderItem = string | Record<string, SortDir> | Expression;
456
495
  type ColumnOperators<S extends SelectableBase, Column extends keyof S> = {
@@ -494,6 +533,7 @@ type CommonQueryData = {
494
533
  select?: SelectItem[];
495
534
  as?: string;
496
535
  from?: string | Query | Expression;
536
+ sources?: Record<string, QuerySourceItem>;
497
537
  and?: WhereItem[];
498
538
  or?: WhereItem[][];
499
539
  coalesceValue?: unknown | Expression;
@@ -519,6 +559,7 @@ type CommonQueryData = {
519
559
  autoPreparedStatements?: boolean;
520
560
  [toSqlCacheKey]?: Sql;
521
561
  transform?: ((input: unknown) => unknown)[];
562
+ language?: string;
522
563
  };
523
564
  type SelectQueryData = CommonQueryData & {
524
565
  type: undefined;
@@ -665,16 +706,19 @@ declare class FnExpression<Q extends Query, T extends ColumnTypeBase> extends Ex
665
706
  })[];
666
707
  options: AggregateOptions<Q>;
667
708
  _type: T;
709
+ _mods: unknown[];
668
710
  constructor(q: Q, fn: string, args: (SelectableOrExpression<Q> | {
669
711
  pairs: Record<string, SelectableOrExpression<Q>>;
670
712
  } | {
671
713
  value: unknown;
672
714
  })[], options: AggregateOptions<Q>, _type: T);
715
+ modifySQL(sql: string, ctx: ToSqlCtx, quotedAs?: string): string;
673
716
  toSQL(ctx: ToSqlCtx, quotedAs?: string): string;
674
717
  }
675
718
  type ColumnExpression<C extends ColumnTypeBase, Ops extends BaseOperators = C['operators']> = Expression<C> & {
676
719
  [K in keyof Ops]: (arg: Parameters<Ops[K]>[1]) => ColumnExpression<BooleanNullable>;
677
720
  };
721
+ declare const makeColumnFnClass: <T extends ColumnType<unknown, BaseOperators, unknown>>(column: T) => typeof FnExpression;
678
722
  type FnExpressionArg<Q extends Query> = SelectableOrExpression<Q> | {
679
723
  pairs: Record<string, SelectableOrExpression<Q>>;
680
724
  } | {
@@ -691,7 +735,6 @@ type NullableJSONObject<T extends Query, Obj extends Record<string, SelectableOr
691
735
  }>>;
692
736
  type NullableText = NullableColumn<TextColumn>;
693
737
  declare class SelectAggMethods<T extends Query = Query> {
694
- _qbFor: Query;
695
738
  /**
696
739
  * `fn` allows to call an arbitrary SQL function.
697
740
  *
@@ -1464,16 +1507,315 @@ declare class OnQueryBuilder<S extends QueryBase = QueryBase, J extends QueryBas
1464
1507
  _onJsonPathEquals<T extends OnQueryBuilder>(this: T, ...args: OnJsonPathEqualsArgs<T>): T;
1465
1508
  }
1466
1509
 
1467
- type WhereArg<T extends QueryBase> = (Omit<{
1468
- [K in keyof T['selectable']]?: T['selectable'][K]['column']['type'] | null | ColumnOperators<T['selectable'], K> | Expression;
1469
- }, 'NOT' | 'OR' | 'IN' | 'EXISTS'> & {
1470
- NOT?: MaybeArray<WhereArg<T>>;
1471
- OR?: MaybeArray<WhereArg<T>>[];
1472
- IN?: MaybeArray<{
1510
+ declare module './aggregate' {
1511
+ interface SelectAggMethods<T extends Query> {
1512
+ /**
1513
+ * Give the `as` alias for the search, and it becomes possible to select a text with highlights of the matching words or phrases:
1514
+ *
1515
+ * ```ts
1516
+ * db.table
1517
+ * .search({
1518
+ * as: 'search',
1519
+ * in: 'body',
1520
+ * query: 'query',
1521
+ * })
1522
+ * .select({
1523
+ * highlightedText: (q) => q.headline('search'),
1524
+ * });
1525
+ * ```
1526
+ *
1527
+ * When searching in the generated `tsvector` column, need to provide a text source to the `headline`:
1528
+ *
1529
+ * ```ts
1530
+ * db.table
1531
+ * .search({
1532
+ * as: 'search',
1533
+ * vector: 'textVector',
1534
+ * query: 'query',
1535
+ * })
1536
+ * .select({
1537
+ * // `body` is a column name
1538
+ * highlightedText: (q) => q.headline('search', { text: 'body' }),
1539
+ * });
1540
+ * ```
1541
+ *
1542
+ * `text` can be a raw SQL, here we are joining multiple columns:
1543
+ *
1544
+ * ```ts
1545
+ * import { raw } from 'orchid-orm';
1546
+ *
1547
+ * db.table
1548
+ * .search({
1549
+ * as: 'search',
1550
+ * vector: 'titleAndBodyVector',
1551
+ * query: 'query',
1552
+ * })
1553
+ * .select({
1554
+ * highlightedText: (q) =>
1555
+ * q.headline('search', { text: raw`concat_ws(' ', title, body)` }),
1556
+ * });
1557
+ * ```
1558
+ *
1559
+ * `headline` supports a string for `options`, see details [in Postgres doc](https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE).
1560
+ *
1561
+ * Provide a simple string or a raw SQL:
1562
+ *
1563
+ * ```ts
1564
+ * db.table
1565
+ * .search({
1566
+ * as: 'search',
1567
+ * in: 'body',
1568
+ * query: 'query',
1569
+ * })
1570
+ * .select({
1571
+ * highlightedText: (q) =>
1572
+ * q.headline('search', {
1573
+ * options:
1574
+ * 'MaxFragments=10, MaxWords=7, MinWords=3, StartSel=<<, StopSel=>>',
1575
+ * }),
1576
+ * });
1577
+ * ```
1578
+ *
1579
+ * @param search - name of the search to use the query from
1580
+ * @param options - `text` for a text source, `options` for `ts_headline` options
1581
+ */
1582
+ headline(search: string | undefined extends T['meta']['tsQuery'] ? never : Exclude<T['meta']['tsQuery'], undefined>, options?: {
1583
+ text?: SelectableOrExpressionOfType<T, TextColumn>;
1584
+ options?: string | Expression;
1585
+ }): ColumnExpression<TextColumn>;
1586
+ }
1587
+ }
1588
+ type SearchArg<T extends QueryBase, As extends string> = {
1589
+ as?: As;
1590
+ order?: OrderTsQueryConfig;
1591
+ } & ({
1592
+ language?: string | Expression;
1593
+ } | {
1594
+ languageColumn?: keyof T['selectable'];
1595
+ }) & ({
1596
+ text: string | Expression;
1597
+ } | {
1598
+ in: MaybeArray<keyof T['selectable']> | {
1599
+ [K in keyof T['selectable']]?: SearchWeight;
1600
+ };
1601
+ } | {
1602
+ vector: {
1603
+ [K in keyof T['selectable']]: T['selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never;
1604
+ }[keyof T['selectable']];
1605
+ }) & ({
1606
+ query: string | Expression;
1607
+ } | {
1608
+ plainQuery: string | Expression;
1609
+ } | {
1610
+ phraseQuery: string | Expression;
1611
+ } | {
1612
+ tsQuery: string | Expression;
1613
+ });
1614
+ type WhereSearchResult<T extends QueryBase, As extends string> = T & {
1615
+ meta: {
1616
+ tsQuery: string extends As ? never : As;
1617
+ };
1618
+ };
1619
+ declare const saveSearchAlias: (q: QueryBase, as: string) => string;
1620
+ declare class SearchMethods {
1621
+ /**
1622
+ * ## language
1623
+ *
1624
+ * By default, the search language is English.
1625
+ *
1626
+ * You can set a different default language in the `createBaseTable` config:
1627
+ *
1628
+ * ```ts
1629
+ * import { createBaseTable } from 'orchid-orm';
1630
+ *
1631
+ * export const BaseTable = createBaseTable({
1632
+ * language: 'swedish',
1633
+ * });
1634
+ * ```
1635
+ *
1636
+ * See the list of supported language configs with the SQL:
1637
+ *
1638
+ * ```sql
1639
+ * SELECT cfgname FROM pg_ts_config;
1640
+ * ```
1641
+ *
1642
+ * When performing a search, you can override the default language:
1643
+ *
1644
+ * ```ts
1645
+ * db.table.search({
1646
+ * language: 'finnish',
1647
+ * in: 'body',
1648
+ * query: 'query',
1649
+ * });
1650
+ * ```
1651
+ *
1652
+ * `language` also accepts a raw SQL.
1653
+ *
1654
+ * The language can be stored in the column of this table, then you can use `languageColumn` to use this column for the search:
1655
+ *
1656
+ * ```ts
1657
+ * db.table.search({
1658
+ * // the table has `lang` column, use it for the search
1659
+ * languageColumn: 'lang',
1660
+ * in: 'body',
1661
+ * query: 'query',
1662
+ * });
1663
+ * ```
1664
+ *
1665
+ * ## text vector to search in
1666
+ *
1667
+ * The text to search in can be a simple string, or a raw SQL, or a text column, or multiple columns:
1668
+ *
1669
+ * ```ts
1670
+ * db.table.search({
1671
+ * // search in the given string
1672
+ * text: 'simply a string to search in',
1673
+ * query: 'query',
1674
+ * });
1675
+ *
1676
+ * import { raw } from 'orchid-orm';
1677
+ *
1678
+ * db.table.search({
1679
+ * // raw SQL: join text columns with space
1680
+ * text: raw`concat_ws(' ', title, body)`,
1681
+ * query: 'query',
1682
+ * });
1683
+ *
1684
+ * db.table.search({
1685
+ * // search in a single text column
1686
+ * in: 'body',
1687
+ * query: 'query',
1688
+ * });
1689
+ *
1690
+ * db.table.search({
1691
+ * // search in multiple columns, they are concatenated with `concat_ws` as shown above
1692
+ * in: ['title', 'body'],
1693
+ * query: 'query',
1694
+ * });
1695
+ *
1696
+ * db.table.search({
1697
+ * // search in multiple columns with different weights. Weight can be A, B, C, or D
1698
+ * in: {
1699
+ * title: 'A',
1700
+ * body: 'B',
1701
+ * },
1702
+ * query: 'query',
1703
+ * });
1704
+ * ```
1705
+ *
1706
+ * For better performance, define a [generated](/guide/migration-column-methods.html#generated) column of `tsvector` type, and use it in the search with `vector` keyword:
1707
+ *
1708
+ * ```ts
1709
+ * db.table.search({
1710
+ * vector: 'titleAndBodyVector',
1711
+ * query: 'query',
1712
+ * });
1713
+ * ```
1714
+ *
1715
+ * ## search query
1716
+ *
1717
+ * Read about different search queries in [this Postgres doc](https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-PARSING-QUERIES).
1718
+ *
1719
+ * `search` method can accept one of the following queries:
1720
+ *
1721
+ * - `query`: corresponds to `websearch_to_tsquery` in Postgres, good to use by default
1722
+ * - `plainQuery`: corresponds to `plainto_tsquery`
1723
+ * - `phraseQuery`: corresponds to `phraseto_tsquery`
1724
+ * - `tsQuery`: corresponds to `to_tsquery`
1725
+ *
1726
+ * The `query` (`websearch_to_tsquery`) can work with any user input, while other query kinds require a specific format and will fail for invalid input.
1727
+ *
1728
+ * Each query kind accepts a string or a raw SQL.
1729
+ *
1730
+ * ```ts
1731
+ * import { raw } from 'orchid-orm';
1732
+ *
1733
+ * db.table.search({
1734
+ * vector: 'titleAndBodyVector',
1735
+ * // can accept raw SQL:
1736
+ * phraseQuery: raw`'The Fat Rats'`,
1737
+ * });
1738
+ * ```
1739
+ *
1740
+ * ## order by search rank
1741
+ *
1742
+ * Read about search ranking in [this Postgres doc](https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-RANKING).
1743
+ *
1744
+ * Set `order: true` to order results by the search rank:
1745
+ *
1746
+ * ```ts
1747
+ * db.table.search({
1748
+ * in: 'body',
1749
+ * query: 'query',
1750
+ * // will add ORDER BY ts_rank(to_tsvector('english', body)) DESC
1751
+ * order: true,
1752
+ * });
1753
+ * ```
1754
+ *
1755
+ * To order with `ts_rank_cd` instead of `ts_rank`, set `coverDensity: true`:
1756
+ *
1757
+ * ```ts
1758
+ * db.table.search({
1759
+ * in: 'body',
1760
+ * query: 'query',
1761
+ * // will add ORDER BY ts_rank_cd(to_tsvector('english', body)) DESC
1762
+ * order: {
1763
+ * coverDensity: true,
1764
+ * },
1765
+ * });
1766
+ * ```
1767
+ *
1768
+ * Other options are:
1769
+ *
1770
+ * ```ts
1771
+ * db.table.search({
1772
+ * in: 'body',
1773
+ * query: 'query',
1774
+ * order: {
1775
+ * // weights for D, C, B, A:
1776
+ * weights: [0.1, 0.2, 0.4, 1],
1777
+ * // by default, rank ignores the document length
1778
+ * // change rank behavior by providing here a special number
1779
+ * normalization: 32,
1780
+ * // it's possible to change the order direction:
1781
+ * dir: 'ASC', // DESC by default
1782
+ * },
1783
+ * });
1784
+ * ```
1785
+ *
1786
+ * Giving the `as` alias for the search allows to set the ordering in the `order` method:
1787
+ *
1788
+ * ```ts
1789
+ * db.table
1790
+ * .search({
1791
+ * as: 'search',
1792
+ * in: 'body',
1793
+ * query: 'query',
1794
+ * })
1795
+ * .order({
1796
+ * // can be `search: true` for defaults
1797
+ * search: {
1798
+ * // same options as above
1799
+ * coverDensity: true,
1800
+ * weights: [0.1, 0.2, 0.4, 1.0],
1801
+ * normalization: 32,
1802
+ * dir: 'ASC',
1803
+ * },
1804
+ * });
1805
+ * ```
1806
+ *
1807
+ * @param arg - search config
1808
+ */
1809
+ search<T extends Query, As extends string>(this: T, arg: SearchArg<T, As>): WhereSearchResult<T, As>;
1810
+ _search<T extends Query, As extends string>(this: T, arg: SearchArg<T, As>): WhereSearchResult<T, As>;
1811
+ }
1812
+
1813
+ type WhereArg<T extends QueryBase> = {
1814
+ [K in keyof T['selectable'] | 'NOT' | 'OR' | 'IN' | 'EXISTS' | 'SEARCH']?: K extends 'NOT' ? MaybeArray<WhereArg<T>> : K extends 'OR' ? MaybeArray<WhereArg<T>>[] : K extends 'IN' ? MaybeArray<{
1473
1815
  columns: (keyof T['selectable'])[];
1474
1816
  values: unknown[][] | Query | Expression;
1475
- }>;
1476
- }) | QueryBase | Expression | ((q: WhereQueryBuilder<T>) => WhereQueryBuilder);
1817
+ }> : K extends 'SEARCH' ? MaybeArray<SearchArg<T, never>> : K extends keyof T['selectable'] ? T['selectable'][K]['column']['type'] | null | ColumnOperators<T['selectable'], K> | Expression : never;
1818
+ } | QueryBase | Expression | ((q: WhereQueryBuilder<T>) => WhereQueryBuilder);
1477
1819
  type WhereArgs<T extends QueryBase> = WhereArg<T>[] | TemplateLiteralArgs;
1478
1820
  type WhereInColumn<T extends QueryBase> = keyof T['selectable'] | [keyof T['selectable'], ...(keyof T['selectable'])[]];
1479
1821
  type WhereInValues<T extends QueryBase, Column extends WhereInColumn<T>> = Column extends keyof T['selectable'] ? T['selectable'][Column]['column']['type'][] | Query | Expression : ({
@@ -1491,7 +1833,7 @@ type WhereResult<T extends QueryBase> = T & {
1491
1833
  type WhereInArg<T extends Pick<Query, 'selectable'>> = {
1492
1834
  [K in keyof T['selectable']]?: T['selectable'][K]['column']['type'][] | Query | Expression;
1493
1835
  };
1494
- declare const addWhere: <T extends Where>(q: T, args: WhereArgs<T>) => WhereResult<T>;
1836
+ declare const addWhere: <T extends QueryBase>(q: T, args: WhereArgs<T>) => WhereResult<T>;
1495
1837
  declare const addWhereNot: <T extends QueryBase>(q: T, args: WhereArgs<T>) => WhereResult<T>;
1496
1838
  declare const addOr: <T extends QueryBase>(q: T, args: WhereArg<T>[]) => WhereResult<T>;
1497
1839
  declare const addOrNot: <T extends QueryBase>(q: T, args: WhereArg<T>[]) => WhereResult<T>;
@@ -3383,7 +3725,8 @@ declare const raw: <T = unknown>(...args: RawSQLArgs) => RawSQL<ColumnTypeBase<T
3383
3725
  name?: string | undefined;
3384
3726
  } | undefined): {};
3385
3727
  index(columns: orchid_core.MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
3386
- unique(columns: orchid_core.MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
3728
+ unique(columns: orchid_core.MaybeArray<string | IndexColumnOptions>, options?: IndexOptions | undefined): {};
3729
+ searchIndex(columns: orchid_core.MaybeArray<string | IndexColumnOptions>, options?: IndexOptions | undefined): {};
3387
3730
  constraint<Table extends string | (() => orchid_core.ForeignKeyTable), Columns extends Table extends () => orchid_core.ForeignKeyTable ? [orchid_core.ColumnNameOfTable<ReturnType<Table>>, ...orchid_core.ColumnNameOfTable<ReturnType<Table>>[]] : [string, ...string[]]>({ name, references, check, dropMode, }: {
3388
3731
  name?: string | undefined;
3389
3732
  references?: [columns: string[], fnOrTable: Table, foreignColumns: Columns, options?: ForeignKeyOptions | undefined] | undefined;
@@ -3629,17 +3972,17 @@ type WindowArgDeclaration<T extends Query = Query> = {
3629
3972
  type WindowResult<T extends Query, W extends WindowArg<T>> = T & {
3630
3973
  windows: Record<keyof W, true>;
3631
3974
  };
3632
- type OrderArg<T extends Query, Key extends PropertyKey = keyof T['selectable'] | {
3975
+ type OrderArg<T extends Query, TsQuery extends PropertyKey = string | undefined extends T['meta']['tsQuery'] ? never : Exclude<T['meta']['tsQuery'], undefined>, Key extends PropertyKey = keyof T['selectable'] | {
3633
3976
  [K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' ? never : K;
3634
- }[keyof T['result']]> = Key | {
3635
- [K in Key]?: SortDir;
3977
+ }[keyof T['result']] | TsQuery> = Key | {
3978
+ [K in Key]?: K extends TsQuery ? OrderTsQueryConfig : SortDir;
3636
3979
  } | Expression;
3637
3980
  type OrderArgs<T extends Query> = OrderArg<T>[] | TemplateLiteralArgs;
3638
3981
  type FindArgs<T extends Query> = [T['shape'][T['singlePrimaryKey']]['type'] | Expression] | TemplateLiteralArgs;
3639
3982
  type QueryHelper<T extends Query, Args extends unknown[], Result> = <Q extends {
3640
3983
  [K in keyof T]: K extends 'then' ? QueryThen<unknown> : K extends 'result' ? ColumnsShapeBase : T[K];
3641
3984
  }>(q: Q, ...args: Args) => Result extends Query ? MergeQuery<Q, Result> : Result;
3642
- interface QueryMethods<CT extends ColumnTypesBase> extends Omit<AsMethods, 'result'>, AggregateMethods, Select, From, Join, With, Union, Omit<JsonModifiers, 'result'>, JsonMethods, Create, Update, Delete, Transaction, For, ColumnInfoMethods, Omit<Where, 'result'>, Clear, Having, Then, QueryLog, Omit<QueryHooks, 'result'>, QueryUpsertOrCreate, QueryGet, MergeQueryMethods, RawSqlMethods<CT>, CopyMethods, TransformMethods {
3985
+ interface QueryMethods<CT extends ColumnTypesBase> extends Omit<AsMethods, 'result'>, AggregateMethods, Select, From, Join, With, Union, Omit<JsonModifiers, 'result'>, JsonMethods, Create, Update, Delete, Transaction, For, ColumnInfoMethods, Omit<Where, 'result'>, SearchMethods, Clear, Having, Then, QueryLog, Omit<QueryHooks, 'result'>, QueryUpsertOrCreate, QueryGet, MergeQueryMethods, RawSqlMethods<CT>, CopyMethods, TransformMethods {
3643
3986
  }
3644
3987
  declare class QueryMethods<CT extends ColumnTypesBase> {
3645
3988
  /**
@@ -4587,6 +4930,7 @@ declare class CharColumn<Limit extends number | undefined = undefined> extends L
4587
4930
  toCode(t: string): Code;
4588
4931
  }
4589
4932
  declare class TextColumn extends TextBaseColumn {
4933
+ static instance: TextColumn;
4590
4934
  dataType: "text";
4591
4935
  data: TextColumnData & {
4592
4936
  minArg?: number;
@@ -4836,7 +5180,9 @@ declare class BitVaryingColumn<Length extends number | undefined = undefined> ex
4836
5180
  toCode(t: string): Code;
4837
5181
  toSQL(): string;
4838
5182
  }
5183
+ type TsVectorGeneratedColumns = string[] | Record<string, SearchWeight>;
4839
5184
  declare class TsVectorColumn extends ColumnType<string, typeof Operators.text> {
5185
+ defaultLanguage: string;
4840
5186
  dataType: "tsvector";
4841
5187
  operators: {
4842
5188
  contains: Operator<string | orchid_core.Expression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query>;
@@ -4850,7 +5196,33 @@ declare class TsVectorColumn extends ColumnType<string, typeof Operators.text> {
4850
5196
  in: Operator<string[] | orchid_core.Expression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query>;
4851
5197
  notIn: Operator<string[] | orchid_core.Expression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query>;
4852
5198
  };
5199
+ constructor(defaultLanguage?: string);
4853
5200
  toCode(t: string): Code;
5201
+ /**
5202
+ * For `tsvector` column type, it can also accept language (optional) and columns:
5203
+ *
5204
+ * ```ts
5205
+ * import { change } from '../dbScript';
5206
+ *
5207
+ * change(async (db) => {
5208
+ * await db.createTable('post', (t) => ({
5209
+ * id: t.id(),
5210
+ * title: t.text(),
5211
+ * body: t.text(),
5212
+ * // join title and body into a single ts_vector
5213
+ * generatedTsVector: t.tsvector().generated(['title', 'body']).searchIndex(),
5214
+ * // with language:
5215
+ * spanishTsVector: t
5216
+ * .tsvector()
5217
+ * .generated('spanish', ['title', 'body'])
5218
+ * .searchIndex(),
5219
+ * }));
5220
+ * });
5221
+ * ```
5222
+ *
5223
+ * @param args
5224
+ */
5225
+ generated<T extends ColumnType>(this: T, ...args: RawSQLArgs | [language: string, columns: TsVectorGeneratedColumns] | [columns: TsVectorGeneratedColumns]): T;
4854
5226
  }
4855
5227
  declare class TsQueryColumn extends ColumnType<string, typeof Operators.text> {
4856
5228
  dataType: "tsquery";
@@ -4990,7 +5362,7 @@ declare const getConstraintKind: (it: TableData.Constraint) => 'constraint' | 'f
4990
5362
  declare const newTableData: () => TableData;
4991
5363
  declare const getTableData: () => TableData;
4992
5364
  declare const resetTableData: (data?: TableData) => void;
4993
- declare const getColumnTypes: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>, Shape extends ColumnsShape>(types: CT, fn: (t: CT) => Shape, nowSQL: string | undefined, data?: TableData) => Shape;
5365
+ declare const getColumnTypes: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>, Shape extends ColumnsShape>(types: CT, fn: (t: CT) => Shape, nowSQL: string | undefined, language: string | undefined, data?: TableData) => Shape;
4994
5366
  declare function text(min: number, max: number): TextColumn;
4995
5367
  declare function sql(sql: TemplateStringsArray, ...values: unknown[]): RawSQLBase;
4996
5368
  declare function sql(sql: string): RawSQLBase;
@@ -5096,6 +5468,10 @@ declare const columnTypes: {
5096
5468
  }): {};
5097
5469
  index(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
5098
5470
  unique(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
5471
+ /**
5472
+ * See {@link ColumnType.searchIndex}
5473
+ */
5474
+ searchIndex(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
5099
5475
  constraint<Table extends string | (() => ForeignKeyTable), Columns extends Table extends () => ForeignKeyTable ? [ColumnNameOfTable<ReturnType<Table>>, ...ColumnNameOfTable<ReturnType<Table>>[]] : [string, ...string[]]>({ name, references, check, dropMode, }: {
5100
5476
  name?: string | undefined;
5101
5477
  references?: [columns: string[], fnOrTable: Table, foreignColumns: Columns, options?: ForeignKeyOptions | undefined] | undefined;
@@ -5313,6 +5689,7 @@ type ColumnData = ColumnDataBase & {
5313
5689
  compression?: string;
5314
5690
  foreignKeys?: ForeignKey<string, string[]>[];
5315
5691
  identity?: TableData.Identity;
5692
+ generated?: RawSQLBase;
5316
5693
  };
5317
5694
  type ForeignKeyMatch = 'FULL' | 'PARTIAL' | 'SIMPLE';
5318
5695
  type ForeignKeyAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
@@ -5346,6 +5723,7 @@ type IndexColumnOptions = ({
5346
5723
  collate?: string;
5347
5724
  opclass?: string;
5348
5725
  order?: string;
5726
+ weight?: SearchWeight;
5349
5727
  };
5350
5728
  type IndexOptions = {
5351
5729
  name?: string;
@@ -5357,6 +5735,9 @@ type IndexOptions = {
5357
5735
  tablespace?: string;
5358
5736
  where?: string;
5359
5737
  dropMode?: 'CASCADE' | 'RESTRICT';
5738
+ language?: string | RawSQLBase;
5739
+ languageColumn?: string;
5740
+ tsVector?: boolean;
5360
5741
  };
5361
5742
  type SingleColumnIndexOptions = IndexColumnOptions & IndexOptions;
5362
5743
  type ColumnFromDbParams = {
@@ -5374,12 +5755,12 @@ declare const simplifyColumnDefault: (value?: string) => RawSQL<ColumnTypeBase<u
5374
5755
  };
5375
5756
  timestamp(): T;
5376
5757
  timestampsSnakeCase(): {
5377
- createdAt: orchid_core.ColumnWithDefault<T, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5378
- updatedAt: orchid_core.ColumnWithDefault<T, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5758
+ createdAt: orchid_core.ColumnWithDefault<T, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5759
+ updatedAt: orchid_core.ColumnWithDefault<T, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5379
5760
  };
5380
5761
  }): {
5381
- createdAt: orchid_core.ColumnWithDefault<T, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5382
- updatedAt: orchid_core.ColumnWithDefault<T, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5762
+ createdAt: orchid_core.ColumnWithDefault<T, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5763
+ updatedAt: orchid_core.ColumnWithDefault<T, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5383
5764
  };
5384
5765
  timestampsSnakeCase<T_1 extends ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>>(this: {
5385
5766
  name(name: string): {
@@ -5387,8 +5768,8 @@ declare const simplifyColumnDefault: (value?: string) => RawSQL<ColumnTypeBase<u
5387
5768
  };
5388
5769
  timestamp(): T_1;
5389
5770
  }): {
5390
- createdAt: orchid_core.ColumnWithDefault<T_1, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5391
- updatedAt: orchid_core.ColumnWithDefault<T_1, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5771
+ createdAt: orchid_core.ColumnWithDefault<T_1, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5772
+ updatedAt: orchid_core.ColumnWithDefault<T_1, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5392
5773
  };
5393
5774
  timestampsNoTZ<T_2 extends ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>>(this: {
5394
5775
  name(name: string): {
@@ -5396,12 +5777,12 @@ declare const simplifyColumnDefault: (value?: string) => RawSQL<ColumnTypeBase<u
5396
5777
  };
5397
5778
  timestampNoTZ(): T_2;
5398
5779
  timestampsNoTZSnakeCase(): {
5399
- createdAt: orchid_core.ColumnWithDefault<T_2, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5400
- updatedAt: orchid_core.ColumnWithDefault<T_2, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5780
+ createdAt: orchid_core.ColumnWithDefault<T_2, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5781
+ updatedAt: orchid_core.ColumnWithDefault<T_2, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5401
5782
  };
5402
5783
  }): {
5403
- createdAt: orchid_core.ColumnWithDefault<T_2, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5404
- updatedAt: orchid_core.ColumnWithDefault<T_2, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5784
+ createdAt: orchid_core.ColumnWithDefault<T_2, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5785
+ updatedAt: orchid_core.ColumnWithDefault<T_2, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5405
5786
  };
5406
5787
  timestampsNoTZSnakeCase<T_3 extends ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>>(this: {
5407
5788
  name(name: string): {
@@ -5409,15 +5790,15 @@ declare const simplifyColumnDefault: (value?: string) => RawSQL<ColumnTypeBase<u
5409
5790
  };
5410
5791
  timestampNoTZ(): T_3;
5411
5792
  }): {
5412
- createdAt: orchid_core.ColumnWithDefault<T_3, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5413
- updatedAt: orchid_core.ColumnWithDefault<T_3, orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5793
+ createdAt: orchid_core.ColumnWithDefault<T_3, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5794
+ updatedAt: orchid_core.ColumnWithDefault<T_3, RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>>;
5414
5795
  };
5415
5796
  name: typeof orchid_core.name;
5416
5797
  sql: {
5417
- (sql: TemplateStringsArray, ...values: unknown[]): orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>;
5418
- (sql: string): orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>;
5419
- (values: Record<string, unknown>, sql: string): orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>;
5420
- (values: Record<string, unknown>): (strings: TemplateStringsArray, ...values: unknown[]) => orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>;
5798
+ (sql: TemplateStringsArray, ...values: unknown[]): RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>;
5799
+ (sql: string): RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>;
5800
+ (values: Record<string, unknown>, sql: string): RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>;
5801
+ (values: Record<string, unknown>): (strings: TemplateStringsArray, ...values: unknown[]) => RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>;
5421
5802
  };
5422
5803
  smallint(): SmallIntColumn;
5423
5804
  integer(): IntegerColumn;
@@ -5502,18 +5883,19 @@ declare const simplifyColumnDefault: (value?: string) => RawSQL<ColumnTypeBase<u
5502
5883
  name?: string | undefined;
5503
5884
  } | undefined): {};
5504
5885
  index(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
5505
- unique(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
5886
+ unique(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions | undefined): {};
5887
+ searchIndex(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions | undefined): {};
5506
5888
  constraint<Table extends string | (() => ForeignKeyTable), Columns extends Table extends () => ForeignKeyTable ? [ColumnNameOfTable<ReturnType<Table>>, ...ColumnNameOfTable<ReturnType<Table>>[]] : [string, ...string[]]>({ name, references, check, dropMode, }: {
5507
5889
  name?: string | undefined;
5508
5890
  references?: [columns: string[], fnOrTable: Table, foreignColumns: Columns, options?: ForeignKeyOptions | undefined] | undefined;
5509
- check?: orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}> | undefined;
5891
+ check?: RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}> | undefined;
5510
5892
  dropMode?: DropMode | undefined;
5511
5893
  }): {};
5512
5894
  foreignKey<Table_1 extends string | (() => ForeignKeyTable), Columns_1 extends Table_1 extends () => ForeignKeyTable ? [ColumnNameOfTable<ReturnType<Table_1>>, ...ColumnNameOfTable<ReturnType<Table_1>>[]] : [string, ...string[]]>(columns: string[], fnOrTable: Table_1, foreignColumns: Columns_1, options?: (ForeignKeyOptions & {
5513
5895
  name?: string | undefined;
5514
5896
  dropMode?: DropMode | undefined;
5515
5897
  }) | undefined): {};
5516
- check(check: orchid_core.RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>): {};
5898
+ check(check: RawSQLBase<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, ColumnDataBase>, {}>): {};
5517
5899
  }> | undefined;
5518
5900
  declare const instantiateColumn: (klass: new (...args: never[]) => ColumnType, params: ColumnFromDbParams) => ColumnType;
5519
5901
  declare abstract class ColumnType<Type = unknown, Ops extends BaseOperators = BaseOperators, InputType = Type> extends ColumnTypeBase<Type, Ops, InputType, ColumnData> {
@@ -5526,6 +5908,54 @@ declare abstract class ColumnType<Type = unknown, Ops extends BaseOperators = Ba
5526
5908
  };
5527
5909
  toSQL(): string;
5528
5910
  index<T extends ColumnType>(this: T, options?: Omit<SingleColumnIndexOptions, 'column'>): T;
5911
+ /**
5912
+ * `searchIndex` is designed for full text search.
5913
+ *
5914
+ * It can accept the same options as a regular `index`, but it is `USING GIN` by default, and it is concatenating columns into a `tsvector`.
5915
+ *
5916
+ * ```ts
5917
+ * import { change } from '../dbScript';
5918
+ *
5919
+ * change(async (db) => {
5920
+ * await db.createTable('table', (t) => ({
5921
+ * id: t.identity().primaryKey(),
5922
+ * title: t.string(),
5923
+ * body: t.string(),
5924
+ * ...t.searchIndex(['title', 'body']),
5925
+ * }));
5926
+ * });
5927
+ * ```
5928
+ *
5929
+ * Produces the following index ('english' is a default language, see [full text search](/guide/text-search.html#language) for changing it):
5930
+ *
5931
+ * ```sql
5932
+ * CREATE INDEX "table_title_body_idx" ON "table" USING GIN (to_tsvector('english', concat_ws(' ', "title", "body")))
5933
+ * ```
5934
+ *
5935
+ * Also, it works well with a generated `tsvector` column:
5936
+ *
5937
+ * ```ts
5938
+ * import { change } from '../dbScript';
5939
+ *
5940
+ * change(async (db) => {
5941
+ * await db.createTable('table', (t) => ({
5942
+ * id: t.identity().primaryKey(),
5943
+ * title: t.string(),
5944
+ * body: t.string(),
5945
+ * generatedTsVector: t.tsvector().generated(['title', 'body']).searchIndex(),
5946
+ * }));
5947
+ * });
5948
+ * ```
5949
+ *
5950
+ * Produces the following index:
5951
+ *
5952
+ * ```sql
5953
+ * CREATE INDEX "table_generatedTsVector_idx" ON "table" USING GIN ("generatedTsVector")
5954
+ * ```
5955
+ *
5956
+ * @param options - index options
5957
+ */
5958
+ searchIndex<T extends ColumnType>(this: T, options?: Omit<SingleColumnIndexOptions, 'tsVector'>): T;
5529
5959
  unique<T extends ColumnType>(this: T, options?: Omit<SingleColumnIndexOptions, 'column' | 'unique'>): T;
5530
5960
  comment<T extends ColumnType>(this: T, comment: string): T;
5531
5961
  validationDefault<T extends ColumnType>(this: T, value: T['type']): T;
@@ -5542,6 +5972,22 @@ declare abstract class ColumnType<Type = unknown, Ops extends BaseOperators = Ba
5542
5972
  superRefine<T extends ColumnType, RefinedOutput extends T['type']>(this: T, check: (arg: T['type'], ctx: ValidationContext) => unknown): T & {
5543
5973
  type: RefinedOutput;
5544
5974
  };
5975
+ /**
5976
+ * Define a generated column. `generated` accepts a raw SQL.
5977
+ *
5978
+ * ```ts
5979
+ * import { change } from '../dbScript';
5980
+ *
5981
+ * change(async (db) => {
5982
+ * await db.createTable('table', (t) => ({
5983
+ * two: t.integer().generated`1 + 1`,
5984
+ * }));
5985
+ * });
5986
+ * ```
5987
+ *
5988
+ * @param args - raw SQL
5989
+ */
5990
+ generated<T extends ColumnType>(this: T, ...args: RawSQLArgs): T;
5545
5991
  }
5546
5992
 
5547
5993
  declare const cloneInstance: <T>(instance: T) => T;
@@ -5643,4 +6089,4 @@ declare const testTransaction: {
5643
6089
  close(arg: Arg): Promise<void>;
5644
6090
  };
5645
6091
 
5646
- export { Adapter, AdapterConfig, AdapterOptions, AddQuerySelect, AddQueryWith, AfterHook, AggregateMethods, AggregateOptions, AliasOrTable, ArrayColumn, ArrayData, ArrayOfColumnsObjects, AsMethods, BaseOperators, BaseRelation, BelongsToRelation, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BooleanNullable, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, CitextColumn, Clear, ClearStatement, ColumnData, ColumnExpression, ColumnFromDbParams, ColumnInfo, ColumnInfoMethods, ColumnInfoQueryData, ColumnOperators, ColumnType, ColumnTypes, ColumnsObject, ColumnsShape, CommonQueryData, CopyMethods, CopyOptions, CopyQueryData, Create, CreateCtx, CreateData, CreateKind, CreateMethodsNames, CustomTypeColumn, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeTzBaseClass, Db, DbOptions, DbResult, DbTableOptions, DecimalBaseColumn, DecimalColumn, DefaultColumnTypes, Delete, DeleteMethodsNames, DeleteQueryData, DomainColumn, DoublePrecisionColumn, DropMode, EnumColumn, ExpressionOutput, FnExpression, FnExpressionArg, For, ForeignKey, ForeignKeyAction, ForeignKeyMatch, ForeignKeyOptions, From, FromArgs, FromResult, GetArg, GetQueryResult, GetStringArg, HasAndBelongsToManyRelation, HasManyRelation, HasOneRelation, Having, HavingItem, HookAction, HookSelect, IdentityColumn, IndexColumnOptions, IndexOptions, InetColumn, InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, IsolationLevel, JSONColumn, JSONTextColumn, JSONTypes, Join, JoinArgs, JoinCallback, JoinFirstArg, JoinItem, JoinLateralCallback, JoinLateralItem, JoinLateralResult, JoinOverrides, JoinResult, JoinedParsers, JoinedShapes, JsonItem, JsonMethods, JsonModifiers, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NoPrimaryKeyOption, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, NumberColumn, NumberColumnData, OnConflictItem, OnConflictMergeUpdate, OnConflictQueryBuilder, OnQueryBuilder, Operator, Operators, OrchidOrmError, OrchidOrmInternalError, OrderArg, OrderArgs, OrderItem, Over, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, Query, QueryAfterHook, QueryArraysResult, QueryBase, QueryBeforeHook, QueryData, QueryError, QueryErrorName, QueryGet, QueryHookSelect, QueryHooks, QueryLog, QueryLogObject, QueryLogOptions, QueryLogger, QueryMethods, QueryResult, QueryReturnType, QueryReturnsAll, QueryTransform, QueryTransformFn, QueryUpsertOrCreate, QueryWithTable, RawSQL, RawSqlMethods, RealColumn, Relation, RelationQuery, RelationQueryBase, RelationQueryData, RelationsBase, Select, SelectAggMethods, SelectArg, SelectItem, SelectQueryBuilder, SelectQueryData, Selectable, SelectableBase, SelectableFromShape, SelectableOfType, SelectableOrExpression, SelectableOrExpressionOfType, SerialColumn, SerialColumnData, SetQueryReturns, SetQueryReturnsAll, SetQueryReturnsColumn, SetQueryReturnsColumnInfo, SetQueryReturnsColumnOptional, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsPluck, SetQueryReturnsRowCount, SetQueryReturnsRows, SetQueryReturnsValue, SetQueryReturnsValueOptional, SetQueryReturnsVoid, SetQueryTableAlias, SetQueryWith, SimpleJoinItem, SingleColumnIndexOptions, SmallIntColumn, SmallSerialColumn, SortDir, StringColumn, TableData, TextBaseColumn, TextColumn, TextColumnData, Then, TimeColumn, TimeInterval, TimestampColumn, TimestampTZColumn, ToSqlCtx, ToSqlOptions, Transaction, TransactionAdapter, TransactionOptions, TransformMethods, TruncateQueryData, TsQueryColumn, TsVectorColumn, TypeParsers, UUIDColumn, UnhandledTypeError, Union, UnionArg, UnionItem, UnionKind, UnknownColumn, Update, UpdateCtx, UpdateData, UpdateQueryData, UpdateQueryDataItem, UpdateQueryDataObject, UpdatedAtDataInjector, UpsertCreateArg, UpsertData, UpsertResult, UpsertThis, VarCharColumn, VirtualColumn, Where, WhereArg, WhereArgs, WhereInArg, WhereInColumn, WhereInItem, WhereInValues, WhereItem, WhereJsonPathEqualsItem, WhereOnItem, WhereOnJoinItem, WhereQueryBuilder, WhereResult, WindowArg, WindowArgDeclaration, WindowDeclaration, WindowItem, With, WithDataBase, WithDataItem, WithItem, WithOptions, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addQueryOn, addQueryOrOn, addWhere, addWhereIn, addWhereNot, anyShape, checkIfASimpleQuery, cloneQueryArrays, columnCheckToCode, columnCode, columnForeignKeysToCode, columnIndexesToCode, columnTypes, utils as columnUtils, columnsByType, columnsShapeToCode, constraintPropsToCode, constraintToCode, createDb, createOperator, foreignKeyArgumentToCode, getClonedQueryData, getColumnTypes, getConstraintKind, getQueryAs, getSelectQueryBuilder, getShapeFromSelect, getTableData, handleResult, identityToCode, indexToCode, instantiateColumn, isQueryReturnsAll, isRequiredRelationKey, isSelectingCount, joinSubQuery, jsonTypes, logColors, logParamToLogObject, makeColumnFn, makeRegexToFindInSql, makeSql, newTableData, parseRecord, parseResult, primaryKeyToCode, processSelectArg, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, queryMethodByReturnType, queryTypeWithLimitOne, quote, quoteString, raw, referencesArgsToCode, relationQueryKey, resetTableData, resolveSubQueryCallback, setQueryObjectValue, simplifyColumnDefault, templateLiteralToSQL, testTransaction, throwIfNoWhere, toSql, toSqlCacheKey };
6092
+ export { Adapter, AdapterConfig, AdapterOptions, AddQuerySelect, AddQueryWith, AfterHook, AggregateMethods, AggregateOptions, AliasOrTable, ArrayColumn, ArrayData, ArrayOfColumnsObjects, AsMethods, BaseOperators, BaseRelation, BelongsToRelation, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BooleanNullable, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, CitextColumn, Clear, ClearStatement, ColumnData, ColumnExpression, ColumnFromDbParams, ColumnInfo, ColumnInfoMethods, ColumnInfoQueryData, ColumnOperators, ColumnType, ColumnTypes, ColumnsObject, ColumnsShape, CommonQueryData, CopyMethods, CopyOptions, CopyQueryData, Create, CreateCtx, CreateData, CreateKind, CreateMethodsNames, CustomTypeColumn, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeTzBaseClass, Db, DbOptions, DbResult, DbTableOptions, DecimalBaseColumn, DecimalColumn, DefaultColumnTypes, Delete, DeleteMethodsNames, DeleteQueryData, DomainColumn, DoublePrecisionColumn, DropMode, EnumColumn, ExpressionOutput, FnExpression, FnExpressionArg, For, ForeignKey, ForeignKeyAction, ForeignKeyMatch, ForeignKeyOptions, From, FromArgs, FromResult, GetArg, GetQueryResult, GetStringArg, HasAndBelongsToManyRelation, HasManyRelation, HasOneRelation, Having, HavingItem, HookAction, HookSelect, IdentityColumn, IndexColumnOptions, IndexOptions, InetColumn, InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, IsolationLevel, JSONColumn, JSONTextColumn, JSONTypes, Join, JoinArgs, JoinCallback, JoinFirstArg, JoinItem, JoinLateralCallback, JoinLateralItem, JoinLateralResult, JoinOverrides, JoinResult, JoinedParsers, JoinedShapes, JsonItem, JsonMethods, JsonModifiers, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NoPrimaryKeyOption, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, NumberColumn, NumberColumnData, OnConflictItem, OnConflictMergeUpdate, OnConflictQueryBuilder, OnQueryBuilder, Operator, Operators, OrchidOrmError, OrchidOrmInternalError, OrderArg, OrderArgs, OrderItem, OrderTsQueryConfig, Over, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, Query, QueryAfterHook, QueryArraysResult, QueryBase, QueryBeforeHook, QueryData, QueryError, QueryErrorName, QueryGet, QueryHookSelect, QueryHooks, QueryLog, QueryLogObject, QueryLogOptions, QueryLogger, QueryMethods, QueryResult, QueryReturnType, QueryReturnsAll, QuerySourceItem, QueryTransform, QueryTransformFn, QueryUpsertOrCreate, QueryWithTable, RawSQL, RawSqlMethods, RealColumn, Relation, RelationQuery, RelationQueryBase, RelationQueryData, RelationsBase, SearchArg, SearchMethods, SearchWeight, Select, SelectAggMethods, SelectArg, SelectItem, SelectQueryBuilder, SelectQueryData, Selectable, SelectableBase, SelectableFromShape, SelectableOfType, SelectableOrExpression, SelectableOrExpressionOfType, SerialColumn, SerialColumnData, SetQueryReturns, SetQueryReturnsAll, SetQueryReturnsColumn, SetQueryReturnsColumnInfo, SetQueryReturnsColumnOptional, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsPluck, SetQueryReturnsRowCount, SetQueryReturnsRows, SetQueryReturnsValue, SetQueryReturnsValueOptional, SetQueryReturnsVoid, SetQueryTableAlias, SetQueryWith, SimpleJoinItem, SingleColumnIndexOptions, SmallIntColumn, SmallSerialColumn, SortDir, StringColumn, TableData, TextBaseColumn, TextColumn, TextColumnData, Then, TimeColumn, TimeInterval, TimestampColumn, TimestampTZColumn, ToSqlCtx, ToSqlOptions, Transaction, TransactionAdapter, TransactionOptions, TransformMethods, TruncateQueryData, TsQueryColumn, TsVectorColumn, TypeParsers, UUIDColumn, UnhandledTypeError, Union, UnionArg, UnionItem, UnionKind, UnknownColumn, Update, UpdateCtx, UpdateData, UpdateQueryData, UpdateQueryDataItem, UpdateQueryDataObject, UpdatedAtDataInjector, UpsertCreateArg, UpsertData, UpsertResult, UpsertThis, VarCharColumn, VirtualColumn, Where, WhereArg, WhereArgs, WhereInArg, WhereInColumn, WhereInItem, WhereInValues, WhereItem, WhereJsonPathEqualsItem, WhereOnItem, WhereOnJoinItem, WhereQueryBuilder, WhereResult, WhereSearchItem, WhereSearchResult, WindowArg, WindowArgDeclaration, WindowDeclaration, WindowItem, With, WithDataBase, WithDataItem, WithItem, WithOptions, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addQueryOn, addQueryOrOn, addWhere, addWhereIn, addWhereNot, anyShape, checkIfASimpleQuery, cloneQueryArrays, columnCheckToCode, columnCode, columnForeignKeysToCode, columnIndexesToCode, columnTypes, utils as columnUtils, columnsByType, columnsShapeToCode, constraintPropsToCode, constraintToCode, createDb, createOperator, foreignKeyArgumentToCode, getClonedQueryData, getColumnTypes, getConstraintKind, getQueryAs, getSelectQueryBuilder, getShapeFromSelect, getTableData, handleResult, identityToCode, indexToCode, instantiateColumn, isQueryReturnsAll, isRequiredRelationKey, isSelectingCount, joinSubQuery, jsonTypes, logColors, logParamToLogObject, makeColumnFn, makeColumnFnClass, makeRegexToFindInSql, makeSql, newTableData, parseRecord, parseResult, primaryKeyToCode, processSelectArg, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, queryMethodByReturnType, queryTypeWithLimitOne, quote, quoteString, raw, referencesArgsToCode, relationQueryKey, resetTableData, resolveSubQueryCallback, saveSearchAlias, setQueryObjectValue, simplifyColumnDefault, templateLiteralToSQL, testTransaction, throwIfNoWhere, toSql, toSqlCacheKey };