effect-io-ai

Package: @effect/sql
Module: Model

Model.FieldOption

Convert a field to one that is optional for all variants.

For the database variants, it will accept nullable values. For the JSON variants, it will also accept missing keys.

Signature

export interface FieldOption<S extends Schema.Schema.Any> extends
  VariantSchema.Field<{
    readonly select: Schema.OptionFromNullOr<S>
    readonly insert: Schema.OptionFromNullOr<S>
    readonly update: Schema.OptionFromNullOr<S>
    readonly json: Schema.optionalWith<S, { as: "Option" }>
    readonly jsonCreate: Schema.optionalWith<S, { as: "Option"; nullable: true }>
    readonly jsonUpdate: Schema.optionalWith<S, { as: "Option"; nullable: true }>
  }>
{}

Source

Since v1.0.0