Metakit / @doeixd/metakit/sql/stored

toUpdate

const · packages/metakit/src/sqlStored.ts:27

const toUpdate: <
  State,
  Input,
  Emit,
  K extends keyof State & string,
  D extends SqlDialect = 'postgres',
>(
  table: string,
  transition: Transition<State, Input, Emit>,
  input: Input,
  options?: {
    readonly dialect?: D
    readonly whereId?: {
      readonly field: Selector<NoInfer<State>, K>
      readonly value: NoInfer<State[K]>
    }
    readonly foreign?: ForeignLowerings
  } & StoredOptions,
) => Effect<
  StoredSql<SqlFragment<D>>,
  SqlUnsupportedError | Refused | KeyFailure,
  EvidenceStore
>

Sql.toUpdate, kept under the transition's executable hash and its state Schema's fingerprint, with the table, the input and the options; it takes no column, rewritePolicy or implementations, which no key can hold.