Documentation
¶
Index ¶
- func CloseDBForTest() error
- func GetDB() *gorm.DB
- func GetDb(exclude string) ([]byte, error)
- func ImportDB(file multipart.File) error
- func InitDB(dbPath string) error
- func IsNotFound(err error) bool
- func IsSQLiteDB(file io.Reader) (bool, error)
- func OpenDB(dbPath string) error
- func SendSighup() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseDBForTest ¶ added in v1.7.0
func CloseDBForTest() error
CloseDBForTest closes the pool and puts the package back to its pre-InitDB state. A test that installs a global DB has to call it: closing without clearing the handle would leave GetDB serving a live *gorm.DB wrapped around a dead pool, which fails as "sql: database is closed" from somewhere that never opened one.
Named for tests because it must not become a shutdown hook. Clearing the handle makes GetDB return nil, which no caller checks; APP.Stop runs cronJob.Stop first but that does not wait for in-flight jobs, and the scheduler is built without cron.Recover, so the first GetDB().Model(...) in a still-running job would panic the process instead of logging. Shutdown leaves the pool open and lets the process exit take it down.
func IsNotFound ¶
func SendSighup ¶
func SendSighup() error
Types ¶
This section is empty.