Michael
Michael
Explore posts from servers
DTDrizzle Team
Created by Michael on 5/31/2024 in #help
Passing column values through custom TypeScript functions ...
Is there a way to essentially extract the { observations.ra, observations.dec } which are strings in the schema to a TypeScript number 🙏
2 replies
DTDrizzle Team
Created by Michael on 10/12/2023 in #help
SQLite performing a like is not working as expected ...
As a direct comparison, swopping out the where for this:
.where(
or(
sql`lower(${bodies.iau}) like ${sql.placeholder('name')}`,
sql`lower(${bodies.name}) like ${sql.placeholder('name')}`,
sql`lower(${bodies.constellation}) like ${sql.placeholder('name')}`
)
)
.where(
or(
sql`lower(${bodies.iau}) like ${sql.placeholder('name')}`,
sql`lower(${bodies.name}) like ${sql.placeholder('name')}`,
sql`lower(${bodies.constellation}) like ${sql.placeholder('name')}`
)
)
... works absolutely fine
2 replies
DTDrizzle Team
Created by Michael on 7/12/2023 in #help
XCannot be named without a reference to '../../../../../db/node_modules/drizzle-orm/driver.d-f4e534
cc. @Andrew Sherman help 🙏
4 replies
DTDrizzle Team
Created by Michael on 6/19/2023 in #help
SQLITE_ERROR: near "ilike": syntax error
Thank you 🙏
6 replies
DTDrizzle Team
Created by Michael on 6/19/2023 in #help
SQLITE_ERROR: near "ilike": syntax error
Which is a similar way to do the ilike ...
6 replies
DTDrizzle Team
Created by Michael on 6/19/2023 in #help
SQLITE_ERROR: near "ilike": syntax error
export const getObservationsByUserId = async (
db: LibSQLDatabase,
uid: string,
search?: string,
page?: Pagination
): Promise<Observation[]> => {
const { limit, offset } = page || { limit: 10, offset: 0 }

const observationsForUserId = db.select().from(observations).where(eq(observations.owner, uid))

if (typeof search === 'string' && search.length >= 1) {
console.log(search)
observationsForUserId.where(sql`lower(${observations.name}) like ${placeholder('name')}`)
}

return await observationsForUserId
.limit(limit)
.offset(offset)
.all({
name: search?.toLowerCase() || ''
})
}
export const getObservationsByUserId = async (
db: LibSQLDatabase,
uid: string,
search?: string,
page?: Pagination
): Promise<Observation[]> => {
const { limit, offset } = page || { limit: 10, offset: 0 }

const observationsForUserId = db.select().from(observations).where(eq(observations.owner, uid))

if (typeof search === 'string' && search.length >= 1) {
console.log(search)
observationsForUserId.where(sql`lower(${observations.name}) like ${placeholder('name')}`)
}

return await observationsForUserId
.limit(limit)
.offset(offset)
.all({
name: search?.toLowerCase() || ''
})
}
6 replies
DTDrizzle Team
Created by Michael on 6/19/2023 in #help
SQLITE_ERROR: near "ilike": syntax error
Yeh @Andrew Sherman I feel like this is a confirmed bug because the following works without issue:
6 replies