Documentation
¶
Index ¶
- func GenericAPIView(viewAPI ViewGenericAPIInterface) map[ViewSetMethod]func(*appctx.AppContext)
- func GenericCreate(view ViewInterface, queryset *gorm.DB, data serializers.SerializerModels, ...)
- func GenericDelete(view ViewInterface, queryset *gorm.DB, data serializers.SerializerModels, ...)
- func GenericList(view ViewInterface, queryset *gorm.DB, data interface{}, ...)
- func GenericRetrieve(view ViewInterface, queryset *gorm.DB, data serializers.SerializerModels, ...)
- func GenericUpdate(view ViewInterface, queryset *gorm.DB, data serializers.SerializerModels, ...)
- type BaseView
- func (b *BaseView) CheckPermission(appContext *appctx.AppContext) bool
- func (b *BaseView) CheckPermissionObject(appContext *appctx.AppContext, model models.BaseModelInterface) bool
- func (b *BaseView) Create(appCtx *appctx.AppContext)
- func (b *BaseView) Delete(appCtx *appctx.AppContext)
- func (b *BaseView) FilterAndSort(tx *gorm.DB, params filters.Parameters) *gorm.DB
- func (b *BaseView) Get(appCtx *appctx.AppContext)
- func (b *BaseView) GetFilteredFields() []filters.FilterQuerySet
- func (b *BaseView) GetID(r *http.Request) (int, error)
- func (b *BaseView) GetMethods() []ViewSetMethod
- func (b *BaseView) GetMiddlewares() []func(http.Handler) http.Handler
- func (b *BaseView) GetOmit() []string
- func (b *BaseView) GetPermissionModule() string
- func (b *BaseView) GetPreloadFieldName() []string
- func (b *BaseView) GetSerializer() serializers.SerializerModels
- func (b *BaseView) GetSortAllowFields() []filters.FilterQuerySet
- func (b *BaseView) GetViewType() ViewType
- func (b *BaseView) List(appCtx *appctx.AppContext)
- func (b *BaseView) LogSetter(appCtx *appctx.AppContext, diff applog.DiffInterface) error
- func (b *BaseView) Post(appCtx *appctx.AppContext)
- func (b *BaseView) Put(appCtx *appctx.AppContext)
- func (b *BaseView) Retrieve(appCtx *appctx.AppContext)
- func (b *BaseView) Update(appCtx *appctx.AppContext)
- type BringMind
- type ViewGenericAPIInterface
- type ViewInterface
- type ViewSetMethod
- type ViewType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenericAPIView ¶
func GenericAPIView(viewAPI ViewGenericAPIInterface) map[ViewSetMethod]func(*appctx.AppContext)
func GenericCreate ¶
func GenericCreate(view ViewInterface, queryset *gorm.DB, data serializers.SerializerModels, appCtx *appctx.AppContext, middle *BringMind)
func GenericDelete ¶
func GenericDelete(view ViewInterface, queryset *gorm.DB, data serializers.SerializerModels, appCtx *appctx.AppContext, middle *BringMind)
func GenericList ¶
func GenericList(view ViewInterface, queryset *gorm.DB, data interface{}, appCtx *appctx.AppContext)
func GenericRetrieve ¶
func GenericRetrieve(view ViewInterface, queryset *gorm.DB, data serializers.SerializerModels, appCtx *appctx.AppContext, middle *BringMind)
func GenericUpdate ¶
func GenericUpdate(view ViewInterface, queryset *gorm.DB, data serializers.SerializerModels, appCtx *appctx.AppContext, middle *BringMind)
Types ¶
type BaseView ¶
type BaseView struct {
Methods []string
Parameters filters.Parameters
ViewType ViewType
FilteredFields []filters.FilterQuerySet
SortAllowFields []filters.FilterQuerySet
Serializer serializers.SerializerModels
Permissions []permissions.PermissionInterface
Module string
AppContext *appctx.AppContext
PreloadFieldsName []string
Omit []string
AppLog func(*appctx.AppContext, string, string) error
}
func (*BaseView) CheckPermission ¶
func (b *BaseView) CheckPermission(appContext *appctx.AppContext) bool
Permissions
func (*BaseView) CheckPermissionObject ¶
func (b *BaseView) CheckPermissionObject(appContext *appctx.AppContext, model models.BaseModelInterface) bool
func (*BaseView) Create ¶
func (b *BaseView) Create(appCtx *appctx.AppContext)
func (*BaseView) Delete ¶
func (b *BaseView) Delete(appCtx *appctx.AppContext)
func (*BaseView) FilterAndSort ¶
func (*BaseView) GetFilteredFields ¶
func (b *BaseView) GetFilteredFields() []filters.FilterQuerySet
func (*BaseView) GetMethods ¶
func (b *BaseView) GetMethods() []ViewSetMethod
func (*BaseView) GetMiddlewares ¶
func (*BaseView) GetPermissionModule ¶
func (*BaseView) GetPreloadFieldName ¶
func (*BaseView) GetSerializer ¶
func (b *BaseView) GetSerializer() serializers.SerializerModels
func (*BaseView) GetSortAllowFields ¶
func (b *BaseView) GetSortAllowFields() []filters.FilterQuerySet
func (*BaseView) GetViewType ¶
func (*BaseView) LogSetter ¶
func (b *BaseView) LogSetter(appCtx *appctx.AppContext, diff applog.DiffInterface) error
func (*BaseView) Post ¶
func (b *BaseView) Post(appCtx *appctx.AppContext)
func (*BaseView) Put ¶
func (b *BaseView) Put(appCtx *appctx.AppContext)
func (*BaseView) Retrieve ¶
func (b *BaseView) Retrieve(appCtx *appctx.AppContext)
func (*BaseView) Update ¶
func (b *BaseView) Update(appCtx *appctx.AppContext)
type BringMind ¶
type BringMind struct {
Before func(serializers.SerializerModels, *appctx.AppContext) error
MiddlewareModel func(serializers.SerializerModels, *appctx.AppContext) error
After func(serializers.SerializerModels, serializers.SerializerModels, *appctx.AppContext) error
}
type ViewGenericAPIInterface ¶
type ViewGenericAPIInterface interface {
ViewInterface
GetQuerySet(*gorm.DB, *appctx.AppContext) *gorm.DB
GetSerializerModels() serializers.SerializerModels
GetSliceSerializerModels() interface{}
GetOmit() []string
}
type ViewInterface ¶
type ViewInterface interface {
GetMethods() []ViewSetMethod
GetMiddlewares() []func(http.Handler) http.Handler
FilterAndSort(*gorm.DB, filters.Parameters) *gorm.DB
GetViewType() ViewType
GetID(r *http.Request) (int, error)
GetPermissionModule() string
Get(*appctx.AppContext)
Post(*appctx.AppContext)
Put(*appctx.AppContext)
List(*appctx.AppContext)
Create(*appctx.AppContext)
Retrieve(*appctx.AppContext)
Update(*appctx.AppContext)
Delete(*appctx.AppContext)
GetSerializer() serializers.SerializerModels
CheckPermission(*appctx.AppContext) bool
CheckPermissionObject(*appctx.AppContext, models.BaseModelInterface) bool
GetPreloadFieldName() []string
LogSetter(*appctx.AppContext, applog.DiffInterface) error
GetFilteredFields() []filters.FilterQuerySet
GetSortAllowFields() []filters.FilterQuerySet
}
type ViewSetMethod ¶
type ViewSetMethod string
const ( // Base methods GET ViewSetMethod = "get" POST ViewSetMethod = "post" // Castom methods List ViewSetMethod = "list" Create ViewSetMethod = "create" Update ViewSetMethod = "update" Retrieve ViewSetMethod = "retrieve" Delete ViewSetMethod = "delete" )
Click to show internal directories.
Click to hide internal directories.