Skip to content

Instantly share code, notes, and snippets.

View choutkamartin's full-sized avatar

Martin Choutka choutkamartin

View GitHub Profile
@choutkamartin
choutkamartin / helpers.ts
Created February 14, 2024 00:58 — forked from rphlmr/helpers.ts
Drizzle ORM, deep sub queries
/* -------------------------------------------------------------------------- */
/* More here; */
/* -------------------------------------------------------------------------- */
//gist.github.com/rphlmr/0d1722a794ed5a16da0fdf6652902b15
https: export function distinctOn<Column extends AnyColumn>(column: Column) {
return sql<Column["_"]["data"]>`distinct on (${column}) ${column}`;
}
export function jsonBuildObject<T extends SelectedFields>(shape: T) {