2023-03-29 12:50:32 +02:00
|
|
|
import Knex from '../types';
|
|
|
|
import { clientConfig, User } from './common';
|
|
|
|
import { expectType } from 'tsd';
|
|
|
|
|
|
|
|
const knex = Knex(clientConfig);
|
|
|
|
|
|
|
|
const main = async () => {
|
|
|
|
expectType<User[]>(
|
|
|
|
await knex<User>('users')
|
|
|
|
.groupBy('count')
|
|
|
|
.orderBy('name', 'desc')
|
|
|
|
.havingNull('age')
|
|
|
|
);
|
|
|
|
|
2023-11-28 23:17:27 +08:00
|
|
|
expectType<User[]>(
|
|
|
|
await knex<User>('users')
|
|
|
|
.groupBy('count')
|
|
|
|
.orderBy('name', 'desc')
|
|
|
|
.havingNull('age')
|
|
|
|
.orHavingNull('name')
|
|
|
|
);
|
|
|
|
|
|
|
|
expectType<User[]>(
|
|
|
|
await knex<User>('users')
|
|
|
|
.groupBy('count')
|
|
|
|
.orderBy('name', 'desc')
|
|
|
|
.havingNotNull('age')
|
|
|
|
);
|
|
|
|
|
2023-03-29 12:50:32 +02:00
|
|
|
expectType<User[]>(
|
|
|
|
await knex<User>('users')
|
|
|
|
.groupBy('count')
|
|
|
|
.orderBy('name', 'desc')
|
|
|
|
.havingNotNull('age')
|
2023-11-28 23:17:27 +08:00
|
|
|
.orHavingNotNull('name')
|
2023-03-29 12:50:32 +02:00
|
|
|
);
|
2023-07-12 21:42:57 +01:00
|
|
|
};
|