callbacks

package
v0.0.0-...-df727e4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AfterCreate

func AfterCreate(db *gorm.DB)

AfterCreate after create hooks

func AfterDelete

func AfterDelete(db *gorm.DB)

func AfterQuery

func AfterQuery(db *gorm.DB)

func AfterUpdate

func AfterUpdate(db *gorm.DB)

AfterUpdate after update hooks

func BeforeCreate

func BeforeCreate(db *gorm.DB)

BeforeCreate before create hooks

func BeforeDelete

func BeforeDelete(db *gorm.DB)

func BeforeUpdate

func BeforeUpdate(db *gorm.DB)

BeforeUpdate before update hooks

func BeginTransaction

func BeginTransaction(db *gorm.DB)

func BuildQuerySQL

func BuildQuerySQL(db *gorm.DB)

func CommitOrRollbackTransaction

func CommitOrRollbackTransaction(db *gorm.DB)

func ConvertMapToValuesForCreate

func ConvertMapToValuesForCreate(stmt *gorm.Statement, mapValue map[string]interface{}) (values clause.Values)

ConvertMapToValuesForCreate convert map to values

func ConvertSliceOfMapToValuesForCreate

func ConvertSliceOfMapToValuesForCreate(stmt *gorm.Statement, mapValues []map[string]interface{}) (values clause.Values)

ConvertSliceOfMapToValuesForCreate convert slice of map to values

func ConvertToAssignments

func ConvertToAssignments(stmt *gorm.Statement) (set clause.Set)

ConvertToAssignments convert to update assignments

func ConvertToCreateValues

func ConvertToCreateValues(stmt *gorm.Statement) (values clause.Values)

ConvertToCreateValues convert to create values

func Create

func Create(config *Config) func(db *gorm.DB)

Create create hook

func Delete

func Delete(config *Config) func(db *gorm.DB)

func DeleteBeforeAssociations

func DeleteBeforeAssociations(db *gorm.DB)

func Preload

func Preload(db *gorm.DB)

func Query

func Query(db *gorm.DB)

func RawExec

func RawExec(db *gorm.DB)

func RegisterDefaultCallbacks

func RegisterDefaultCallbacks(db *gorm.DB, config *Config)

func RowQuery

func RowQuery(db *gorm.DB)

func SaveAfterAssociations

func SaveAfterAssociations(create bool) func(db *gorm.DB)

func SaveBeforeAssociations

func SaveBeforeAssociations(create bool) func(db *gorm.DB)

func SetupUpdateReflectValue

func SetupUpdateReflectValue(db *gorm.DB)

func Update

func Update(config *Config) func(db *gorm.DB)

Update update hook

Types

type AfterCreateInterface

type AfterCreateInterface interface {
	AfterCreate(*gorm.DB) error
}

type AfterDeleteInterface

type AfterDeleteInterface interface {
	AfterDelete(*gorm.DB) error
}

type AfterFindInterface

type AfterFindInterface interface {
	AfterFind(*gorm.DB) error
}

type AfterSaveInterface

type AfterSaveInterface interface {
	AfterSave(*gorm.DB) error
}

type AfterUpdateInterface

type AfterUpdateInterface interface {
	AfterUpdate(*gorm.DB) error
}

type BeforeCreateInterface

type BeforeCreateInterface interface {
	BeforeCreate(*gorm.DB) error
}

type BeforeDeleteInterface

type BeforeDeleteInterface interface {
	BeforeDelete(*gorm.DB) error
}

type BeforeSaveInterface

type BeforeSaveInterface interface {
	BeforeSave(*gorm.DB) error
}

type BeforeUpdateInterface

type BeforeUpdateInterface interface {
	BeforeUpdate(*gorm.DB) error
}

type Config

type Config struct {
	LastInsertIDReversed bool
	CreateClauses        []string
	QueryClauses         []string
	UpdateClauses        []string
	DeleteClauses        []string
}

Jump to

Keyboard shortcuts

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