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 Aug 6, 2024
1 parent 28fd306 commit 19f8c17
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 @@ -536,11 +536,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 19f8c17

Please sign in to comment.