Config reference
Every Config field — types, defaults, and when to reach for it.
Config holds session-wide settings. It is copied (shallowly) whenever a
session derivative is made, so session flags never leak back to the root —
Session, WithContext, Debug, and DryRun on a derivative leave the
root config untouched.
// Config holds session-wide settings. It is copied (shallowly) whenever a
// session derivative is made, so session flags never leak back to the root.All fields
Prop
Type
Four fields you never set yourself: Dialector is filled by Open, and
tables, callbacks, joinTables (unexported caches — schema parsing, CRUD
processors, join-table overrides) are initialized inside Open and shared by
every derivative.
Notes on the dials that surprise people
AllowGlobalUpdatedefaults to off, and the guard is deliberate: anUpdateorDeletewithout a WHERE clause fails withfusion.ErrMissingWhereClauseuntil you set it (or add conditions).PrepareStmtis off by default. When on, every statement goes through an LRU+TTL cache that recovers fromdriver.ErrBadConnpurges; tune the bounds withPreparedStmtCacheSize(default 1000) andPreparedStmtTTL(0 = never expires).TranslateErrorrequires the dialector to implementErrorTranslator— both shipped dialects do. If yours doesn't,Openwarns rather than silently dropping translation.SkipDefaultTransactiontrades the implicit per-write transaction for speed. Turn it off only when you understand the multi-statement write windows you create.
Example
db, err := fusion.Open(sqlite.Open("app.db"), &fusion.Config{
TranslateError: true,
PrepareStmt: true,
PreparedStmtCacheSize: 500,
StrictTags: true,
FullSaveAssociations: true,
})*Config implements Option, so it can be passed straight to Open. The
config is then frozen for the root; per-call overrides go through
Session, not by mutating the root.
Copying is shallow — that's the point
The copy shares the immutable parts (pool, dialect, caches) by design; only
the flag fields are per-session. Never write to a Config field after Open
— pass overrides via Session instead.