Skip to content
Discussion options

You must be logged in to vote

This query it's good! it will work properly. However, some of the selling points of using an ORM is type safety.
There are some hardcoded strings in your query that unless you are really careful, there is no help from your editor/LSP that you wrote it correctly. Unfortunately, you query is complex enough that there not a whole lot to improve, specially in the first column, but there are some stuff:

 await drizzleDb
    .select({
      intervalStart: sql`CONCAT(
          DATE_FORMAT(${position.received}, '%Y-%m-%d %H:'),
          LPAD(10 * (MINUTE(${position.received}) DIV 10), 2, '00'),
          ":00.000"
      )`.as("intervalStart").mapWith(position.received),
      totalPositions: sql<

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@epatey
Comment options

Answer selected by epatey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants