© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
1 reply
Michael

Passing column values through custom TypeScript functions ...

I am attempting to do this:

const hz = db.$with('sq').as(
    db
      .select({
        alt: sql<number>`cast(${
          convertEquatorialToHorizontal(datetime, observer, {
            ra: observations.ra,
            dec: observations.dec
          }).alt
        } as float)`.as('alt')
      })
      .from(observations)
  )
const hz = db.$with('sq').as(
    db
      .select({
        alt: sql<number>`cast(${
          convertEquatorialToHorizontal(datetime, observer, {
            ra: observations.ra,
            dec: observations.dec
          }).alt
        } as float)`.as('alt')
      })
      .from(observations)
  )


Essentially, I want to pass through the
Column
Column
values evaluated as numbers to a function which can calculate a value for every record in the database (altitude is essentially something that changes for any given Datetime, so it can not be stored on the table itself).

I was wondering if anyone could advise on how this could be possibly done ...

N.B. If it is of any use, I am using sqlite ...
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Typescript error with custom column type
Drizzle TeamDTDrizzle Team / help
3y ago
Passing transaction to functions
Drizzle TeamDTDrizzle Team / help
15mo ago
Passing SQL functions to insert
Drizzle TeamDTDrizzle Team / help
3y ago