Documentation
¶
Index ¶
- func GetIDParam(ctx *gin.Context) uint
- func GetPaginationParams(ctx *gin.Context) *db_utils.Pagination
- func GetParam(ctx *gin.Context, param string) string
- func GetQueryParams(ctx *gin.Context, params map[string]bool) map[string]string
- func HandleError(c *gin.Context, statusCode int, err error)
- func HandleIDBasedRequest(ctx *gin.Context, action func(id uint) (response.Response, error))
- func HandleRequestWithBody[T, R any](ctx *gin.Context, handler func(*T) (R, error), successStatus int)
- func WithRecovery(ctx *gin.Context, handler func())
- type BaseController
- func (bc *BaseController[T, CreateR, UpdateR, E]) Create(ctx *gin.Context, successMessage string, beforeCreate func(*CreateR) error, ...)
- func (bc *BaseController[T, CreateR, UpdateR, E]) Delete(ctx *gin.Context, message string, dopAction func(id uint) error)
- func (bc *BaseController[T, CreateR, UpdateR, E]) Get(ctx *gin.Context, successMessage string, queryParams map[string]bool, ...)
- func (bc *BaseController[T, CreateR, UpdateR, E]) GetByParams(ctx *gin.Context, successMessage string, ...)
- func (bc *BaseController[T, CreateR, UpdateR, E]) GetConditionMap() db_utils.ConditionsMap
- func (bc *BaseController[T, CreateR, UpdateR, E]) GetQueryFields(ctx *gin.Context)
- func (bc *BaseController[T, CreateR, UpdateR, E]) List(ctx *gin.Context, successMessage string, ...)
- func (bc *BaseController[T, CreateR, UpdateR, E]) Update(ctx *gin.Context, successMessage string, beforeCreate func(*UpdateR) error, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIDParam ¶
func GetPaginationParams ¶
func GetPaginationParams(ctx *gin.Context) *db_utils.Pagination
func GetQueryParams ¶
func HandleIDBasedRequest ¶
func HandleRequestWithBody ¶
func WithRecovery ¶
Types ¶
type BaseController ¶
type BaseController[T entities.Entity[E], CreateR request.Request[T], UpdateR request.Request[T], E any] struct { Service *services.BaseService[T, CreateR, E] // contains filtered or unexported fields }
func NewBaseController ¶
func NewBaseController[T entities.Entity[E], CreateR request.Request[T], UpdateR request.Request[T], E any]( service *services.BaseService[T, CreateR, E], ) *BaseController[T, CreateR, UpdateR, E]
func (*BaseController[T, CreateR, UpdateR, E]) GetByParams ¶
func (bc *BaseController[T, CreateR, UpdateR, E]) GetByParams( ctx *gin.Context, successMessage string, queryConditions db_utils.ConditionsMap, preloadConditions []db_utils.PreloadCondition, cacheFunc func(map[string]interface{}, func() (*T, error)) (*T, error), serviceFunc func(db_utils.ConditionsMap, ...string) (*T, error), )
func (*BaseController[T, CreateR, UpdateR, E]) GetConditionMap ¶
func (bc *BaseController[T, CreateR, UpdateR, E]) GetConditionMap() db_utils.ConditionsMap
func (*BaseController[T, CreateR, UpdateR, E]) GetQueryFields ¶
func (bc *BaseController[T, CreateR, UpdateR, E]) GetQueryFields( ctx *gin.Context, )
func (*BaseController[T, CreateR, UpdateR, E]) List ¶
func (bc *BaseController[T, CreateR, UpdateR, E]) List( ctx *gin.Context, successMessage string, queryConditions db_utils.ConditionsMap, preloadConditions []db_utils.PreloadCondition, cacheFunc func(map[string]interface{}, func() ([]*T, error)) ([]*T, error), serviceFunc func(*db_utils.QueryOptions) ([]*T, error), )
Click to show internal directories.
Click to hide internal directories.