Config reference
Every field of fusion.Config and fusion.Session — types, defaults, and semantics from fusion.go.
Config holds session-wide settings passed to Open:
db, err := fusion.Open(sqlite.Open("app.db"), &fusion.Config{Logger: l})*Config itself implements Option (Apply copies it onto the working
config, fusion.go:113), so a full config can be passed directly. It is
copied shallowly whenever a session derivative is made, so session flags
never leak back to the root — DryRun on a derivative never flips the
root's flag.
Config fields
| Field | Type | Default | Meaning |
|---|---|---|---|
SkipDefaultTransaction | bool | false | Disables the implicit transaction wrapping single create/update/delete operations. |
Logger | logger.Interface | logger.Default (Warn) | Receives info/warn/error messages and SQL traces. |
NowFunc | func() time.Time | time.Now().Local() | Produces timestamps. |
DryRun | bool | false | Captures SQL on Statement instead of executing it. |
TranslateError | bool | false | Maps driver constraint errors through the dialector's ErrorTranslator before they reach the error slot. |
AllowGlobalUpdate | bool | false | Permits Update/Delete statements without WHERE clauses (guarded by ErrMissingWhereClause otherwise). |
DisableAutomaticPing | bool | false | Skips the Ping performed by Open. |
DisableNestedTransaction | bool | false | Runs nested Transaction calls inline instead of via savepoints. |
NamingStrategy | schema.Namer | schema.NamingStrategy{} | Maps Go model/field names to table/column names. |
StrictTags | bool | false | Rejects unknown fusion tag keys instead of warning. |
PrepareStmt | bool | false | Enables the LRU+TTL prepared-statement cache. |
PreparedStmtCacheSize | int | 1000 | Bounds cached statements. |
PreparedStmtTTL | time.Duration | 0 (no expiry) | Expires cached statements. |
QueryHooks | []QueryHook | nil | Observes statements around execution. |
ConnPool | ConnPool | nil | When set before Open, is used instead of opening a pool through the dialector. |
Dialector | dialect.Dialector | set by Open | Renders SQL for the session. Set by Open from its argument. |
Plugins | map[string]Plugin | empty map | Registered before Open; each is initialized during Open. |
FullSaveAssociations | bool | false | Makes association saves use Save (not Create) for records that already carry a primary key. |
The last internal fields — tables (*schema.Tables), callbacks
(*CallbackManager), and joinTables (*joinTableRegistry) — are the
per-session schema cache and CRUD processors. They are created by Open
and shared read-only by every derivative.
Session fields
Session configures a derivative created by DB.Session:
// Flags on config are one-way overrides onto a copied Config; the
// receiver's Config is never mutated.
tx := db.Session(&fusion.Session{DryRun: true})| Field | Type | Default | Meaning |
|---|---|---|---|
DryRun | bool | false | Turns the derivative into a SQL-capturing session. |
NewDB | bool | false | Resets the chain: the derivative starts with a fresh Statement instead of inheriting the receiver's clauses. |
Initialized | bool | false | Forces the derivative through getInstance immediately. |
SkipDefaultTransaction | bool | false | Overrides the corresponding Config flag for this session. |
DisableNestedTransaction | bool | false | Overrides the corresponding Config flag for this session. |
AllowGlobalUpdate | bool | false | Overrides the corresponding Config flag for this session. |
Context | context.Context | nil | Replaces the derivative's execution context. |
Logger | logger.Interface | nil | Replaces the derivative's logger (used by Debug). |
NowFunc | func() time.Time | nil | Replaces the derivative's timestamp source. |
FullSaveAssociations | bool | false | Saves associated records with Save instead of Create on the derivative. |
One-way overrides
Session boolean flags are only ever turned on by the derivative —
there is no way for a Session to unset a flag that the receiver's
Config carries. Pass NewDB: true when you want a clean statement, not a
clean config.