Documentation
¶
Index ¶
- func ConnectDB(cfg *config.Env, log *log.Logger) (*gorm.DB, error)
- func ConnectMysql(cfg *config.Env, log *log.Logger) (*gorm.DB, error)
- func ConnectPostgresql(cfg *config.Env, log *log.Logger) (*gorm.DB, error)
- type Sql
- func (pkg *Sql) Begin() (*gorm.DB, error)
- func (pkg *Sql) Close() error
- func (pkg *Sql) Commit(tx *gorm.DB) error
- func (pkg *Sql) HealthCheck() error
- func (pkg *Sql) Migrate(models ...interface{}) error
- func (pkg *Sql) Rollback(tx *gorm.DB)
- func (pkg *Sql) Transaction(fn func(tx *gorm.DB) error) error
- func (pkg *Sql) WithContext(ctx context.Context) *gorm.DB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectMysql ¶
ConnectMysql establishes a MySQL database connection
Types ¶
type Sql ¶
func (*Sql) HealthCheck ¶
HealthCheck verifies the database connection
func (*Sql) Transaction ¶
Transaction executes a function within a transaction
Click to show internal directories.
Click to hide internal directories.