export interface EntityType { _saved: TSaved; _unsaved: TUnsaved; _idKeys: TIds; idOf: (rec: TSaved) => TIds; } export declare type UnsavedR = T["_unsaved"]; export declare type SavedR = T["_saved"]; export declare type KeyType = R["_idKeys"]; export interface PgRecordInfo extends EntityType { tableName: string; schemaName: string; idKeys: (keyof Saved)[]; } /** * Extract the runtime key name from a recordInfo */ export declare function idKeysOf(recordInfoWithIdKey: RI): string[]; /** * Turns a record type with possibly more fields than "id" into an array */ export declare function collectIdValues(idObj: KeyType, knexRecordType: RecordT): string[]; /** * * Creates a record descriptor that captures the table name, primary key name, * unsaved type, and saved type of a database record type. Assumes "id" as the * primary key name * */ export declare function recordInfo(schemaName: string, tableName: string): PgRecordInfo>; export declare function recordInfo(schemaName: string, tableName: string): PgRecordInfo>; /** * * Creates a record descriptor that captures the table name, primary key name, * unsaved type, and saved type of a database record type. * */ export declare function recordInfo(schemaName: string, tableName: string, idKey: Id[]): PgRecordInfo>; /** * * Creates a record descriptor for records with composite primary keys * */ export declare function compositeRecordType(schemaName: string, tableName: string): { withCompositeKeys(keys: TKeys[]): PgRecordInfo>; };