Documentation ¶
Index ¶
- Constants
- func AddAddHook[M AutoGqlHookM, I AutoGqlHookI, AP AutoGqlHookAP](db *AutoGqlDB, name AddName, implementation AutoGqlHookAdd[M, I, AP])
- func AddDeleteHook[F AutoGqlHookF, DP AutoGqlHookDP](db *AutoGqlDB, name DeleteName, implementation AutoGqlHookDelete[F, DP])
- func AddGetHook[T AutoGqlHookM, I any](db *AutoGqlDB, name GetName, implementation AutoGqlHookGet[T, I])
- func AddMany2ManyAddHook[U AutoGqlHookM2M, UP AutoGqlHookUP](db *AutoGqlDB, name Many2ManyAddName, ...)
- func AddMany2ManyDeleteHook[U AutoGqlHookM2M, DP AutoGqlHookDP](db *AutoGqlDB, name Many2ManyDeleteName, ...)
- func AddQueryHook[M AutoGqlHookM, F AutoGqlHookF, O AutoGqlHookQueryO](db *AutoGqlDB, name QueryName, implementation AutoGqlHookQuery[M, F, O])
- func AddUpdateHook[M AutoGqlHookM, U AutoGqlHookU, UP AutoGqlHookUP](db *AutoGqlDB, name UpdateName, implementation AutoGqlHookUpdate[U, UP])
- type AddName
- type AutoGqlDB
- type AutoGqlHookAP
- type AutoGqlHookAdd
- type AutoGqlHookDP
- type AutoGqlHookDelete
- type AutoGqlHookF
- type AutoGqlHookGet
- type AutoGqlHookI
- type AutoGqlHookM
- type AutoGqlHookM2M
- type AutoGqlHookMany2ManyAdd
- type AutoGqlHookMany2ManyDelete
- type AutoGqlHookQuery
- type AutoGqlHookQueryO
- type AutoGqlHookU
- type AutoGqlHookUP
- type AutoGqlHookUpdate
- type DefaultAddHook
- func (d DefaultAddHook[obj, inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB, data []obj) (*gorm.DB, []obj, error)
- func (d DefaultAddHook[obj, inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, data []obj, res *resType) (*resType, error)
- func (d DefaultAddHook[obj, inputType, resType]) Received(ctx context.Context, dbHelper *AutoGqlDB, input []*inputType) (*gorm.DB, []*inputType, error)
- type DefaultDeleteHook
- func (d DefaultDeleteHook[inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
- func (d DefaultDeleteHook[inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, res *resType) (*resType, error)
- func (d DefaultDeleteHook[inputType, resType]) Received(ctx context.Context, dbHelper *AutoGqlDB, input *inputType) (*gorm.DB, inputType, error)
- type DefaultGetHook
- func (d DefaultGetHook[obj, identifier]) AfterCallDb(ctx context.Context, data *obj) (*obj, error)
- func (d DefaultGetHook[obj, identifier]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
- func (d DefaultGetHook[obj, identifier]) BeforeReturn(ctx context.Context, data *obj, db *gorm.DB) (*obj, error)
- func (d DefaultGetHook[obj, identifier]) Received(ctx context.Context, dbHelper *AutoGqlDB, id ...identifier) (*gorm.DB, error)
- type DefaultMany2ManyAddHook
- func (d DefaultMany2ManyAddHook[inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
- func (d DefaultMany2ManyAddHook[inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, res *resType) (*resType, error)
- func (d DefaultMany2ManyAddHook[inputType, resType]) Received(ctx context.Context, dbHelper *AutoGqlDB, input *inputType) (*gorm.DB, inputType, error)
- type DefaultMany2ManyDeleteHook
- func (d DefaultMany2ManyDeleteHook[inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
- func (d DefaultMany2ManyDeleteHook[inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, res *resType) (*resType, error)
- func (d DefaultMany2ManyDeleteHook[inputType, resType]) Received(ctx context.Context, dbHelper *AutoGqlDB, input *inputType) (*gorm.DB, inputType, error)
- type DefaultQueryHook
- func (d DefaultQueryHook[obj, filter, order]) AfterCallDb(ctx context.Context, data []*obj) ([]*obj, error)
- func (d DefaultQueryHook[obj, filter, order]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
- func (d DefaultQueryHook[obj, filter, order]) BeforeReturn(ctx context.Context, data []*obj, db *gorm.DB) ([]*obj, error)
- func (d DefaultQueryHook[obj, filterType, orderType]) Received(ctx context.Context, dbHelper *AutoGqlDB, filter *filterType, order *orderType, ...) (*gorm.DB, *filterType, *orderType, *int, *int, error)
- type DefaultUpdateHook
- func (d DefaultUpdateHook[inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB, data map[string]interface{}) (*gorm.DB, map[string]interface{}, error)
- func (d DefaultUpdateHook[inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, res *resType) (*resType, error)
- func (d DefaultUpdateHook[inputType, resType]) Received(ctx context.Context, dbHelper *AutoGqlDB, input *inputType) (*gorm.DB, inputType, error)
- type DeleteName
- type GetName
- type Many2ManyAddName
- type Many2ManyDeleteName
- type QueryName
- type UpdateName
Constants ¶
const ( GetCat GetName = "GetCat" QueryCat QueryName = "QueryCat" AddCat AddName = "AddCat" UpdateCat UpdateName = "UpdateCat" DeleteCat DeleteName = "DeleteCat" GetCompany GetName = "GetCompany" QueryCompany QueryName = "QueryCompany" AddCompany AddName = "AddCompany" UpdateCompany UpdateName = "UpdateCompany" DeleteCompany DeleteName = "DeleteCompany" GetSmartPhone GetName = "GetSmartPhone" QuerySmartPhone QueryName = "QuerySmartPhone" AddSmartPhone AddName = "AddSmartPhone" UpdateSmartPhone UpdateName = "UpdateSmartPhone" DeleteSmartPhone DeleteName = "DeleteSmartPhone" AddUser2Todos Many2ManyAddName = "AddUser2Todos" DeleteUserFromTodos Many2ManyDeleteName = "DeleteUserfromTodos" GetTodo GetName = "GetTodo" QueryTodo QueryName = "QueryTodo" AddTodo AddName = "AddTodo" UpdateTodo UpdateName = "UpdateTodo" DeleteTodo DeleteName = "DeleteTodo" GetUser GetName = "GetUser" QueryUser QueryName = "QueryUser" AddUser AddName = "AddUser" UpdateUser UpdateName = "UpdateUser" DeleteUser DeleteName = "DeleteUser" )
Variables ¶
This section is empty.
Functions ¶
func AddAddHook ¶
func AddAddHook[M AutoGqlHookM, I AutoGqlHookI, AP AutoGqlHookAP](db *AutoGqlDB, name AddName, implementation AutoGqlHookAdd[M, I, AP])
Add a addHook useable for
- AddCat
- AddCompany
- AddSmartPhone
- AddTodo
- AddUser
func AddDeleteHook ¶
func AddDeleteHook[F AutoGqlHookF, DP AutoGqlHookDP](db *AutoGqlDB, name DeleteName, implementation AutoGqlHookDelete[F, DP])
Add a updateHook useable for
- DeleteCat
- DeleteCompany
- DeleteSmartPhone
- DeleteTodo
- DeleteUser
func AddGetHook ¶
func AddGetHook[T AutoGqlHookM, I any](db *AutoGqlDB, name GetName, implementation AutoGqlHookGet[T, I])
Add a getHook useable for
- GetCat
- GetCompany
- GetSmartPhone
- GetTodo
- GetUser
func AddMany2ManyAddHook ¶ added in v0.4.6
func AddMany2ManyAddHook[U AutoGqlHookM2M, UP AutoGqlHookUP](db *AutoGqlDB, name Many2ManyAddName, implementation AutoGqlHookMany2ManyAdd[U, UP])
Add a Many2Many Add Hook useable for
- AddUser2Todos
func AddMany2ManyDeleteHook ¶ added in v0.4.6
func AddMany2ManyDeleteHook[U AutoGqlHookM2M, DP AutoGqlHookDP](db *AutoGqlDB, name Many2ManyDeleteName, implementation AutoGqlHookMany2ManyDelete[U, DP])
Add a Many2Many Delete Hook useable for
- AddUser2Todos
func AddQueryHook ¶
func AddQueryHook[M AutoGqlHookM, F AutoGqlHookF, O AutoGqlHookQueryO](db *AutoGqlDB, name QueryName, implementation AutoGqlHookQuery[M, F, O])
Add a queryHook useable for
- QueryCat
- QueryCompany
- QuerySmartPhone
- QueryTodo
- QueryUser
func AddUpdateHook ¶
func AddUpdateHook[M AutoGqlHookM, U AutoGqlHookU, UP AutoGqlHookUP](db *AutoGqlDB, name UpdateName, implementation AutoGqlHookUpdate[U, UP])
Add a updateHook useable for
- UpdateCat
- UpdateCompany
- UpdateSmartPhone
- UpdateTodo
- UpdateUser
Types ¶
type AutoGqlHookAP ¶
type AutoGqlHookAP interface { model.AddCatPayload | model.AddCompanyPayload | model.AddSmartPhonePayload | model.AddTodoPayload | model.AddUserPayload }
Add Payload Hooks
type AutoGqlHookAdd ¶
type AutoGqlHookAdd[obj AutoGqlHookM, input AutoGqlHookI, res AutoGqlHookAP] interface { Received(ctx context.Context, dbHelper *AutoGqlDB, input []*input) (*gorm.DB, []*input, error) // Direct after Resolver is call BeforeCallDb(ctx context.Context, db *gorm.DB, data []obj) (*gorm.DB, []obj, error) // Direct before call Database BeforeReturn(ctx context.Context, db *gorm.DB, data []obj, res *res) (*res, error) // After database call with resultset from database }
Interface description of a add Hook Simple you can use DefaultAddHook and only implement the hooks you need:
type MyAddHook struct { DefaultAddHook[model.Todo, model.TodoInput, model.AddTodoPayload] } func (m MyAddHook) BeforeCallDb(ctx context.Context, db *gorm.DB, data []model.Todo) (*gorm.DB, []model.Todo, error) { //do some stuff return db, data, nil }
type AutoGqlHookDP ¶
type AutoGqlHookDP interface { model.DeleteCatPayload | model.DeleteCompanyPayload | model.DeleteSmartPhonePayload | model.DeleteTodoPayload | model.DeleteUserPayload }
Delete Payload Hooks
type AutoGqlHookDelete ¶
type AutoGqlHookDelete[input AutoGqlHookF, res AutoGqlHookDP] interface { Received(ctx context.Context, dbHelper *AutoGqlDB, input *input) (*gorm.DB, input, error) // Direct after Resolver is call BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error) // Direct before call Database BeforeReturn(ctx context.Context, db *gorm.DB, res *res) (*res, error) // After database call with resultset from database }
Interface description of a delete Hook Simple you can use DefaultDeleteHook and only implement the hooks you need:
type MyDeleteHook struct { DefaultDeleteHook[model.TodoFiltersInput, model.DeleteTodoPayload] } func (m MyDeleteHook) BeforeCallDb(ctx context.Context, db *gorm.DB, input model.TodoFiltersInput) (*gorm.DB, model.TodoFiltersInput, error) { //do some stuff return db, input, nil }
type AutoGqlHookF ¶
type AutoGqlHookF interface { model.CatFiltersInput | model.CompanyFiltersInput | model.SmartPhoneFiltersInput | model.TodoFiltersInput | model.UserFiltersInput }
Filter Hooks
type AutoGqlHookGet ¶
type AutoGqlHookGet[obj AutoGqlHookM, identifier any] interface { Received(ctx context.Context, dbHelper *AutoGqlDB, id ...identifier) (*gorm.DB, error) // Direct after Resolver is call BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error) // Direct before call Database AfterCallDb(ctx context.Context, data *obj) (*obj, error) // After database call with resultset from database BeforeReturn(ctx context.Context, data *obj, db *gorm.DB) (*obj, error) // short before return the data }
Interface description of a getHook Simple you can use DefaultGetHook and only implement the hooks you need:
type MyGetHook struct { DefaultGetHook[model.Todo, model.TodoInput, model.AddTodoPayload] } func (m MyGetHook) BeforeCallDb(ctx context.Context, db *gorm.DB, data []model.Todo) (*gorm.DB, []model.Todo, error) { //do some stuff return db, data, nil }
type AutoGqlHookI ¶
type AutoGqlHookI interface { model.CatInput | model.CompanyInput | model.SmartPhoneInput | model.TodoInput | model.UserInput }
Input Hooks
type AutoGqlHookM ¶
type AutoGqlHookM interface { model.Cat | model.Company | model.SmartPhone | model.Todo | model.User }
Modelhooks
type AutoGqlHookMany2ManyAdd ¶ added in v0.4.6
type AutoGqlHookMany2ManyAdd[input AutoGqlHookM2M, res AutoGqlHookUP] interface { Received(ctx context.Context, dbHelper *AutoGqlDB, input *input) (*gorm.DB, input, error) // Direct after Resolver is call BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error) // Direct before call Database BeforeReturn(ctx context.Context, db *gorm.DB, res *res) (*res, error) // After database call with resultset from database }
Interface description of a many2many Hook Simple you can use DefaultMany2ManyHook and only implement the hooks you need:
type MyM2mHook struct { DefaultMany2ManyHook[model.UserRef2TodosInput, model.UpdateTodoPayload] } func (m MyM2mHook) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error) { //do some stuff return db, nil }
type AutoGqlHookMany2ManyDelete ¶ added in v0.4.6
type AutoGqlHookMany2ManyDelete[input AutoGqlHookM2M, res AutoGqlHookDP] interface { Received(ctx context.Context, dbHelper *AutoGqlDB, input *input) (*gorm.DB, input, error) // Direct after Resolver is call BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error) // Direct before call Database BeforeReturn(ctx context.Context, db *gorm.DB, res *res) (*res, error) // After database call with resultset from database }
Interface description of a many2many delete Hook Simple you can use DefaultMany2ManyHook and only implement the hooks you need:
type MyM2mDeleteHook struct { DefaultMany2ManyDeleteHook[model.UserRef2TodosInput, model.UpdateTodoPayload] } func (m MyM2mDeleteHook) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error) { //do some stuff return db, nil }
type AutoGqlHookQuery ¶
type AutoGqlHookQuery[obj AutoGqlHookM, filter AutoGqlHookF, order AutoGqlHookQueryO] interface { Received(ctx context.Context, dbHelper *AutoGqlDB, filter *filter, order *order, first, offset *int) (*gorm.DB, *filter, *order, *int, *int, error) // Direct after Resolver is call BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error) // Direct before call Database AfterCallDb(ctx context.Context, data []*obj) ([]*obj, error) // After database call with resultset from database BeforeReturn(ctx context.Context, data []*obj, db *gorm.DB) ([]*obj, error) // short before return the data }
Interface description of a query Hook Simple you can use DefaultQueryHook and only implement the hooks you need:
type MyQueryHook struct { DefaultQueryHook[model.Todo, model.TodoFiltersInput, model.TodoOrder] } func (m MyQueryHook) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, []model.Todo, error) { //do some stuff return db, nil }
type AutoGqlHookQueryO ¶
type AutoGqlHookQueryO interface { model.CatOrder | model.CompanyOrder | model.SmartPhoneOrder | model.TodoOrder | model.UserOrder }
Order Hooks
type AutoGqlHookU ¶
type AutoGqlHookU interface { model.UpdateCatInput | model.UpdateCompanyInput | model.UpdateSmartPhoneInput | model.UpdateTodoInput | model.UpdateUserInput }
Update Hooks
type AutoGqlHookUP ¶
type AutoGqlHookUP interface { model.UpdateCatPayload | model.UpdateCompanyPayload | model.UpdateSmartPhonePayload | model.UpdateTodoPayload | model.UpdateUserPayload }
Update Payload Hooks
type AutoGqlHookUpdate ¶
type AutoGqlHookUpdate[input AutoGqlHookU, res AutoGqlHookUP] interface { Received(ctx context.Context, dbHelper *AutoGqlDB, input *input) (*gorm.DB, input, error) // Direct after Resolver is call BeforeCallDb(ctx context.Context, db *gorm.DB, data map[string]interface{}) (*gorm.DB, map[string]interface{}, error) // Direct before call Database BeforeReturn(ctx context.Context, db *gorm.DB, res *res) (*res, error) // After database call with resultset from database }
Interface description of a update Hook Simple you can use DefaultUpdateHook and only implement the hooks you need:
type MyUpdateHook struct { DefaultUpdateHook[model.TodoInput, model.UpdateTodoPayload] } func (m MyUpdateHook) BeforeCallDb(ctx context.Context, db *gorm.DB, data map[string]interface{}) (*gorm.DB, map[string]interface{}, error) { //do some stuff return db, data, nil }
type DefaultAddHook ¶
type DefaultAddHook[obj AutoGqlHookM, input AutoGqlHookI, res AutoGqlHookAP] struct{}
Default add hook implementation Simple you can use DefaultAddHook and only implement the hooks you need:
type MyAddHook struct { DefaultAddHook[model.Todo, model.TodoInput, model.AddTodoPayload] } func (m MyAddHook) BeforeCallDb(ctx context.Context, db *gorm.DB, data []model.Todo) (*gorm.DB, []model.Todo, error) { //do some stuff return db, data, nil }
func (DefaultAddHook[obj, inputType, resType]) BeforeCallDb ¶
func (d DefaultAddHook[obj, inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB, data []obj) (*gorm.DB, []obj, error)
Direct before call Database
func (DefaultAddHook[obj, inputType, resType]) BeforeReturn ¶
func (d DefaultAddHook[obj, inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, data []obj, res *resType) (*resType, error)
After database call with resultset from database
type DefaultDeleteHook ¶
type DefaultDeleteHook[input AutoGqlHookF, res AutoGqlHookDP] struct{}
Default delete hook implementation Simple you can use DefaultDeleteHook and only implement the hooks you need:
type MyM2mHook struct { DefaultDeleteHook[model.TodoFiltersInput, model.DeleteTodoPayload] } func (m MyM2mHook) BeforeCallDb(ctx context.Context, db *gorm.DB, input model.TodoFiltersInput) (*gorm.DB, model.TodoFiltersInput, error) { //do some stuff return db, input, nil }
func (DefaultDeleteHook[inputType, resType]) BeforeCallDb ¶
func (d DefaultDeleteHook[inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
Direct before call Database
func (DefaultDeleteHook[inputType, resType]) BeforeReturn ¶
func (d DefaultDeleteHook[inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, res *resType) (*resType, error)
After database call with resultset from database
type DefaultGetHook ¶
type DefaultGetHook[obj AutoGqlHookM, identifier any] struct{}
Default get hook implementation Simple you can use and only implement the hooks you need:
type MyGetHook struct { DefaultGetHook[model.Todo, int64] } func (m MyGetHook) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, []model.Todo, error) { //do some stuff return db, data, nil }
func (DefaultGetHook[obj, identifier]) AfterCallDb ¶
func (d DefaultGetHook[obj, identifier]) AfterCallDb(ctx context.Context, data *obj) (*obj, error)
After database call with resultset from database
func (DefaultGetHook[obj, identifier]) BeforeCallDb ¶
func (d DefaultGetHook[obj, identifier]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
Direct before call Database
func (DefaultGetHook[obj, identifier]) BeforeReturn ¶
func (d DefaultGetHook[obj, identifier]) BeforeReturn(ctx context.Context, data *obj, db *gorm.DB) (*obj, error)
short before return the data
type DefaultMany2ManyAddHook ¶ added in v0.4.6
type DefaultMany2ManyAddHook[input AutoGqlHookM2M, res AutoGqlHookUP] struct{}
Default many2many hook implementation Simple you can use DefaultMany2ManyAddHook and only implement the hooks you need:
type MyM2mHook struct { DefaultMany2ManyAddHook[model.UserRef2TodosInput, model.UpdateTodoPayload] } func (m MyM2mAddHook) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error) { //do some stuff return db, nil }
func (DefaultMany2ManyAddHook[inputType, resType]) BeforeCallDb ¶ added in v0.4.6
func (d DefaultMany2ManyAddHook[inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
Direct before call Database
func (DefaultMany2ManyAddHook[inputType, resType]) BeforeReturn ¶ added in v0.4.6
func (d DefaultMany2ManyAddHook[inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, res *resType) (*resType, error)
After database call with resultset from database
type DefaultMany2ManyDeleteHook ¶ added in v0.4.6
type DefaultMany2ManyDeleteHook[input AutoGqlHookM2M, res AutoGqlHookDP] struct{}
Default many2many delete hook implementation Simple you can use DefaultMany2ManyDeleteHook and only implement the hooks you need:
type MyM2mDeleteHook struct { DefaultMany2ManyDeleteHook[model.UserRef2TodosInput, model.UpdateTodoPayload] } func (m MyM2mDeleteHook) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error) { //do some stuff return db, nil }
func (DefaultMany2ManyDeleteHook[inputType, resType]) BeforeCallDb ¶ added in v0.4.6
func (d DefaultMany2ManyDeleteHook[inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
Direct before call Database
func (DefaultMany2ManyDeleteHook[inputType, resType]) BeforeReturn ¶ added in v0.4.6
func (d DefaultMany2ManyDeleteHook[inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, res *resType) (*resType, error)
After database call with resultset from database
type DefaultQueryHook ¶
type DefaultQueryHook[obj AutoGqlHookM, filter AutoGqlHookF, order AutoGqlHookQueryO] struct{}
Default query hook implementation Simple you can use DefaultQueryHook and only implement the hooks you need:
type MyQueryHook struct { DefaultQueryHook[model.Todo, model.TodoFiltersInput, model.TodoOrder] } func (m MyQueryHook) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, []model.Todo, error) { //do some stuff return db, nil }
func (DefaultQueryHook[obj, filter, order]) AfterCallDb ¶
func (d DefaultQueryHook[obj, filter, order]) AfterCallDb(ctx context.Context, data []*obj) ([]*obj, error)
After database call with resultset from database
func (DefaultQueryHook[obj, filter, order]) BeforeCallDb ¶
func (d DefaultQueryHook[obj, filter, order]) BeforeCallDb(ctx context.Context, db *gorm.DB) (*gorm.DB, error)
Direct before call Database
func (DefaultQueryHook[obj, filter, order]) BeforeReturn ¶
func (d DefaultQueryHook[obj, filter, order]) BeforeReturn(ctx context.Context, data []*obj, db *gorm.DB) ([]*obj, error)
short before return the data
func (DefaultQueryHook[obj, filterType, orderType]) Received ¶
func (d DefaultQueryHook[obj, filterType, orderType]) Received(ctx context.Context, dbHelper *AutoGqlDB, filter *filterType, order *orderType, first, offset *int) (*gorm.DB, *filterType, *orderType, *int, *int, error)
Direct after Resolver is call
type DefaultUpdateHook ¶
type DefaultUpdateHook[input AutoGqlHookU, res AutoGqlHookUP] struct{}
Default update hook implementation Simple you can use DefaultUpdateHook and only implement the hooks you need:
type MyUpdateHook struct { DefaultUpdateHook[model.TodoInput, model.UpdateTodoPayload] } func (m MyUpdateHook) BeforeCallDb(ctx context.Context, db *gorm.DB, data map[string]interface{}) (*gorm.DB, map[string]interface{}, error) { //do some stuff return db, data, nil }
func (DefaultUpdateHook[inputType, resType]) BeforeCallDb ¶
func (d DefaultUpdateHook[inputType, resType]) BeforeCallDb(ctx context.Context, db *gorm.DB, data map[string]interface{}) (*gorm.DB, map[string]interface{}, error)
Direct before call Database
func (DefaultUpdateHook[inputType, resType]) BeforeReturn ¶
func (d DefaultUpdateHook[inputType, resType]) BeforeReturn(ctx context.Context, db *gorm.DB, res *resType) (*resType, error)
After database call with resultset from database
type DeleteName ¶
type DeleteName string
type Many2ManyAddName ¶ added in v0.4.6
type Many2ManyAddName string
type Many2ManyDeleteName ¶ added in v0.4.6
type Many2ManyDeleteName string
type UpdateName ¶
type UpdateName string