github Effect-TS/effect @effect/sql@0.9.1

latest releases: @effect/sql-sqlite-wasm@0.11.5, @effect/sql-sqlite-react-native@0.14.5, @effect/sql-sqlite-node@0.12.5...
one month ago

Patch Changes

  • #3455 e9da539 Thanks @tim-smart! - add Model module to /sql

    The 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

Don't miss a new effect release

NewReleases is sending notifications on new releases.