helper

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(db *gorm.DB, sql string, values any) error

Exec executes raw sql without return rows

func InitDatabase

func InitDatabase(db *gorm.DB, dbmap map[string]*gorm.DB) (err error)

InitDatabase will create the table and table records that predefined in model package. NOTE:The version of gorm.io/driver/postgres lower than v1.5.4 have some issues. more details see: https://github.com/go-gorm/gorm/issues/6886

func Transaction

func Transaction(db *gorm.DB, fn func(tx *gorm.DB) error) error

Transaction start a transaction as a block, return error will rollback, otherwise to commit. Transaction executes an arbitrary number of commands in fc within a transaction. On success the changes are committed; if an error occurs they are rolled back.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL