@avonjs/avonjs
Version:
A fluent Node.js API generator.
55 lines (54 loc) • 2.64 kB
TypeScript
import type { AbstractMixable, Model } from '../Contracts';
import type Repository from '../Repositories/Repository';
declare const _default: <TModel extends Model, TBase extends AbstractMixable<Repository<TModel>> = AbstractMixable<Repository<TModel>>>(Parent: TBase) => (abstract new (...args: import("../Contracts").Args) => {
/**
* Store given model into the storage.
*/
store(model: TModel): Promise<TModel>;
/**
* Update the given model in storage.
*/
update(model: TModel): Promise<TModel>;
/**
* Fill the timestamps for given attributes.
*/
fillTimestamps(model: TModel, attributes?: string[]): TModel;
/**
* Get name of `created_at` key.
*/
getCreatedAtKey(): string;
/**
* Get name of `update_at` key.
*/
getUpdatedAtKey(): string;
/**
* Get a fresh timestamp for the model.
*/
freshTimestamp(): unknown;
wheres: import("../Contracts").Where[];
orders: import("../Contracts").Order[];
modifiers: import("../Contracts").QueryModifierCallback[];
_transaction?: import("../Contracts").Transaction;
transaction<V>(callback: import("../Contracts").TransactionCallback<V, any>): Promise<V>;
setTransaction(transaction?: import("../Contracts").Transaction): any;
getTransaction(): import("../Contracts").Transaction | undefined;
runningInTransaction(): boolean;
prepareTransaction(): Promise<import("../Contracts").Transaction>;
where(where: import("../Contracts").Where | import("../Contracts").Where[]): any;
setWheres(wheres: import("../Contracts").Where[]): any;
getWheres(): import("../Contracts").Where[];
order(order: import("../Contracts").Order | import("../Contracts").Order[]): any;
setOrders(orders: import("../Contracts").Order[]): any;
getOrders(): import("../Contracts").Order[];
modify<T>(modifier: import("../Contracts").QueryModifierCallback<T>): any;
find(key: import("../Contracts").PrimaryKey): Promise<import("../Contracts").Optional<TModel>>;
whereKey(key: import("../Contracts").PrimaryKey): any;
whereKeys(keys: Array<import("../Contracts").PrimaryKey>): any;
fillModel(result: import("../Contracts").AnyRecord): TModel;
search(search: string, page?: number, perPage?: number): Promise<import("../Contracts").SearchCollection>;
all(wheres?: import("../Contracts").Where[]): Promise<TModel[]>;
first(wheres?: import("../Contracts").Where[]): Promise<import("../Contracts").Optional<TModel>>;
delete(key: import("../Contracts").PrimaryKey): Promise<void>;
model(): TModel;
}) & TBase;
export default _default;