Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
*gorm.DB // write pool (also used for Migrate/Seed)
ReadDB *gorm.DB
Driver string
EncryptionKey []byte
}
DB wraps the GORM DB connection with additional context. For SQLite, separate read and write pools are used to avoid contention: the write pool has a single connection (SQLite only supports one writer), while the read pool has multiple connections for concurrent reads via WAL mode.
func New ¶
New creates a new database connection based on configuration. For SQLite, it creates separate read and write connection pools.
Click to show internal directories.
Click to hide internal directories.