import type { schemaMap } from './schema';
export type SchemaMap = typeof schemaMap;
export type Table = keyof SchemaMap;
export interface Options
{
metadataPrefix?: P;
}
export type PrefixMetadata = S extends `_${infer Name}` ? `${P}_${Name}` : S;
export type PrefixMetaProperties = {
[K in keyof O as PrefixMetadata]: O[K];
};
export type Field = T extends Table ? `${T}.${Extract}` : never;
type ToFieldName = F extends `${Table}.${infer FieldName}` ? FieldName : never;
type ToFieldType = F extends `${infer T}.${string}` ? T extends Table ? K extends keyof SchemaMap[T] ? SchemaMap[T][K] : never : never : never;
export type Item = {
[K in ToFieldName]: ToFieldType;
};
export type JoinOn> = LeftField extends `${infer LeftTable}.${string}` ? {
left: LeftField;
right: Field>;
} : never;
export interface OrderBy {
field: Field;
desc?: boolean;
}
export interface Parameter, LeftField extends Field> {
tables: T[];
fields?: Fields[];
where?: string;
joinOn?: JoinOn[];
groupBy?: Field[];
having?: string;
orderBy?: OrderBy[];
limit?: number;
offset?: number;
format?: string;
}
export {};