component

package
v0.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL