Sample
github.com/jackc/pgx/v5 v5.10.0: pgtype.TextOID
Verified sample for golang github.com/jackc/pgx/v5 v5.10.0: pgtype.TextOID. The contract ran on go 1.26 · linux alpine/x64 · docker and passed.
sha256:6093fabe44e46ab45c034576038a5cfd84a0037d3e03241431fd5c23f7ab6e76
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-28 |
Case
HOW- Goal
- verify github.com/jackc/pgx/v5/pgtype.TextOID in pkg:golang/github.com/jackc/pgx/v5@v5.10.0
- Packages
- Symbols
-
- github.com/jackc/pgx/v5/pgtype.TextOID
- Created
- 2026-08-28T01:38:05Z
Contract
- pgtype.TextOID is the uint32 constant 25 representing PostgreSQL text data type
- pgtype.Map registers the text data type with OID pgtype.TextOID accessible via TypeForOID and TypeForName
- pgtype.Map encodes string and pgtype.Text values into text and binary format buffers using pgtype.TextOID
- pgtype.Map scans text and binary format byte slices into string, []byte, and pgtype.Text using pgtype.TextOID
- pgtype.Map scans nil data into pgtype.Text as SQL NULL setting Valid to false using pgtype.TextOID
- pgtype.Map PlanEncode and PlanScan provide valid encoders and decoders for pgtype.TextOID
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/main.go
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify github.com/jackc/pgx/v5/pgtype.TextOID in pkg:golang/github.com/jackc/pgx/v5@v5.10.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/jackc/pgx/v5@v5.10.0
Demonstrate these symbols/APIs:
- github.com/jackc/pgx/v5/pgtype.TextOID
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:50634635ffa765d631bbc02e157b440c5a2ebff645d4b79ecfcbf2683132db7a","contract":["pgtype.TextOID is the uint32 constant 25 representing PostgreSQL text data type","pgtype.Map registers the text data type with OID pgtype.TextOID accessible via TypeForOID and TypeForName","pgtype.Map encodes string and pgtype.Text values into text and binary format buffers using pgtype.TextOID","pgtype.Map scans text and binary format byte slices into string, []byte, and pgtype.Text using pgtype.TextOID","pgtype.Map scans nil data into pgtype.Text as SQL NULL setting Valid to false using pgtype.TextOID","pgtype.Map PlanEncode and PlanScan provide valid encoders and decoders for pgtype.TextOID"],"goal":"verify github.com/jackc/pgx/v5/pgtype.TextOID in pkg:golang/github.com/jackc/pgx/v5@v5.10.0","kind":"HOW","packages":["pkg:golang/github.com/jackc/pgx/v5@v5.10.0"],"schemaVersion":1,"symbols":["github.com/jackc/pgx/v5/pgtype.TextOID"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/jackc/pgx/v5@v5.10.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/jackc/pgx/v5@v5.10.0","symbols":["github.com/jackc/pgx/v5/pgtype.TextOID"],"verifierAdapter":"golang@1"}
module sample
go 1.26.5
require github.com/jackc/pgx/v5 v5.10.0
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.10.0 h1:VhSvgU2jSli8o3AqIEOTJr7rZwAEUVo4E4XhR94Zfr0=
github.com/jackc/pgx/v5 v5.10.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
package main
import (
"fmt"
"github.com/jackc/pgx/v5/pgtype"
)
// EncodeText formats a string as PostgreSQL text wire format using TextOID.
func EncodeText(m *pgtype.Map, value string) ([]byte, error) {
return m.Encode(pgtype.TextOID, pgtype.TextFormatCode, value, nil)
}
// DecodeText parses a PostgreSQL text wire format buffer into a string using TextOID.
func DecodeText(m *pgtype.Map, data []byte) (string, error) {
var s string
err := m.Scan(pgtype.TextOID, pgtype.TextFormatCode, data, &s)
return s, err
}
func main() {
m := pgtype.NewMap()
fmt.Printf("PostgreSQL text type OID: %d\n", pgtype.TextOID)
if t, ok := m.TypeForOID(pgtype.TextOID); ok {
fmt.Printf("Registered type for TextOID: %s (OID: %d)\n", t.Name, t.OID)
}
encoded, err := EncodeText(m, "Hello, CodeSampleX!")
if err != nil {
fmt.Printf("Encode error: %v\n", err)
return
}
decoded, err := DecodeText(m, encoded)
if err != nil {
fmt.Printf("Decode error: %v\n", err)
return
}
fmt.Printf("Decoded string: %s\n", decoded)
}
{
"schemaVersion": 1,
"goal": "verify github.com/jackc/pgx/v5/pgtype.TextOID in pkg:golang/github.com/jackc/pgx/v5@v5.10.0",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/jackc/pgx/v5@v5.10.0"
],
"symbols": [
"github.com/jackc/pgx/v5/pgtype.TextOID"
]
}
package main
import (
"fmt"
"os"
"reflect"
"github.com/jackc/pgx/v5/pgtype"
)
func assertTrue(name string, condition bool) {
if !condition {
fmt.Fprintf(os.Stderr, "Assertion failed for %s: expected true, got false\n", name)
os.Exit(1)
}
}
func assertEqual[T comparable](name string, actual, expected T) {
if actual != expected {
fmt.Fprintf(os.Stderr, "Assertion failed for %s: got %v, expected %v\n", name, actual, expected)
os.Exit(1)
}
}
func main() {
m := pgtype.NewMap()
// Contract: pgtype.TextOID is the uint32 constant 25 representing PostgreSQL text data type
assertEqual("TextOID value", pgtype.TextOID, uint32(25))
// Contract: pgtype.Map registers the text data type with OID pgtype.TextOID accessible via TypeForOID and TypeForName
tByOID, okOID := m.TypeForOID(pgtype.TextOID)
assertTrue("TypeForOID found", okOID)
assertEqual("TypeForOID name", tByOID.Name, "text")
assertEqual("TypeForOID OID", tByOID.OID, pgtype.TextOID)
tByName, okName := m.TypeForName("text")
assertTrue("TypeForName found", okName)
assertEqual("TypeForName OID", tByName.OID, pgtype.TextOID)
// Contract: pgtype.Map encodes string and pgtype.Text values into text and binary format buffers using pgtype.TextOID
textBuf, err := m.Encode(pgtype.TextOID, pgtype.TextFormatCode, "sample text payload", nil)
assertTrue("encode text format string", err == nil)
assertEqual("encoded text string value", string(textBuf), "sample text payload")
binBuf, err := m.Encode(pgtype.TextOID, pgtype.BinaryFormatCode, "sample binary payload", nil)
assertTrue("encode binary format string", err == nil)
assertEqual("encoded binary string value", string(binBuf), "sample binary payload")
textVal := pgtype.Text{String: "pgtype text struct", Valid: true}
textObjBuf, err := m.Encode(pgtype.TextOID, pgtype.TextFormatCode, textVal, nil)
assertTrue("encode pgtype.Text in text format", err == nil)
assertEqual("encoded pgtype.Text value", string(textObjBuf), "pgtype text struct")
// Contract: pgtype.Map scans text and binary format byte slices into string, []byte, and pgtype.Text using pgtype.TextOID
var scannedTextStr string
err = m.Scan(pgtype.TextOID, pgtype.TextFormatCode, textBuf, &scannedTextStr)
assertTrue("scan text format into string", err == nil)
assertEqual("scanned text string", scannedTextStr, "sample text payload")
var scannedBinStr string
err = m.Scan(pgtype.TextOID, pgtype.BinaryFormatCode, binBuf, &scannedBinStr)
assertTrue("scan binary format into string", err == nil)
assertEqual("scanned binary string", scannedBinStr, "sample binary payload")
var scannedBytes []byte
err = m.Scan(pgtype.TextOID, pgtype.TextFormatCode, []byte("raw byte content"), &scannedBytes)
assertTrue("scan text format into byte slice", err == nil)
assertTrue("scanned byte slice equality", reflect.DeepEqual(scannedBytes, []byte("raw byte content")))
var scannedTextObj pgtype.Text
err = m.Scan(pgtype.TextOID, pgtype.TextFormatCode, textObjBuf, &scannedTextObj)
assertTrue("scan text format into pgtype.Text", err == nil)
assertTrue("scannedTextObj valid", scannedTextObj.Valid)
assertEqual("scannedTextObj string", scannedTextObj.String, "pgtype text struct")
// Contract: pgtype.Map scans nil data into pgtype.Text as SQL NULL setting Valid to false using pgtype.TextOID
nullTarget := pgtype.Text{String: "existing", Valid: true}
err = m.Scan(pgtype.TextOID, pgtype.TextFormatCode, nil, &nullTarget)
assertTrue("scan nil into pgtype.Text", err == nil)
assertTrue("nullTarget Valid is false", !nullTarget.Valid)
var nullPtrTarget *string
err = m.Scan(pgtype.TextOID, pgtype.TextFormatCode, nil, &nullPtrTarget)
assertTrue("scan nil into *string", err == nil)
assertTrue("nullPtrTarget is nil", nullPtrTarget == nil)
// Contract: pgtype.Map PlanEncode and PlanScan provide valid encoders and decoders for pgtype.TextOID
planEncode := m.PlanEncode(pgtype.TextOID, pgtype.TextFormatCode, "sample")
assertTrue("PlanEncode returns non-nil encoder", planEncode != nil)
planScan := m.PlanScan(pgtype.TextOID, pgtype.TextFormatCode, &scannedTextStr)
assertTrue("PlanScan returns non-nil decoder", planScan != nil)
fmt.Println("All pgtype.TextOID contract assertions passed.")
}
Origin Seeder
anonymous