Documentation
¶
Overview ¶
Package component provides GORM MySQL 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 MySQL driver pings the server on Open — Init() returns a non-nil error immediately when the database is unreachable, causing bootstrap to abort startup.
Example ¶
ExampleComponent shows how Component() is used in a bootstrap registration chain. It reads MySQL connection parameters from env during Init():
db.host, db.port, db.name, db.username, db.password
GORM's MySQL driver pings the server on Open — if the database is unreachable, Init() returns a non-nil error and bootstrap aborts startup immediately.
package main
import (
"fmt"
dbComp "github.com/phcp-tech/common-library-golang/dbgorm/mysql/component"
)
func main() {
c := dbComp.Component()
fmt.Println(c != nil)
}
Output: true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.