Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | import type { FindOptions } from './find-options.ts';
import type { Values } from './options.ts';
import type { QueryOptionsBase } from './runtime.ts';
/**
* Options of `Model.copyFrom`, which loads rows with `COPY ... FROM STDIN`. PostgreSQL extension.
*
* @postgrelize
* @see {@link Model.copyFrom}
*
* @example
* ```ts
* const opts: CopyFromOptions<User> = { columns: ['name', 'email'], transaction };
* await User.copyFrom([{ name: 'Ann', email: 'a@example.com' }], opts);
* ```
*/
export type CopyFromOptions<T = Values> = QueryOptionsBase &
Readonly<{
/** Attributes to copy, in row order; default: keys of the first row of an array source. */
columns?: readonly (keyof T & string)[];
}>;
/**
* Output format options of `Model.copyTo` (`COPY ... TO STDOUT`). PostgreSQL extension.
*
* @postgrelize
* @example
* ```ts
* const format: CopyToFormatOptions = { format: 'csv', header: true, delimiter: ';', nullString: '' };
* ```
*/
export type CopyToFormatOptions = Readonly<{
/** Output format.
* @defaultValue 'text' */
format?: 'text' | 'csv' | 'binary';
/** Emit a header line (csv).
* @defaultValue false */
header?: boolean;
/** Single-character field delimiter. Default: tab for `text`, comma for `csv`. */
delimiter?: string;
/** String written for NULL values. Default: `\N` for `text`, empty for `csv`. */
nullString?: string;
/** Single-character quote (csv). Default: `"`. */
quote?: string;
}>;
/**
* Options of `Model.copyTo`: a finder query that selects the exported rows plus the output format. PostgreSQL extension.
*
* @postgrelize
* @see {@link Model.copyTo}
*
* @example
* ```ts
* const opts: CopyToOptions<User> = { where: { active: true }, order: [['id', 'ASC']], format: 'csv', header: true };
* ```
*/
export type CopyToOptions<T = Values> = FindOptions<T> & CopyToFormatOptions;
|