Documentation
¶
Overview ¶
Package main is a comprehensive scenario validator for dbx.
It exercises every advertised capability end-to-end against a real database (Postgres by default; MySQL if KERNEL_DBX_DRIVER=mysql). Each scenario prints PASS/FAIL so you can tell at a glance what works.
Usage:
# Postgres (default) export KERNEL_DBX_PG_DSN=postgres://user:pass@localhost:5432/testdb?sslmode=disable go run ./examples/dbx-scenarios # MySQL export KERNEL_DBX_DRIVER=mysql export KERNEL_DBX_MYSQL_DSN='user:pass@tcp(localhost:3306)/testdb?parseTime=true&charset=utf8mb4' go run ./examples/dbx-scenarios
Expected output (abridged):
=== dbx scenario validator === driver=postgres dsn=postgres://... [01] open + ping .................. PASS [02] AutoMigrate .................. PASS [03] Create + auto PK ............. PASS [04] FindOne by query ............. PASS [05] FindOneByPK .................. PASS [06] FindMany ..................... PASS [07] Count ......................... PASS [08] ErrNoRows .................... PASS [09] ErrDuplicateKey .............. PASS [10] SafeUpsert whitelist ......... PASS [11] SafeUpsert blocks protected . PASS [12] Soft delete hides row ........ PASS [13] WithUnscoped reveals row ..... PASS [14] Increment atomic ............ PASS [15] Paginate hasMore+total ...... PASS [16] InTx commit .................. PASS [17] InTx rollback on error ...... PASS [18] InTx rollback on panic ...... PASS [19] Context propagation (InjectDB) PASS [20] GORM escape hatch (Preload) . PASS [21] QueryTimeout fires .......... PASS [22] Slow query log ............... PASS (check stderr) [23] Debug mode logs every query . PASS (check stderr) [24] Update partial columns ...... PASS [25] Save full row ................ PASS [26] DeleteByPK ................... PASS [27] AssertAffected ErrNoEffect .. PASS [28] nested InTx reuses outer tx . PASS === Summary: 28/28 PASS, 0 FAIL ===
Click to show internal directories.
Click to hide internal directories.