component

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package component provides GORM PostgreSQL lifecycle integration for bootstrap.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Component

func Component() bootstrap.IComponent

GORM's PostgreSQL driver pings the server on Open — if the database is unreachable, Init() returns a non-nil error and bootstrap aborts startup.

Example

ExampleComponent shows how Component() is used in a bootstrap registration chain. It reads PostgreSQL connection parameters from env during Init():

db.host, db.port, db.name, db.schema, db.username, db.password

GORM's PostgreSQL driver pings the server on Open — if the database is unreachable, Init() returns a non-nil error and bootstrap aborts startup.

bootstrap.New().
    Add(envComp.Component(...)).
    Add(logComp.Component()).
    Add(dbComp.Component()).
    PreReady(migrate).
    Run()
package main

import (
	"fmt"

	dbComp "github.com/phcp-tech/common-library-golang/dbgorm/postgres/component"
)

func main() {
	c := dbComp.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