Documentation
¶
Overview ¶
Package component provides SQLite lifecycle integration for bootstrap.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Component ¶
func Component() bootstrap.IComponent
Component wraps loadFromEnv as a bootstrap.IComponent. Init calls loadFromEnv; Close closes the default SQLite connection.
The SQLite path is read from env key db.sqlite.path during Init(). Typical values:
- ":memory:" for in-memory databases (tests, ephemeral data)
- "file:app.db?_journal_mode=WAL&_foreign_keys=on" for file-based databases
Example ¶
ExampleComponent shows how Component() is used in a bootstrap registration chain. The SQLite database path is read from env key db.sqlite.path during Init():
- ":memory:" for in-memory databases (tests, ephemeral data)
- "file:app.db?_journal_mode=WAL&_foreign_keys=on" for file-based databases
Close() calls db.Close() on the default connection.
bootstrap.New(envComp.Component(...), logComp.Component()).
AddParallel(sqliteComp.Component()).
Run()
package main
import (
"fmt"
sqliteComp "github.com/phcp-tech/common-library-golang/dbsqlc/sqlite/component"
)
func main() {
c := sqliteComp.Component()
fmt.Println(c != nil)
}
Output: true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.