{ name: string }
eb.case().when('re.type', '=', 'company').then(eb.ref('cd.name')).else( eb .selectFrom('rise.companies_data as cd') .select(['cd.name']) .where( 'cd.riseid', '=', eb.selectFrom('rise.rise_entities as re2') .select(['re2.parent_riseid']) .where('re2.type', '=', 'team') .whereRef('re2.riseid', '=', 're.riseid'), ), ) .end() .as('company_name')
import { sql } from 'kysely'export const toBool = ( field: string // what type should I add here?) => { return sql<boolean>`IF(${field} > 0, true, false)`}