Metakit / @doeixd/metakit/drizzle

toUpdate

function · packages/metakit/src/drizzle.ts:330

function toUpdate<State, Input, Emit>(
  transition: Transition<State, Input, Emit>,
  input: Input,
  table: Table,
  options?: {
    readonly dialect?: SqlDialect
    readonly foreign?: ForeignLowerings
  } & ClaimOptions,
): Result.Result<
  {
    readonly set: Readonly<Record<string, SQL>>
    readonly where: SQL
  },
  SqlUnsupportedError | Refused
>

A Transition and one input as { set, where } for db.update(table).set(set).where(where), set keyed by the table's column keys. where holds of a row only where the guard does and its step does not refuse. An input the transition's input Schema refuses is Refused. Where transition is a machine's arm, a SqlUnsupportedError names it.