import { MySqlRemoteDatabase, MySqlRemotePreparedQueryHKT, MySqlRemoteQueryResultHKT } from "drizzle-orm/mysql-proxy"; import { SelectedFields } from "drizzle-orm/mysql-core/query-builders/select.types"; import { ForgeSqlOrmOptions } from "../../.."; import { MySqlSelectBase, MySqlSelectBuilder } from "drizzle-orm/mysql-core"; import { MySqlTable } from "drizzle-orm/mysql-core/table"; import { MySqlDeleteBase, MySqlInsertBuilder, MySqlUpdateBuilder } from "drizzle-orm/mysql-core/query-builders"; import { SQLWrapper } from "drizzle-orm/sql/sql"; import type { MySqlQueryResultKind } from "drizzle-orm/mysql-core/session"; import { GetSelectTableName, GetSelectTableSelection, SelectResultField } from "drizzle-orm/query-builders/select.types"; /** * Type for select queries with field aliasing */ export type SelectAliasedType = (fields: TSelection) => MySqlSelectBuilder; /** * Type for select distinct queries with field aliasing */ export type SelectAliasedDistinctType = (fields: TSelection) => MySqlSelectBuilder; /** * Type for select queries with field aliasing and caching */ export type SelectAliasedCacheableType = (fields: TSelection, cacheTtl?: number) => MySqlSelectBuilder; /** * Type for select distinct queries with field aliasing and caching */ export type SelectAliasedDistinctCacheableType = (fields: TSelection, cacheTtl?: number) => MySqlSelectBuilder; /** * Type for select queries from table with field aliasing */ export type SelectAllFromAliasedType = (table: T) => MySqlSelectBase, GetSelectTableSelection, "single", MySqlRemotePreparedQueryHKT, GetSelectTableName extends string ? Record, "not-null"> : {}, false, never, { [K in keyof { [Key in keyof GetSelectTableSelection]: SelectResultField[Key]>; }]: { [Key in keyof GetSelectTableSelection]: SelectResultField[Key]>; }[K]; }[], any>; /** * Type for select distinct queries from table with field aliasing */ export type SelectAllDistinctFromAliasedType = (table: T) => MySqlSelectBase, GetSelectTableSelection, "single", MySqlRemotePreparedQueryHKT, GetSelectTableName extends string ? Record, "not-null"> : {}, false, never, { [K in keyof { [Key in keyof GetSelectTableSelection]: SelectResultField[Key]>; }]: { [Key in keyof GetSelectTableSelection]: SelectResultField[Key]>; }[K]; }[], any>; /** * Type for select queries from table with field aliasing and caching */ export type SelectAllFromCacheableAliasedType = (table: T, cacheTtl?: number) => MySqlSelectBase, GetSelectTableSelection, "single", MySqlRemotePreparedQueryHKT, GetSelectTableName extends string ? Record, "not-null"> : {}, false, never, { [K in keyof { [Key in keyof GetSelectTableSelection]: SelectResultField[Key]>; }]: { [Key in keyof GetSelectTableSelection]: SelectResultField[Key]>; }[K]; }[], any>; /** * Type for select distinct queries from table with field aliasing and caching */ export type SelectAllDistinctFromCacheableAliasedType = (table: T, cacheTtl?: number) => MySqlSelectBase, GetSelectTableSelection, "single", MySqlRemotePreparedQueryHKT, GetSelectTableName extends string ? Record, "not-null"> : {}, false, never, { [K in keyof { [Key in keyof GetSelectTableSelection]: SelectResultField[Key]>; }]: { [Key in keyof GetSelectTableSelection]: SelectResultField[Key]>; }[K]; }[], any>; /** * Type for executing raw SQL queries with local cache */ export type ExecuteQuery = (query: SQLWrapper | string) => Promise>; /** * Type for executing raw SQL queries with local and global cache */ export type ExecuteQueryCacheable = (query: SQLWrapper | string, cacheTtl?: number) => Promise>; /** * Type for insert operations with cache eviction */ export type InsertAndEvictCacheType = (table: TTable) => MySqlInsertBuilder; /** * Type for update operations with cache eviction */ export type UpdateAndEvictCacheType = (table: TTable) => MySqlUpdateBuilder; /** * Type for delete operations with cache eviction */ export type DeleteAndEvictCacheType = (table: TTable) => MySqlDeleteBase; /** * Patches a Drizzle database instance with additional methods for aliased selects and cache management. * * This function extends the database instance with: * - selectAliased: Select with field aliasing support * - selectAliasedDistinct: Select distinct with field aliasing support * - selectAliasedCacheable: Select with field aliasing and caching * - selectAliasedDistinctCacheable: Select distinct with field aliasing and caching * - insertAndEvictCache: Insert operations that automatically evict cache * - updateAndEvictCache: Update operations that automatically evict cache * - deleteAndEvictCache: Delete operations that automatically evict cache * * @param db - The Drizzle database instance to patch * @param options - Optional ForgeSQL ORM configuration * @returns The patched database instance with additional methods */ export declare function patchDbWithSelectAliased(db: MySqlRemoteDatabase, options?: ForgeSqlOrmOptions): MySqlRemoteDatabase & { selectAliased: SelectAliasedType; selectAliasedDistinct: SelectAliasedDistinctType; selectAliasedCacheable: SelectAliasedCacheableType; selectAliasedDistinctCacheable: SelectAliasedDistinctCacheableType; insertWithCacheContext: InsertAndEvictCacheType; insertAndEvictCache: InsertAndEvictCacheType; updateAndEvictCache: UpdateAndEvictCacheType; updateWithCacheContext: UpdateAndEvictCacheType; deleteAndEvictCache: DeleteAndEvictCacheType; deleteWithCacheContext: DeleteAndEvictCacheType; }; //# sourceMappingURL=additionalActions.d.ts.map