Documentation ¶
Overview ¶
Package database contains the database drivers.
Actually, this package implements the DB interface from https://gorm.io
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCanParseDbInstance = fmt.Errorf("can't parse db instance")
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { // OpenConnection will make a connection to the database. // // The package database implementations makes a singleton to the connection. OpenConnection() error // DB returns the gorm.DB instance. DB() *gorm.DB // contains filtered or unexported methods }
Database is an abstraction who wraps the gorm.DB.
That wrapper target to extract maximum of code from the gorm.DB.
func NewDatabase ¶
type DbOption ¶
DbOption is a function that sets a database option.
func DatabaseName ¶
DatabaseName will set option dbname for database connection
func DbEntities ¶
func DbEntities(dst ...interface{}) DbOption
DbEntities will set option entities for database connection
NOTE: this option is only for auto migrate.
That will set the entities that will be auto migrated.
Click to show internal directories.
Click to hide internal directories.