Documentation ¶
Index ¶
Constants ¶
View Source
const ExtensionName = "orm"
Variables ¶
This section is empty.
Functions ¶
func NewExtension ¶
NewExtension creates a new extension instance example:
var db database.Database extension := orm.NewExtension().InitializeExtension(db)
then can use extension to execute gorm function
extension.ExecuteGormFunction(func(db *gorm.DB) *gorm.DB { return db.Model(&User{}).Where("id = ?", 1) })
Types ¶
type Extended ¶
type Extended interface { database.Extended ExecuteGormFunction(execFunc func(db *gorm.DB) *gorm.DB) error QueryGormFunction(receiver any, queryFunc func(db *gorm.DB) *gorm.DB) error ExecuteGormTransaction(execFunc func(tx *gorm.DB) error) error ExecuteGormFunctionWithCtx(ctx context.Context, execFunc func(db *gorm.DB) *gorm.DB) error QueryGormFunctionWithCtx(ctx context.Context, receiver any, queryFunc func(db *gorm.DB) *gorm.DB) error ExecuteGormTransactionWithCtx(ctx context.Context, execFunc func(tx *gorm.DB) error) error }
Click to show internal directories.
Click to hide internal directories.