Skip to content

Commit

Permalink
✨ use knex query builder
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesau committed Sep 11, 2024
1 parent d5fb138 commit 08bc9e4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions db/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,9 @@ export async function getParentTagsByChildName(
const { __rootId, ...flatTagGraph } = await getFlatTagGraph(trx)
const tagGraph = createTagGraph(flatTagGraph, __rootId)

const tagsById = await knexRaw<Pick<DbPlainTag, "id" | "name">>(
trx,
`-- sql
SELECT id, name FROM tags`
).then((tags) => keyBy(tags, "id"))
const tagsById = await trx("tags")
.select("id", "name")
.then((tags) => keyBy(tags, "id"))

const parentTagsByChildName: Record<
DbPlainTag["name"],
Expand Down

0 comments on commit 08bc9e4

Please sign in to comment.