pqb 0.17.1 → 0.17.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 +578 -7
- package/dist/index.js +128 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +129 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2848,12 +2848,12 @@ declare abstract class WhereQueryBase extends QueryBase {
|
|
|
2848
2848
|
type WithSelectable<T extends QueryBase, W extends keyof T['withData']> = T['withData'][W] extends WithDataItem ? StringKey<keyof T['withData'][W]['shape']> | `${T['withData'][W]['table']}.${StringKey<keyof T['withData'][W]['shape']>}` : never;
|
|
2849
2849
|
/**
|
|
2850
2850
|
* The first argument of all `join` and `joinLateral` methods.
|
|
2851
|
-
* See argument of {@link
|
|
2851
|
+
* See argument of {@link join}.
|
|
2852
2852
|
*/
|
|
2853
2853
|
type JoinFirstArg<T extends QueryBase> = Query | keyof T['relations'] | keyof T['withData'] | ((q: T['relations']) => Query);
|
|
2854
2854
|
/**
|
|
2855
2855
|
* Arguments of `join` methods (not `joinLateral`).
|
|
2856
|
-
* See {@link
|
|
2856
|
+
* See {@link join}
|
|
2857
2857
|
*/
|
|
2858
2858
|
type JoinArgs<T extends QueryBase, Arg extends JoinFirstArg<T>> = Arg extends Query ? JoinQueryArgs<T, Arg> : Arg extends keyof T['relations'] ? EmptyTuple : Arg extends keyof T['withData'] ? JoinWithArgs<T, Arg> : never;
|
|
2859
2859
|
/**
|
|
@@ -3014,29 +3014,555 @@ type JoinCallback<T extends QueryBase, Arg extends JoinFirstArg<T>> = (q: OnQuer
|
|
|
3014
3014
|
type JoinLateralCallback<T extends QueryBase, Arg extends JoinFirstArg<T>, R extends QueryBase, Q extends QueryBase = JoinArgToQuery<T, Arg>> = (q: Q & OnQueryBuilder<T, Q>) => R;
|
|
3015
3015
|
declare class Join {
|
|
3016
3016
|
/**
|
|
3017
|
-
*
|
|
3017
|
+
* ## Select relation
|
|
3018
3018
|
*
|
|
3019
|
-
*
|
|
3020
|
-
*
|
|
3019
|
+
* Before joining a table, consider if selecting a relation is enough for your case:
|
|
3020
|
+
*
|
|
3021
|
+
* ```ts
|
|
3022
|
+
* // select users with profiles
|
|
3023
|
+
* // result type is Array<{ name: string, profile: Profile }>
|
|
3024
|
+
* await db.user.select('name', {
|
|
3025
|
+
* profile: (q) => q.profile,
|
|
3026
|
+
* });
|
|
3027
|
+
*
|
|
3028
|
+
* // select posts with counts of comments, order by comments count
|
|
3029
|
+
* // result type is Array<Post & { commentsCount: number }>
|
|
3030
|
+
* await db.post
|
|
3031
|
+
* .select('*', {
|
|
3032
|
+
* commentsCount: (q) => q.comments.count(),
|
|
3033
|
+
* })
|
|
3034
|
+
* .order({
|
|
3035
|
+
* commentsCount: 'DESC',
|
|
3036
|
+
* });
|
|
3037
|
+
*
|
|
3038
|
+
* // select authors with array of their book titles
|
|
3039
|
+
* // result type is Array<Author & { books: string[] }>
|
|
3040
|
+
* await db.author.select('*', {
|
|
3041
|
+
* books: (q) => q.books.pluck('title'),
|
|
3042
|
+
* });
|
|
3043
|
+
* ```
|
|
3044
|
+
*
|
|
3045
|
+
* Internally, such selects will use `LEFT JOIN LATERAL` to join a relation.
|
|
3046
|
+
* If you're loading users with profiles (one-to-one relation), and some users don't have a profile, `profile` property will have `NULL` for such users.
|
|
3047
|
+
* If you want to load only users that have profiles, and filter out the rest, add `.join()` method to the relation without arguments:
|
|
3048
|
+
*
|
|
3049
|
+
* ```ts
|
|
3050
|
+
* // load only users who have a profile
|
|
3051
|
+
* await db.user.select('*', {
|
|
3052
|
+
* profile: (q) => q.profile.join(),
|
|
3053
|
+
* });
|
|
3054
|
+
*
|
|
3055
|
+
* // load only users who have a specific profile
|
|
3056
|
+
* await db.user.select('*', {
|
|
3057
|
+
* profile: (q) => q.profile.join().where({ age: { gt: 20 } }),
|
|
3058
|
+
* });
|
|
3059
|
+
* ```
|
|
3060
|
+
*
|
|
3061
|
+
* You can also use this `.join()` method on the one-to-many relations, and records with empty array will be filtered out:
|
|
3062
|
+
*
|
|
3063
|
+
* ```ts
|
|
3064
|
+
* // posts that have no tags won't be loaded
|
|
3065
|
+
* // result type is Array<Post & { tags: Tag[] }>
|
|
3066
|
+
* db.post.select('*', {
|
|
3067
|
+
* tags: (q) => q.tags.join(),
|
|
3068
|
+
* });
|
|
3069
|
+
* ```
|
|
3070
|
+
*
|
|
3071
|
+
* # Joins
|
|
3072
|
+
*
|
|
3073
|
+
* `join` methods allows to join other tables, relations by name, [with](/guide/advanced-queries#with) statements, sub queries.
|
|
3074
|
+
*
|
|
3075
|
+
* All the `join` methods accept the same arguments, but returning type is different because with `join` it's guaranteed to load joined table, and with `leftJoin` the joined table columns may be `NULL` when no matching record was found.
|
|
3076
|
+
*
|
|
3077
|
+
* For the following examples, imagine we have a `User` table with `id` and `name`, and `Message` table with `id`, `text`, messages belongs to user via `userId` column:
|
|
3078
|
+
*
|
|
3079
|
+
* ```ts
|
|
3080
|
+
* export class UserTable extends BaseTable {
|
|
3081
|
+
* readonly table = 'user';
|
|
3082
|
+
* columns = this.setColumns((t) => ({
|
|
3083
|
+
* id: t.identity().primaryKey(),
|
|
3084
|
+
* name: t.text(),
|
|
3085
|
+
* }));
|
|
3086
|
+
*
|
|
3087
|
+
* relations = {
|
|
3088
|
+
* messages: this.hasMany(() => MessageTable, {
|
|
3089
|
+
* primaryKey: 'id',
|
|
3090
|
+
* foreignKey: 'userId',
|
|
3091
|
+
* }),
|
|
3092
|
+
* };
|
|
3093
|
+
* }
|
|
3094
|
+
*
|
|
3095
|
+
* export class MessageTable extends BaseTable {
|
|
3096
|
+
* readonly table = 'message';
|
|
3097
|
+
* columns = this.setColumns((t) => ({
|
|
3098
|
+
* id: t.identity().primaryKey(),
|
|
3099
|
+
* text: t.text(),
|
|
3100
|
+
* ...t.timestamps(),
|
|
3101
|
+
* }));
|
|
3102
|
+
*
|
|
3103
|
+
* relations = {
|
|
3104
|
+
* user: this.belongsTo(() => UserTable, {
|
|
3105
|
+
* primaryKey: 'id',
|
|
3106
|
+
* foreignKey: 'userId',
|
|
3107
|
+
* }),
|
|
3108
|
+
* };
|
|
3109
|
+
* }
|
|
3110
|
+
* ```
|
|
3111
|
+
*
|
|
3112
|
+
* ## join
|
|
3113
|
+
*
|
|
3114
|
+
* `join` is a method for SQL `JOIN`, which is equivalent to `INNER JOIN`, `LEFT INNERT JOIN`.
|
|
3115
|
+
*
|
|
3116
|
+
* When no matching record is found, it will skip records of the main table.
|
|
3117
|
+
*
|
|
3118
|
+
* ### join relation
|
|
3119
|
+
*
|
|
3120
|
+
* When relations are defined between the tables, you can join them by a relation name.
|
|
3121
|
+
* Joined table can be references from `where` and `select` by a relation name.
|
|
3122
|
+
*
|
|
3123
|
+
* ```ts
|
|
3124
|
+
* const result = await db.user
|
|
3125
|
+
* .join('messages')
|
|
3126
|
+
* // after joining a table, we can use it in `where` conditions:
|
|
3127
|
+
* .where({ 'messages.text': { startsWith: 'Hi' } })
|
|
3128
|
+
* .select(
|
|
3129
|
+
* 'name', // name is User column, table name may be omitted
|
|
3130
|
+
* 'messages.text', // text is the Message column, and the table name is required
|
|
3131
|
+
* );
|
|
3132
|
+
*
|
|
3133
|
+
* // result has the following type:
|
|
3134
|
+
* const ok: { name: string; text: string }[] = result;
|
|
3135
|
+
* ```
|
|
3136
|
+
*
|
|
3137
|
+
* The first argument can also be a callback, where instead of relation name as a string we're picking it as a property of `q`.
|
|
3138
|
+
* In such a way, we can alias the relation with `as`, add `where` conditions, use other query methods.
|
|
3139
|
+
*
|
|
3140
|
+
* ```ts
|
|
3141
|
+
* const result = await db.user.join((q) =>
|
|
3142
|
+
* q.messages.as('m').where({ text: 'some text' }),
|
|
3143
|
+
* );
|
|
3144
|
+
* ```
|
|
3145
|
+
*
|
|
3146
|
+
* Optionally, you can pass a second callback argument, it makes `on` and `orOn` methods available.
|
|
3147
|
+
*
|
|
3148
|
+
* But remember that when joining a relation, the needed `ON` conditions are already handled automatically.
|
|
3149
|
+
*
|
|
3150
|
+
* ```ts
|
|
3151
|
+
* const result = await db.user.join(
|
|
3152
|
+
* (q) => q.messages.as('m'),
|
|
3153
|
+
* (q) =>
|
|
3154
|
+
* q
|
|
3155
|
+
* .on('text', 'name') // additionally, match message with user name
|
|
3156
|
+
* .where({ text: 'some text' }), // you can add `where` in a second callback as well.
|
|
3157
|
+
* );
|
|
3158
|
+
* ```
|
|
3159
|
+
*
|
|
3160
|
+
* ### Selecting full joined records
|
|
3161
|
+
*
|
|
3162
|
+
* `select` supports selecting a full record of a previously joined table by passing a table name with `.*` at the end:
|
|
3163
|
+
*
|
|
3164
|
+
* ```ts
|
|
3165
|
+
* const result = await db.book.join('author').select('title', {
|
|
3166
|
+
* author: 'author.*',
|
|
3167
|
+
* });
|
|
3168
|
+
*
|
|
3169
|
+
* // result has the following type:
|
|
3170
|
+
* const ok: {
|
|
3171
|
+
* // title of the book
|
|
3172
|
+
* title: string;
|
|
3173
|
+
* // a full author record is included:
|
|
3174
|
+
* author: { id: number; name: string; updatedAt: Date; createdAt: Date };
|
|
3175
|
+
* }[] = result;
|
|
3176
|
+
* ```
|
|
3177
|
+
*
|
|
3178
|
+
* It works fine for `1:1` (`belongsTo`, `hasOne`) relations, but it may have an unexpected result for `1:M` or `M:M` (`hasMany`, `hasAndBelongsToMany`) relations.
|
|
3179
|
+
* For any kind of relation, it results in one main table record with data of exactly one joined table record, i.e. when selecting in this way, the records **won't** be collected into arrays.
|
|
3180
|
+
*
|
|
3181
|
+
* ```ts
|
|
3182
|
+
* const result = await db.user
|
|
3183
|
+
* .join('messages')
|
|
3184
|
+
* .where({ 'messages.text': { startsWith: 'Hi' } })
|
|
3185
|
+
* .select('name', { messages: 'messages.*' });
|
|
3186
|
+
*
|
|
3187
|
+
* // result has the following type:
|
|
3188
|
+
* const ok: {
|
|
3189
|
+
* name: string;
|
|
3190
|
+
* // full message is included:
|
|
3191
|
+
* messages: { id: number; text: string; updatedAt: Date; createdAt: Date };
|
|
3192
|
+
* }[] = result;
|
|
3193
|
+
* ```
|
|
3194
|
+
*
|
|
3195
|
+
* Because it's a one-to-many relation, one user has many messages, the user data will be duplicated for different messages data:
|
|
3196
|
+
*
|
|
3197
|
+
* | name | msg |
|
|
3198
|
+
* | ------ | ------------------------------ |
|
|
3199
|
+
* | user 1 | `{ id: 1, text: 'message 1' }` |
|
|
3200
|
+
* | user 1 | `{ id: 2, text: 'message 2' }` |
|
|
3201
|
+
* | user 1 | `{ id: 3, text: 'message 3' }` |
|
|
3202
|
+
*
|
|
3203
|
+
* ### join table
|
|
3204
|
+
*
|
|
3205
|
+
* If relation wasn't defined, provide a `db.table` instance and specify columns for the join.
|
|
3206
|
+
* Joined table can be references from `where` and `select` by a table name.
|
|
3207
|
+
*
|
|
3208
|
+
* ```ts
|
|
3209
|
+
* // Join message where userId = id:
|
|
3210
|
+
* db.user
|
|
3211
|
+
* .join(db.message, 'userId', 'id')
|
|
3212
|
+
* .where({ 'message.text': { startsWith: 'Hi' } })
|
|
3213
|
+
* .select('name', 'message.text');
|
|
3214
|
+
* ```
|
|
3215
|
+
*
|
|
3216
|
+
* Columns in the join list may be prefixed with table names for clarity:
|
|
3217
|
+
*
|
|
3218
|
+
* ```ts
|
|
3219
|
+
* db.user.join(db.message, 'message.userId', 'user.id');
|
|
3220
|
+
* ```
|
|
3221
|
+
*
|
|
3222
|
+
* Joined table can have an alias for referencing it further:
|
|
3223
|
+
*
|
|
3224
|
+
* ```ts
|
|
3225
|
+
* db.user
|
|
3226
|
+
* .join(db.message.as('m'), 'message.userId', 'user.id')
|
|
3227
|
+
* .where({ 'm.text': { startsWith: 'Hi' } })
|
|
3228
|
+
* .select('name', 'm.text');
|
|
3229
|
+
* ```
|
|
3230
|
+
*
|
|
3231
|
+
* Joined table can be selected as an object as well as the relation join above:
|
|
3232
|
+
*
|
|
3233
|
+
* ```ts
|
|
3234
|
+
* const result = await db.user
|
|
3235
|
+
* .join(db.message.as('m'), 'message.userId', 'user.id')
|
|
3236
|
+
* .where({ 'm.text': { startsWith: 'Hi' } })
|
|
3237
|
+
* .select('name', { msg: 'm.*' });
|
|
3238
|
+
*
|
|
3239
|
+
* // result has the following type:
|
|
3240
|
+
* const ok: {
|
|
3241
|
+
* name: string;
|
|
3242
|
+
* // full message is included as msg:
|
|
3243
|
+
* msg: { id: number; text: string; updatedAt: Date; createdAt: Date };
|
|
3244
|
+
* }[] = result;
|
|
3245
|
+
* ```
|
|
3246
|
+
*
|
|
3247
|
+
* You can provide a custom comparison operator
|
|
3248
|
+
*
|
|
3249
|
+
* ```ts
|
|
3250
|
+
* db.user.join(db.message, 'userId', '!=', 'id');
|
|
3251
|
+
* ```
|
|
3252
|
+
*
|
|
3253
|
+
* Join can accept raw SQL for the `ON` part of join:
|
|
3254
|
+
*
|
|
3255
|
+
* ```ts
|
|
3256
|
+
* db.user.join(
|
|
3257
|
+
* db.message,
|
|
3258
|
+
* db.user.sql`lower("message"."text") = lower("user"."name")`,
|
|
3259
|
+
* );
|
|
3260
|
+
* ```
|
|
3261
|
+
*
|
|
3262
|
+
* Join can accept raw SQL instead of columns:
|
|
3263
|
+
*
|
|
3264
|
+
* ```ts
|
|
3265
|
+
* db.user.join(
|
|
3266
|
+
* db.message,
|
|
3267
|
+
* db.user.sql`lower("message"."text")`,
|
|
3268
|
+
* db.user.sql`lower("user"."name")`,
|
|
3269
|
+
* );
|
|
3270
|
+
*
|
|
3271
|
+
* // with operator:
|
|
3272
|
+
* db.user.join(
|
|
3273
|
+
* db.message,
|
|
3274
|
+
* db.user.sql`lower("message"."text")`,
|
|
3275
|
+
* '!=',
|
|
3276
|
+
* db.user.sql`lower("user"."name")`,
|
|
3277
|
+
* );
|
|
3278
|
+
* ```
|
|
3279
|
+
*
|
|
3280
|
+
* To join based on multiple columns, you can provide an object where keys are joining table columns, and values are main table columns or a raw SQL:
|
|
3281
|
+
*
|
|
3282
|
+
* ```ts
|
|
3283
|
+
* db.user.join(db.message, {
|
|
3284
|
+
* userId: 'id',
|
|
3285
|
+
*
|
|
3286
|
+
* // with table names:
|
|
3287
|
+
* 'message.userId': 'user.id',
|
|
3288
|
+
*
|
|
3289
|
+
* // value can be a raw SQL expression:
|
|
3290
|
+
* text: db.user.sql`lower("user"."name")`,
|
|
3291
|
+
* });
|
|
3292
|
+
* ```
|
|
3293
|
+
*
|
|
3294
|
+
* Join all records without conditions by providing `true`:
|
|
3295
|
+
*
|
|
3296
|
+
* ```ts
|
|
3297
|
+
* db.user.join(db.message, true);
|
|
3298
|
+
* ```
|
|
3299
|
+
*
|
|
3300
|
+
* Join methods can accept a callback with a special query builder that has `on` and `orOn` methods for handling advanced cases:
|
|
3301
|
+
*
|
|
3302
|
+
* ```ts
|
|
3303
|
+
* db.user.join(
|
|
3304
|
+
* db.message,
|
|
3305
|
+
* (q) =>
|
|
3306
|
+
* q
|
|
3307
|
+
* // left column is the db.message column, right column is the db.user column
|
|
3308
|
+
* .on('userId', 'id')
|
|
3309
|
+
* // table names can be provided:
|
|
3310
|
+
* .on('message.userId', 'user.id')
|
|
3311
|
+
* // operator can be specified:
|
|
3312
|
+
* .on('userId', '!=', 'id')
|
|
3313
|
+
* // operator can be specified with table names as well:
|
|
3314
|
+
* .on('message.userId', '!=', 'user.id')
|
|
3315
|
+
* // `.orOn` takes the same arguments as `.on` and acts like `.or`:
|
|
3316
|
+
* .on('userId', 'id') // where message.userId = user.id
|
|
3317
|
+
* .orOn('text', 'name'), // or message.text = user.name
|
|
3318
|
+
* );
|
|
3319
|
+
* ```
|
|
3320
|
+
*
|
|
3321
|
+
* Join query builder supports all `where` methods: `.where`, `.whereIn`, `.whereExists`, and all `.or`, `.not`, and `.orNot` forms.
|
|
3322
|
+
*
|
|
3323
|
+
* Column names in the where conditions are applied for the joined table, but you can specify a table name to add a condition for the main table.
|
|
3324
|
+
*
|
|
3325
|
+
* ```ts
|
|
3326
|
+
* db.user.join(db.message, (q) =>
|
|
3327
|
+
* q
|
|
3328
|
+
* .on('userId', 'id')
|
|
3329
|
+
* .where({
|
|
3330
|
+
* // not prefixed column name is for joined table:
|
|
3331
|
+
* text: { startsWith: 'hello' },
|
|
3332
|
+
* // specify a table name to set condition on the main table:
|
|
3333
|
+
* 'user.name': 'Bob',
|
|
3334
|
+
* })
|
|
3335
|
+
* // id is a column of a joined table Message
|
|
3336
|
+
* .whereIn('id', [1, 2, 3])
|
|
3337
|
+
* // condition for id of a user
|
|
3338
|
+
* .whereIn('user.id', [4, 5, 6]),
|
|
3339
|
+
* );
|
|
3340
|
+
* ```
|
|
3341
|
+
*
|
|
3342
|
+
* The query above will generate the following SQL (simplified):
|
|
3343
|
+
*
|
|
3344
|
+
* ```sql
|
|
3345
|
+
* SELECT * FROM "user"
|
|
3346
|
+
* JOIN "message"
|
|
3347
|
+
* ON "message"."userId" = "user"."id"
|
|
3348
|
+
* AND "message"."text" ILIKE 'hello%'
|
|
3349
|
+
* AND "user"."name" = 'Bob'
|
|
3350
|
+
* AND "message"."id" IN (1, 2, 3)
|
|
3351
|
+
* AND "user"."id" IN (4, 5, 6)
|
|
3352
|
+
* ```
|
|
3353
|
+
*
|
|
3354
|
+
* The join argument can be a query with `select`, `where`, and other methods. In such case, it will be handled as a sub query:
|
|
3355
|
+
*
|
|
3356
|
+
* ```ts
|
|
3357
|
+
* db.user.join(
|
|
3358
|
+
* db.message
|
|
3359
|
+
* .select('id', 'userId', 'text')
|
|
3360
|
+
* .where({ text: { startsWith: 'Hi' } })
|
|
3361
|
+
* .as('t'),
|
|
3362
|
+
* 'userId',
|
|
3363
|
+
* 'id',
|
|
3364
|
+
* );
|
|
3365
|
+
* ```
|
|
3366
|
+
*
|
|
3367
|
+
* It will produce such SQL:
|
|
3368
|
+
*
|
|
3369
|
+
* ```sql
|
|
3370
|
+
* SELECT * FROM "user"
|
|
3371
|
+
* JOIN (
|
|
3372
|
+
* SELECT "t"."id", "t"."userId", "t"."text"
|
|
3373
|
+
* FROM "message" AS "t"
|
|
3374
|
+
* ) "t" ON "t"."userId" = "user"."id"
|
|
3375
|
+
* ```
|
|
3376
|
+
*
|
|
3377
|
+
* @param arg - {@link JoinFirstArg}
|
|
3378
|
+
* @param args - {@link JoinArgs}
|
|
3021
3379
|
*/
|
|
3022
3380
|
join<T extends Query, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResult<T, Arg, true, true>;
|
|
3381
|
+
/**
|
|
3382
|
+
* A join variant accepting a {@link JoinCallback}, see {@link join} for full info.
|
|
3383
|
+
* @param arg - {@link JoinFirstArg}
|
|
3384
|
+
* @param cb - {@link JoinCallback}
|
|
3385
|
+
*/
|
|
3023
3386
|
join<T extends Query, Arg extends JoinFirstArg<T>, Cb extends JoinCallback<T, Arg>>(this: T, arg: Arg, cb: Cb): JoinResult<T, Arg, true, true, Cb>;
|
|
3024
3387
|
_join<T extends Query, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResult<T, Arg, true, true>;
|
|
3025
3388
|
_join<T extends Query, Arg extends JoinFirstArg<T>, Cb extends JoinCallback<T, Arg>>(this: T, arg: Arg, cb: Cb): JoinResult<T, Arg, true, true, Cb>;
|
|
3389
|
+
/**
|
|
3390
|
+
* `leftJoin` is a method for SQL `LEFT JOIN`, which is equivalent to `OUTER JOIN`, `LEFT OUTER JOIN`.
|
|
3391
|
+
*
|
|
3392
|
+
* When no matching record is found, it will fill joined table columns with `NULL` values in the result rows.
|
|
3393
|
+
*
|
|
3394
|
+
* Works just like `join`, except for result type that may have `null`:
|
|
3395
|
+
*
|
|
3396
|
+
* ```ts
|
|
3397
|
+
* const result = await db.user
|
|
3398
|
+
* .leftJoin('messages')
|
|
3399
|
+
* .select('name', 'messages.text');
|
|
3400
|
+
*
|
|
3401
|
+
* // the same query, but joining table explicitly
|
|
3402
|
+
* const result2: typeof result = await db.user
|
|
3403
|
+
* .leftJoin(db.message, 'userId', 'id')
|
|
3404
|
+
* .select('name', 'message.text');
|
|
3405
|
+
*
|
|
3406
|
+
* // result has the following type:
|
|
3407
|
+
* const ok: { name: string; text: string | null }[] = result;
|
|
3408
|
+
* ```
|
|
3409
|
+
*
|
|
3410
|
+
* @param arg - {@link JoinFirstArg}
|
|
3411
|
+
* @param args - {@link JoinArgs}
|
|
3412
|
+
*/
|
|
3026
3413
|
leftJoin<T extends Query, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResult<T, Arg, false, true>;
|
|
3414
|
+
/**
|
|
3415
|
+
* A `leftJoin` variant accepting a {@link JoinCallback}, see {@link join} for full info.
|
|
3416
|
+
* @param arg - {@link JoinFirstArg}
|
|
3417
|
+
* @param cb - {@link JoinCallback}
|
|
3418
|
+
*/
|
|
3027
3419
|
leftJoin<T extends Query, Arg extends JoinFirstArg<T>, Cb extends JoinCallback<T, Arg>>(this: T, arg: Arg, cb: Cb): JoinResult<T, Arg, false, true, Cb>;
|
|
3028
3420
|
_leftJoin<T extends Query, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResult<T, Arg, false, true>;
|
|
3029
3421
|
_leftJoin<T extends Query, Arg extends JoinFirstArg<T>, Cb extends JoinCallback<T, Arg>>(this: T, arg: Arg, cb: Cb): JoinResult<T, Arg, false, true, Cb>;
|
|
3422
|
+
/**
|
|
3423
|
+
* `rightJoin` is a method for SQL `RIGHT JOIN`, which is equivalent to `RIGHT OUTER JOIN`.
|
|
3424
|
+
*
|
|
3425
|
+
* Takes the same arguments as `json`.
|
|
3426
|
+
*
|
|
3427
|
+
* It will load all records from the joining table, and fill the main table columns with `null` when no match is found.
|
|
3428
|
+
*
|
|
3429
|
+
* The columns of the table you're joining to are becoming nullable when using `rightJoin`.
|
|
3430
|
+
*
|
|
3431
|
+
* ```ts
|
|
3432
|
+
* const result = await db.user
|
|
3433
|
+
* .rightJoin('messages')
|
|
3434
|
+
* .select('name', 'messages.text');
|
|
3435
|
+
*
|
|
3436
|
+
* // even though name is not a nullable column, it becomes nullable after using rightJoin
|
|
3437
|
+
* const ok: { name: string | null; text: string }[] = result;
|
|
3438
|
+
* ```
|
|
3439
|
+
*
|
|
3440
|
+
* @param arg - {@link JoinFirstArg}
|
|
3441
|
+
* @param args - {@link JoinArgs}
|
|
3442
|
+
*/
|
|
3030
3443
|
rightJoin<T extends Query, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResult<T, Arg, true, false>;
|
|
3444
|
+
/**
|
|
3445
|
+
* A `rightJoin` variant accepting a {@link JoinCallback}, see {@link join} for full info.
|
|
3446
|
+
* @param arg - {@link JoinFirstArg}
|
|
3447
|
+
* @param cb - {@link JoinCallback}
|
|
3448
|
+
*/
|
|
3031
3449
|
rightJoin<T extends Query, Arg extends JoinFirstArg<T>, Cb extends JoinCallback<T, Arg>>(this: T, arg: Arg, cb: Cb): JoinResult<T, Arg, true, false, Cb>;
|
|
3032
3450
|
_rightJoin<T extends Query, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResult<T, Arg, true, false>;
|
|
3033
3451
|
_rightJoin<T extends Query, Arg extends JoinFirstArg<T>, Cb extends JoinCallback<T, Arg>>(this: T, arg: Arg, cb: Cb): JoinResult<T, Arg, true, false, Cb>;
|
|
3452
|
+
/**
|
|
3453
|
+
* `fullJoin` is a method for SQL `FULL JOIN`, which is equivalent to `FULL OUTER JOIN`.
|
|
3454
|
+
*
|
|
3455
|
+
* Takes the same arguments as `json`.
|
|
3456
|
+
*
|
|
3457
|
+
* It will load all records from the joining table, both sides of the join may result in `null` values when there is no match.
|
|
3458
|
+
*
|
|
3459
|
+
* All columns become nullable after using `fullJoin`.
|
|
3460
|
+
*
|
|
3461
|
+
* ```ts
|
|
3462
|
+
* const result = await db.user
|
|
3463
|
+
* .rightJoin('messages')
|
|
3464
|
+
* .select('name', 'messages.text');
|
|
3465
|
+
*
|
|
3466
|
+
* // all columns can be null
|
|
3467
|
+
* const ok: { name: string | null; text: string | null }[] = result;
|
|
3468
|
+
* ```
|
|
3469
|
+
*
|
|
3470
|
+
* @param arg - {@link JoinFirstArg}
|
|
3471
|
+
* @param args - {@link JoinArgs}
|
|
3472
|
+
*/
|
|
3034
3473
|
fullJoin<T extends Query, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResult<T, Arg, false, false>;
|
|
3474
|
+
/**
|
|
3475
|
+
* A `fullJoin` variant accepting a {@link JoinCallback}, see {@link join} for full info.
|
|
3476
|
+
* @param arg - {@link JoinFirstArg}
|
|
3477
|
+
* @param cb - {@link JoinCallback}
|
|
3478
|
+
*/
|
|
3035
3479
|
fullJoin<T extends Query, Arg extends JoinFirstArg<T>, Cb extends JoinCallback<T, Arg>>(this: T, arg: Arg, cb: Cb): JoinResult<T, Arg, false, false, Cb>;
|
|
3036
3480
|
_fullJoin<T extends Query, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResult<T, Arg, false, false>;
|
|
3037
3481
|
_fullJoin<T extends Query, Arg extends JoinFirstArg<T>, Cb extends JoinCallback<T, Arg>>(this: T, arg: Arg, cb: Cb): JoinResult<T, Arg, false, false, Cb>;
|
|
3482
|
+
/**
|
|
3483
|
+
* `joinLateral` allows joining a table with a sub-query that can reference the main table of current query and the other joined tables.
|
|
3484
|
+
*
|
|
3485
|
+
* Regular `JOIN` also can have a sub-query in its definition, but it cannot reference other tables of this query.
|
|
3486
|
+
*
|
|
3487
|
+
* `JOIN LATERAL` of Postgres can have conditions in the `ON` statement, but `Orchid ORM` decided that there are no useful use-cases for such conditions, and it is only building a sub-query.
|
|
3488
|
+
*
|
|
3489
|
+
* First argument is the other table you want to join, or a name of relation, or a name of `with` defined table.
|
|
3490
|
+
*
|
|
3491
|
+
* Second argument is a callback where you can reference other tables using `on` and `orOn`, select columns, do `where` conditions, and use any other query methods to build a sub-query.
|
|
3492
|
+
*
|
|
3493
|
+
* ```ts
|
|
3494
|
+
* // joinLateral a Message table, alias it as `m`
|
|
3495
|
+
* // without aliasing you can refer to the message by a table name
|
|
3496
|
+
* User.joinLateral(Message.as('m'), (q) =>
|
|
3497
|
+
* q
|
|
3498
|
+
* // select message columns
|
|
3499
|
+
* .select('text')
|
|
3500
|
+
* // join the message to the user, column names can be prefixed with table names
|
|
3501
|
+
* .on('authorId', 'id')
|
|
3502
|
+
* // message columns are available without prefixing,
|
|
3503
|
+
* // outer table columns are available with a table name
|
|
3504
|
+
* .where({ text: 'some text', 'user.name': 'name' })
|
|
3505
|
+
* .order({ createdAt: 'DESC' }),
|
|
3506
|
+
* )
|
|
3507
|
+
* // only selected message columns are available in select and where
|
|
3508
|
+
* .select('id', 'name', 'm.text')
|
|
3509
|
+
* .where({ 'm.text': messageData.text });
|
|
3510
|
+
* ```
|
|
3511
|
+
*
|
|
3512
|
+
* As well as simple `join`, `joinLateral` can select an object of full joined record:
|
|
3513
|
+
*
|
|
3514
|
+
* ```ts
|
|
3515
|
+
* // join by relation name
|
|
3516
|
+
* const result = await User.joinLateral(
|
|
3517
|
+
* 'messages',
|
|
3518
|
+
* (q) => q.as('message'), // alias to 'message'
|
|
3519
|
+
* ).select('name', { message: 'message.*' });
|
|
3520
|
+
*
|
|
3521
|
+
* // result has the following type:
|
|
3522
|
+
* const ok: {
|
|
3523
|
+
* name: string;
|
|
3524
|
+
* // full message is included:
|
|
3525
|
+
* message: { id: number; text: string; updatedAt: Date; createdAt: Date };
|
|
3526
|
+
* }[] = result;
|
|
3527
|
+
* ```
|
|
3528
|
+
*
|
|
3529
|
+
* `message` can be aliased withing the `select` as well as in case of a simple `join`:
|
|
3530
|
+
*
|
|
3531
|
+
* ```ts
|
|
3532
|
+
* // join by relation name
|
|
3533
|
+
* const result = await User.joinLateral(
|
|
3534
|
+
* 'messages',
|
|
3535
|
+
* (q) => q.as('message'), // alias to 'message'
|
|
3536
|
+
* ).select('name', { msg: 'message.*' });
|
|
3537
|
+
*
|
|
3538
|
+
* // result has the following type:
|
|
3539
|
+
* const ok: {
|
|
3540
|
+
* name: string;
|
|
3541
|
+
* // full message is included as msg:
|
|
3542
|
+
* msg: { id: number; text: string; updatedAt: Date; createdAt: Date };
|
|
3543
|
+
* }[] = result;
|
|
3544
|
+
* ```
|
|
3545
|
+
*
|
|
3546
|
+
* @param arg - {@link JoinFirstArg}
|
|
3547
|
+
* @param cb - {@link JoinLateralCallback}
|
|
3548
|
+
*/
|
|
3038
3549
|
joinLateral<T extends Query, Arg extends JoinFirstArg<T>, R extends QueryBase>(this: T, arg: Arg, cb: JoinLateralCallback<T, Arg, R>): JoinLateralResult<T, R, true>;
|
|
3039
3550
|
_joinLateral<T extends Query, Arg extends JoinFirstArg<T>, R extends QueryBase>(this: T, arg: Arg, cb: JoinLateralCallback<T, Arg, R>): JoinLateralResult<T, R, true>;
|
|
3551
|
+
/**
|
|
3552
|
+
* The same as {@link joinLateral}, but when no records found for the join it will result in `null`:
|
|
3553
|
+
*
|
|
3554
|
+
* ```ts
|
|
3555
|
+
* const result = await db.user
|
|
3556
|
+
* .leftJoinLateral('messages', (q) => q.as('message'))
|
|
3557
|
+
* .select('name', 'message.text');
|
|
3558
|
+
*
|
|
3559
|
+
* // result has the following type:
|
|
3560
|
+
* const ok: { name: string; text: string | null }[] = result;
|
|
3561
|
+
* ```
|
|
3562
|
+
*
|
|
3563
|
+
* @param arg - {@link JoinFirstArg}
|
|
3564
|
+
* @param cb - {@link JoinLateralCallback}
|
|
3565
|
+
*/
|
|
3040
3566
|
leftJoinLateral<T extends Query, Arg extends JoinFirstArg<T>, R extends QueryBase>(this: T, arg: Arg, cb: JoinLateralCallback<T, Arg, R>): JoinLateralResult<T, R, false>;
|
|
3041
3567
|
_leftJoinLateral<T extends Query, Arg extends JoinFirstArg<T>, R extends QueryBase>(this: T, arg: Arg, cb: JoinLateralCallback<T, Arg, R>): JoinLateralResult<T, R, false>;
|
|
3042
3568
|
}
|
|
@@ -3050,7 +3576,6 @@ type OnArgs<Q extends {
|
|
|
3050
3576
|
declare const pushQueryOn: <T extends QueryBase>(q: T, joinFrom: QueryBase, joinTo: QueryBase, ...on: OnArgs<QueryBase>) => T;
|
|
3051
3577
|
declare const pushQueryOrOn: typeof pushQueryOn;
|
|
3052
3578
|
declare const addQueryOn: <T extends QueryBase>(q: T, joinFrom: QueryBase, joinTo: QueryBase, ...args: OnArgs<QueryBase>) => T;
|
|
3053
|
-
declare const addQueryOrOn: typeof pushQueryOrOn;
|
|
3054
3579
|
type OnJsonPathEqualsArgs<T extends QueryBase> = [
|
|
3055
3580
|
leftColumn: keyof T['selectable'],
|
|
3056
3581
|
leftPath: string,
|
|
@@ -4976,6 +5501,52 @@ declare class QueryMethods<CT extends ColumnTypesBase> {
|
|
|
4976
5501
|
restartIdentity?: boolean;
|
|
4977
5502
|
cascade?: boolean;
|
|
4978
5503
|
}): TruncateResult<T>;
|
|
5504
|
+
/**
|
|
5505
|
+
* `modify` allows modifying the query with your function:
|
|
5506
|
+
*
|
|
5507
|
+
* ```ts
|
|
5508
|
+
* const doSomethingWithQuery = (q: typeof db.table) => {
|
|
5509
|
+
* // can use all query methods
|
|
5510
|
+
* return q.select('name').where({ active: true }).order({ createdAt: 'DESC' });
|
|
5511
|
+
* };
|
|
5512
|
+
*
|
|
5513
|
+
* const record = await db.table.select('id').modify(doSomethingWithQuery).find(1);
|
|
5514
|
+
*
|
|
5515
|
+
* record.id; // id was selected before `modify`
|
|
5516
|
+
* record.name; // name was selected by the function
|
|
5517
|
+
* ```
|
|
5518
|
+
*
|
|
5519
|
+
* It's possible to apply different `select`s inside the function, and then the result type will be a union of all possibilities:
|
|
5520
|
+
*
|
|
5521
|
+
* Use this sparingly as it complicates dealing with the result.
|
|
5522
|
+
*
|
|
5523
|
+
* ```ts
|
|
5524
|
+
* const doSomethingWithQuery = (q: typeof db.table) => {
|
|
5525
|
+
* if (Math.random() > 0.5) {
|
|
5526
|
+
* return q.select('one');
|
|
5527
|
+
* } else {
|
|
5528
|
+
* return q.select('two');
|
|
5529
|
+
* }
|
|
5530
|
+
* };
|
|
5531
|
+
*
|
|
5532
|
+
* const record = await db.table.modify(doSomethingWithQuery).find(1);
|
|
5533
|
+
*
|
|
5534
|
+
* // TS error: we don't know for sure if the `one` was selected.
|
|
5535
|
+
* record.one;
|
|
5536
|
+
*
|
|
5537
|
+
* // use `in` operator to disambiguate the result type
|
|
5538
|
+
* if ('one' in record) {
|
|
5539
|
+
* record.one;
|
|
5540
|
+
* } else {
|
|
5541
|
+
* record.two;
|
|
5542
|
+
* }
|
|
5543
|
+
* ```
|
|
5544
|
+
*
|
|
5545
|
+
* @param fn - function to modify the query with. The result type will be merged with the main query as if the `merge` method was used.
|
|
5546
|
+
*/
|
|
5547
|
+
modify<T extends Query, Arg extends Query & {
|
|
5548
|
+
table: T['table'];
|
|
5549
|
+
}, Result>(this: T, fn: (q: Arg) => Result): Result extends Query ? MergeQuery<T, Result> : Result;
|
|
4979
5550
|
/**
|
|
4980
5551
|
* Use `makeHelper` to make a query helper - a function where you can modify the query, and reuse this function across different places.
|
|
4981
5552
|
*
|
|
@@ -6508,4 +7079,4 @@ declare const testTransaction: {
|
|
|
6508
7079
|
close(arg: Arg): Promise<void>;
|
|
6509
7080
|
};
|
|
6510
7081
|
|
|
6511
|
-
export { Adapter, AdapterConfig, AdapterOptions, AddQuerySelect, AddQueryWith, AfterHook, AggregateMethods, AggregateOptions, AliasOrTable, ArrayColumn, ArrayData, ArrayOfColumnsObjects, AsMethods, BaseOperators, 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, Having, HavingItem, HookAction, HookSelect, IdentityColumn, IndexColumnOptions, IndexOptions, InetColumn, InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, IsolationLevel, JSONColumn, JSONTextColumn, 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, RelationConfigBase, RelationQuery, RelationQueryBase, RelationSubQueries, RelationsBase, SearchArg, SearchMethods, SearchWeight, Select, SelectAggMethods, SelectArg, SelectItem, SelectQueryBuilder, SelectQueryData, Selectable, SelectableBase, SelectableFromShape, SelectableOfType, SelectableOrExpression, SelectableOrExpressionOfType, SerialColumn, SerialColumnData, SetQueryKind, SetQueryReturns, SetQueryReturnsAll, SetQueryReturnsColumn, SetQueryReturnsColumnInfo, SetQueryReturnsColumnOptional, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsPluck, SetQueryReturnsRowCount, SetQueryReturnsRows, SetQueryReturnsValue, SetQueryReturnsValueOptional, SetQueryReturnsVoid, SetQueryTableAlias, SetQueryWith, SimpleJoinItem, SingleColumnIndexOptions, SmallIntColumn, SmallSerialColumn, SortDir, StringColumn, SubQueryBuilder, 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, WhereQueryBase, WhereQueryBuilder, WhereResult, WhereSearchItem, WhereSearchResult, WindowArg, WindowArgDeclaration, WindowDeclaration, WindowItem, With, WithDataBase, WithDataItem, WithItem, WithOptions, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addQueryOn,
|
|
7082
|
+
export { Adapter, AdapterConfig, AdapterOptions, AddQuerySelect, AddQueryWith, AfterHook, AggregateMethods, AggregateOptions, AliasOrTable, ArrayColumn, ArrayData, ArrayOfColumnsObjects, AsMethods, BaseOperators, 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, Having, HavingItem, HookAction, HookSelect, IdentityColumn, IndexColumnOptions, IndexOptions, InetColumn, InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, IsolationLevel, JSONColumn, JSONTextColumn, 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, RelationConfigBase, RelationQuery, RelationQueryBase, RelationSubQueries, RelationsBase, SearchArg, SearchMethods, SearchWeight, Select, SelectAggMethods, SelectArg, SelectItem, SelectQueryBuilder, SelectQueryData, Selectable, SelectableBase, SelectableFromShape, SelectableOfType, SelectableOrExpression, SelectableOrExpressionOfType, SerialColumn, SerialColumnData, SetQueryKind, SetQueryReturns, SetQueryReturnsAll, SetQueryReturnsColumn, SetQueryReturnsColumnInfo, SetQueryReturnsColumnOptional, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsPluck, SetQueryReturnsRowCount, SetQueryReturnsRows, SetQueryReturnsValue, SetQueryReturnsValueOptional, SetQueryReturnsVoid, SetQueryTableAlias, SetQueryWith, SimpleJoinItem, SingleColumnIndexOptions, SmallIntColumn, SmallSerialColumn, SortDir, StringColumn, SubQueryBuilder, 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, WhereQueryBase, WhereQueryBuilder, WhereResult, WhereSearchItem, WhereSearchResult, WindowArg, WindowArgDeclaration, WindowDeclaration, WindowItem, With, WithDataBase, WithDataItem, WithItem, WithOptions, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addQueryOn, addWhere, addWhereIn, addWhereNot, anyShape, checkIfASimpleQuery, cloneQueryArrays, columnCheckToCode, columnCode, columnForeignKeysToCode, columnIndexesToCode, columnTypes, columnsByType, columnsShapeToCode, constraintPropsToCode, constraintToCode, createDb, createOperator, foreignKeyArgumentToCode, getClonedQueryData, getColumnTypes, getConstraintKind, getQueryAs, getShapeFromSelect, getSubQueryBuilder, getTableData, handleResult, identityToCode, indexToCode, instantiateColumn, isQueryReturnsAll, isSelectingCount, joinSubQuery, logColors, logParamToLogObject, makeColumnFn, makeColumnFnClass, makeRegexToFindInSql, makeSQL, newTableData, parseRecord, parseResult, primaryKeyToCode, processSelectArg, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, queryMethodByReturnType, queryTypeWithLimitOne, quote, quoteString, raw, referencesArgsToCode, resetTableData, resolveSubQueryCallback, saveSearchAlias, setQueryObjectValue, simplifyColumnDefault, templateLiteralToSQL, testTransaction, throwIfNoWhere, toSQL, toSQLCacheKey };
|