2
0
mirror of https://github.com/frappe/books.git synced 2024-09-19 19:19:02 +00:00
books/backend/database/types.ts
18alantom 18dd3f8518 test: add more dbcore tests
- fix bugs in core.ts
2022-05-23 16:18:21 +05:30

58 lines
1.1 KiB
TypeScript

import { Field, RawValue } from '../../schemas/types';
import { DatabaseManager } from './manager';
export type QueryFilter = Record<string, string | string[]>;
export interface GetQueryBuilderOptions {
offset?: number;
limit?: number;
groupBy?: string;
orderBy?: string;
order?: 'desc' | 'asc';
}
export interface GetAllOptions {
fields?: string[];
filters?: QueryFilter;
offset?: number;
limit?: number;
groupBy?: string;
orderBy?: string;
order?: 'asc' | 'desc';
}
export type ColumnDiff = { added: Field[]; removed: string[] };
export type FieldValueMap = Record<
string,
RawValue | undefined | FieldValueMap[]
>;
export interface Patch {
name: string;
version: string;
patch: {
execute: (dm: DatabaseManager) => Promise<void>;
beforeMigrate?: boolean;
};
}
export type KnexColumnType =
| 'text'
| 'integer'
| 'float'
| 'boolean'
| 'date'
| 'datetime'
| 'time'
| 'binary';
// Returned by pragma table_info
export interface SqliteTableInfo {
pk: number;
cid: number;
name: string;
type: string;
notnull: number; // 0 | 1
dflt_value: string | null;
}