Documentation
¶
Overview ¶
controllers/generic/controller.go
Index ¶
- func ApplyFilters(db *gorm.DB, filters []FilterOptions) *gorm.DB
- func ApplySorting(db *gorm.DB, sorts []SortOptions) *gorm.DB
- func RegisterCRUDRoutes(r *gin.Engine, path string, controller Crudable) *gin.RouterGroup
- func ToSnakeCase(str string) string
- type Crudable
- type FilterOptions
- type Model
- type PaginatedResponse
- type Pagination
- type QueryOptions
- type SortOptions
- type ViewSet
- func (c *ViewSet[T]) Create(ctx *gin.Context)
- func (c *ViewSet[T]) Delete(ctx *gin.Context)
- func (c *ViewSet[T]) Full(ctx *gin.Context)
- func (c *ViewSet[T]) GetByID(ctx *gin.Context)
- func (c *ViewSet[T]) GetQueryset(query *gorm.DB) *gorm.DB
- func (c *ViewSet[T]) List(ctx *gin.Context)
- func (c *ViewSet[T]) Schema(ctx *gin.Context)
- func (c *ViewSet[T]) Update(ctx *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyFilters ¶
func ApplyFilters(db *gorm.DB, filters []FilterOptions) *gorm.DB
func ApplySorting ¶ added in v0.1.10
func ApplySorting(db *gorm.DB, sorts []SortOptions) *gorm.DB
func RegisterCRUDRoutes ¶ added in v0.1.14
func ToSnakeCase ¶ added in v0.1.12
Types ¶
type FilterOptions ¶
type PaginatedResponse ¶
type Pagination ¶
func NewPaginator ¶
func NewPaginator(ctx *gin.Context) Pagination
func (*Pagination) GetResponse ¶
func (p *Pagination) GetResponse(data interface{}) PaginatedResponse
func (*Pagination) PaginatedQueryset ¶
func (p *Pagination) PaginatedQueryset(query *gorm.DB) *gorm.DB
type QueryOptions ¶ added in v0.1.10
type QueryOptions struct {
Filters []FilterOptions
Sorts []SortOptions
}
func ParseQueryParams ¶
func ParseQueryParams(params url.Values) QueryOptions
ParseQueryParams преобразует query-параметры в фильтры
type SortOptions ¶ added in v0.1.10
type ViewSet ¶
Click to show internal directories.
Click to hide internal directories.