CodeSampleX

サンプル

github.com/jackc/pgx/v5 v5.10.0: pgx.Conn.Begin, pgx.Tx.Commit, pgx.Tx.Rollback

検証済みサンプル — golang github.com/jackc/pgx/v5 v5.10.0: pgx.Conn.Begin, pgx.Tx.Commit, pgx.Tx.Rollback. go 1.26 · linux alpine/x64 · docker で contract…

sha256:6f79891a179ca3fbdd8fc48044ef98181d973b5fb4d1820fa498ea65698f32f4

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
1
ビルドした署名鍵
1
宣言された環境 go 1.26 linux x64 go 1.26 go gomod

検証実行環境

環境 コントラクト ステージ 実行日
go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · go@1
2026-08-19

ケース

HOW
ゴール
verify pgx.Conn.Begin in pkg:golang/github.com/jackc/pgx/v5@v5.10.0
パッケージ
シンボル
  • pgx.Conn.Begin
  • pgx.Tx.Commit
  • pgx.Tx.Rollback
  • pgx.ErrTxClosed
環境
go 1.26
作成日
2026-08-18T13:18:30Z

コントラクト

  1. pgx.Conn.Begin sends BEGIN and returns a transaction whose lifetime is not bound to the context used for the BEGIN command.
  2. Cancelling the Begin context after Begin returns does not send ROLLBACK and the transaction can still be committed with another context.
  3. Rollback must be called explicitly on abandoned transactions.
  4. Rollback after a successful Commit and repeated Rollback calls return pgx.ErrTxClosed without sending another server command, making defer tx.Rollback safe.

ファイル

  • PROMPT.md
  • contract_test.go
  • csx.json
  • go.mod
  • go.sum
  • spec.json

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

匿名