Patch Changes
-
#3455
e9da539
Thanks @tim-smart! - add Model module to /sqlThe
Model
module can be used to create domain schemas with common variants for
the database and serializing to JSON.import { Schema } from "@effect/schema"; import { Model } from "@effect/sql"; export const GroupId = Schema.Number.pipe(Schema.brand("GroupId")); export class Group extends Model.Class<Group>("Group")({ id: Model.Generated(GroupId), name: Schema.NonEmptyTrimmedString, createdAt: Model.DateTimeInsertFromDate, updatedAt: Model.DateTimeUpdateFromDate, }) {} // schema used for selects Group; // schema used for inserts Group.insert; // schema used for updates Group.update; // schema used for json api Group.json; Group.jsonCreate; Group.jsonUpdate; // you can also turn them into classes class GroupJson extends Schema.Class<GroupJson>("GroupJson")(Group.json) { get upperName() { return this.name.toUpperCase(); } }
-
#3460
4fabf75
Thanks @tim-smart! - support partial objects in sql helpers -
Updated dependencies [
e9da539
]:- @effect/experimental@0.23.1