class GetOrgWithoutGroup extends Data.TaggedError("GetOrgWithoutGroup")<{
msg: string;
}> {}
export const foo = Database.pipe(
Effect.tryMapPromise({
catch: (err: any) => new GetOrgWithoutGroup({ msg: err.message }),
try: ({ db, organizationTable, eq, isNull }) =>
db
.select({ id: organizationTable.id })
.from(organizationTable)
.where(isNull(organizationTable.groupId)),
}),
Effect.map(RA.head),
Effect.map(Option.getOrNull)
);
class GetOrgWithoutGroup extends Data.TaggedError("GetOrgWithoutGroup")<{
msg: string;
}> {}
export const foo = Database.pipe(
Effect.tryMapPromise({
catch: (err: any) => new GetOrgWithoutGroup({ msg: err.message }),
try: ({ db, organizationTable, eq, isNull }) =>
db
.select({ id: organizationTable.id })
.from(organizationTable)
.where(isNull(organizationTable.groupId)),
}),
Effect.map(RA.head),
Effect.map(Option.getOrNull)
);