import { BaseEntity } from "@mapreedev/entity";
type IExampleEntityCache = {
username: string;
id: string;
hasPassword?: boolean;
}
type IExampleEntityDatabase = {
username: string;
id: string;
password?: string;
}
const exampleEntity = new BaseEntity<IExampleEntityCache,IExampleEntityDatabase>({
processor({ password, ...entity }){
return{
hasPassword: !!password,
...entity,
}
}
})
// Now just use the entity with the methods provided
- [ ] ACID
- [ ] Prisma like methods
- [ ] CRUD on Indexes
- [ ] Custom errors
- [ ] Optional database repository too
- [ ] L3 Constructor for configure