0.0.21 • Published 1 year ago
drizzle-repository-generator v0.0.21
TODO
- DML 할 때 리턴 타입이 payload에 따라 달라져야 함
- Promise 반환 시 타입에 record 데이터도 껴있는 문제
prerequisites
각 테이블들은 같은 이름의 column을 소지하면 안 됨. 해당 제약조건을 지킨다면 모든 table을 하나의 entity처럼 다룰 수 있음.
How to use
find
const repo = Repository(db, user);
await repo.find({ id }).returnFirst();find with
const repo = Repository(db, user, { local });
await repo.with('local').find({ id }).returnFirst();insert
await repo.insert(data);upsert
await repo.insert(data, { onConflict: 'update' });update
await repo.update(data).where({ id: 1 });delete
await repo.delete(where);transaction
await db.transaction((tx) => {
const userRepo = Repository(tx, user);
const sessionRepo = Repository(tx, session);
await userRepo.insert(user);
await sessionRepo.insert(session);
})0.0.20
1 year ago
0.0.21
1 year ago
0.0.18
1 year ago
0.0.19
1 year ago
0.0.17
1 year ago
0.0.16
1 year ago
0.0.15
1 year ago
0.0.14
2 years ago
0.0.13
2 years ago
0.0.12
2 years ago
0.0.11
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago