0.0.21 • Published 9 months ago

drizzle-repository-generator v0.0.21

Weekly downloads
-
License
MIT
Repository
-
Last release
9 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

9 months ago

0.0.21

9 months ago

0.0.18

9 months ago

0.0.19

9 months ago

0.0.17

11 months ago

0.0.16

12 months ago

0.0.15

12 months ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago