0.0.21 • Published 6 months ago

drizzle-repository-generator v0.0.21

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

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

6 months ago

0.0.21

6 months ago

0.0.18

6 months ago

0.0.19

6 months ago

0.0.17

9 months ago

0.0.16

9 months ago

0.0.15

9 months ago

0.0.14

10 months ago

0.0.13

10 months ago

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago