def handle.end

bend-kit-commands@0.4.0.0 · commands.bend:373

import bend-kit-commands@0.4.0.0/commands.bend as Commands
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import bend-kit-sqlite@0.1.0.1/sqlite.bend as Sqlite

373# On failure, resets the read statements and rolls back. Rollback errors are ignored: the transaction may not have started.
374def handle.end(r: Result<&1, &1, U32 & String, Reply<Bytes.Bytes>>, st: Store) -> Run(Reply<Bytes.Bytes>):
375  match r:
376    case Done{x}:
377      Run.pure(Reply<Bytes.Bytes>, x)
378    case Fail{e}:
379      Store{db, begin, commit, rollback, find, read, save, del, keep, emit} = st
380      do IO<Result<&1, &1, U32 & String, Reply<Bytes.Bytes>>>:
381        a : Result<&1, &1, U32 & String, Unit> <- Sqlite.stmt.reset(find)
382        b : Result<&1, &1, U32 & String, Unit> <- Sqlite.stmt.reset(read)
383        c : Result<&1, &1, U32 & String, Unit> <- exec(rollback)
384        return Fail{e}

Uses (15)

Used by (1)