Versions in this module Expand all Collapse all v1 v1.0.0 Feb 14, 2024 Changes in this version + var ByModel = map[string]CRUDSController + var ByName = map[string]CRUDSController + var EnableRecover bool + var Hooks = ControllerHooks + func AbortIfError(c *gin.Context, err error) bool + func AbortWithError(c *gin.Context, err error) + func CheckModelPermissions(c *gin.Context, modelVal reflect.Value, modelSchema *schema.Schema, ...) message.Message + func CheckQueryRelation(relName string, query *gorm.DB) []string + func CheckRelatedModel(db *gorm.DB, model any, label string, field string, where string, ...) []string + func CheckRelations(c *gin.Context, db *gorm.DB, id interface{}, relations ...Relation) message.Message + func CheckUnique(c *gin.Context, db *gorm.DB, model interface{}, primary string, ...) message.Message + func Count(count *int64) func(*gorm.DB) *gorm.DB + func CreateModel(c *gin.Context, info *ModelInfo, slice bool) (reflect.Type, message.Message) + func CreateToDb(c *gin.Context, db *gorm.DB, model interface{}, args ...string) + func DeleteFile(pathFunc, nameFunc func(*gin.Context) string) func(*gin.Context) + func DeleteFromDb(c *gin.Context, models []any) + func DeleteModels(db *gorm.DB, models interface{}) (err error) + func DeleteRelations(c *gin.Context, db *gorm.DB, modelVal reflect.Value, ...) error + func DynamicQuery(c *gin.Context, info *ModelInfo, conditions *params.Conditions) func(*gorm.DB) *gorm.DB + func ErrorsToMsg(c *gin.Context, errors []string) message.Message + func ExposeSQLErr(c *gin.Context, err error) error + func FieldToString(c *gin.Context, field *schema.Field) string + func FileSystem(ctrl AddRouter, apiPath string, filePath func(c *gin.Context) string, ...) + func FirstLower(str string) string + func Folder(pathFunc func(*gin.Context) string) func(*gin.Context) + func GetFile(pathFunc, nameFunc func(*gin.Context) string) func(*gin.Context) + func GetLimit(pagStart, pagEnd string) int + func GetMapKeys(mapToFlatten map[string]interface{}) []string + func GetModelInfo(c *gin.Context, modelSchema *schema.Schema, selects string, ...) message.Message + func GetOffset(pagStart string) int + func GetPathParams(c *gin.Context, model interface{}, fields []string, destination interface{}) + func GetPrimary(model interface{}) (int, error) + func GetPrimaryFields(modelType reflect.Type) []string + func GetPrimaryName(model interface{}) (string, error) + func GetRelations(c *gin.Context) []string + func HandleComputedFields(c *gin.Context, computedFields map[string]string, data reflect.Value) + func HandleGet(c *gin.Context, db *gorm.DB, primaries map[string]interface{}, model any) + func JoinRelations(c *gin.Context, d *gorm.DB, config QueryMapConfig, modelInfo *ModelInfo, ...) + func LoadAndValidateMap(c *gin.Context, jsonData []byte, jsonMap map[string]interface{}, ...) + func LoadAndValidateMaps(c *gin.Context, jsonData []byte, jsonMaps *[]map[string]interface{}, ...) + func LoadForeignKeys(db *gorm.DB, modelVal reflect.Value, modelSchema *schema.Schema) + func LoadModel(c *gin.Context, jsonData []byte, model interface{}) + func ModelToTableNames(stmt *string, modelSchema *schema.Schema) []string + func Paginate(pagStart, pagEnd string) func(*gorm.DB) *gorm.DB + func ParseOrder(c *gin.Context, order string, info *ModelInfo) message.Message + func PathParamsToModels(c *gin.Context, modelType reflect.Type, fields []string, ...) + func PostFile(pathFunc func(*gin.Context) string) func(*gin.Context) + func QueryMap(c *gin.Context, db *gorm.DB, args *QueryMapArgs, config QueryMapConfig) error + func QueryMapRecursive(c *gin.Context, db *gorm.DB, args *QueryMapArgs, config QueryMapConfig, ...) error + func Recover(c *gin.Context) + func RecoverIfEnabled(c *gin.Context) + func Register(container *gin.RouterGroup, toRegister string, r CRUDSController) *gin.RouterGroup + func RelationsFromModelInfo(mdl *ModelInfo, otherRelations map[string]*params.Conditions) map[string]*params.Conditions + func RemoveParentPaths(path string) string + func SentenceCase(fieldName string) string + func SetPrimary(model interface{}, value int) error + func ShouldPaginate(pagStart, pagEnd string) bool + func SnakeToCamelCase(snakeCase string) string + func StrLen(text *string) int + func UpdateToDb(c *gin.Context, model interface{}, values any) + func UpperSnakeCase(str string) string + func ValidateMap(c *gin.Context, jsonMap map[string]interface{}, modelType reflect.Type) []error + func ValidateMaps(c *gin.Context, jsonMaps []map[string]interface{}, modelType reflect.Type) error + func ValidateMapsPrimaries(c *gin.Context, jsonMaps []map[string]interface{}, primaryKeys []string) + func ValidateModel(c *gin.Context, model interface{}) + func ValidateModels(c *gin.Context, models interface{}) + func ValidateStruct(c *gin.Context, mdl interface{}) error + func WriteDataWithCount(c *gin.Context, pagStart, pagEnd string, data any, count int64) + func WriteQueryMapResult(c *gin.Context, args *QueryMapArgs) + type AbortWithErrorHook struct + func (h *AbortWithErrorHook) Run(c *gin.Context, err error) + type AddRouter interface + AddRoute func(method string, name string, permissionsFunc model.PermissionFunc, ...) + type CRUDSController interface + AddCustomRoutes func() + AdditionalModels func() []reflect.Type + CanImport func() bool + Delete func(c *gin.Context) + Get func(c *gin.Context) + GetEndpoint func() string + GetEndpointPath func() string + GetModelType func() reflect.Type + GetOne func(c *gin.Context) + GetRelStructure func(c *gin.Context) + GetRoutes func() []Route + GetStructure func(c *gin.Context) + NewModel func() any + NewSliceOfModel func() any + Patch func(c *gin.Context) + PatchMany func(c *gin.Context) + Post func(c *gin.Context) + SetBasePath func(basePath string) + SetEndpointIfAbsent func(name string) + func FindControllerByModel(modelType reflect.Type) CRUDSController + type Controller struct + BasePath string + Endpoint string + Model interface{} + Routes []Route + func (r *Controller) AddRoute(method string, name string, permissionsFunc model.PermissionFunc, ...) + func (r *Controller) CanImport() bool + func (r *Controller) SetBasePath(basePath string) + func (r *Controller) SetEndpointIfAbsent(name string) + func (r Controller) AddCustomRoutes() + func (r Controller) AdditionalModels() []reflect.Type + func (r Controller) Delete(c *gin.Context) + func (r Controller) Get(c *gin.Context) + func (r Controller) GetEndpoint() string + func (r Controller) GetEndpointPath() string + func (r Controller) GetModel() interface{} + func (r Controller) GetModelType() reflect.Type + func (r Controller) GetOne(c *gin.Context) + func (r Controller) GetRelStructure(c *gin.Context) + func (r Controller) GetRoutes() []Route + func (r Controller) GetStructure(c *gin.Context) + func (r Controller) NewModel() interface{} + func (r Controller) NewSliceOfModel() interface{} + func (r Controller) Patch(c *gin.Context) + func (r Controller) PatchMany(c *gin.Context) + func (r Controller) Post(c *gin.Context) + type ControllerHooks struct + AbortWithError AbortWithErrorHook + OnRecover OnRecoverHook + type DynamicModel struct + Dest interface{} + Relations *map[string]NestedModel + type ErrorValidation struct + Field string + Validator string + Value interface{} + type FieldInfo struct + Creatable bool + Deprecated bool + Descriptive string + Field string + Label string + MaxLength int + Primary bool + Query bool + Required bool + RequiredWith string + RequiredWithout string + Type string + Updatable bool + UpdateKey bool + func GetFieldInfo(c *gin.Context, field *schema.Field) FieldInfo + type FileSystemPermissions struct + Delete model.PermissionFunc + Get model.PermissionFunc + GetFile model.PermissionFunc + Post model.PermissionFunc + func DefaultFileSystemPermissions(ctrl GetModeler) FileSystemPermissions + type GetModeler interface + GetModel func() any + type MSSqlError interface + Error func() string + SQLErrorClass func() uint8 + SQLErrorLineNo func() int32 + SQLErrorMessage func() string + SQLErrorNumber func() int32 + SQLErrorProcName func() string + SQLErrorServerName func() string + SQLErrorState func() uint8 + type ModelInfo struct + Aggregate bool + Distinct bool + Fields []reflect.StructField + Nested map[string]NestedModel + Order string + Relations map[string]*params.Conditions + Schema *schema.Schema + Select []string + SelectArgs []any + Table string + type NestedModel struct + ModelInfo *ModelInfo + References []*schema.Reference + Slice bool + func (n NestedModel) NextNested() map[string]NestedModel + type OnRecoverHook struct + func (h *OnRecoverHook) Run(c *gin.Context, err string) + type QueryMapArgs struct + Count int64 + Info ModelInfo + Model any + Ord string + P string + PagEnd string + PagStart string + Params string + Primaries map[string]interface{} + Rel string + Result []map[string]any + Sel string + type QueryMapConfig struct + Ord map[string]struct{} + P map[string]struct{} + SkipDefaults bool + SkipValidation bool + type Relation struct + ForeignKey string + Label string + Model model.TableModel + type RelationInfo struct + Creatable bool + Endpoint string + Field string + ForeignKey string + Label string + References string + Struct *StructInfo + Type string + Updatable bool + func GetRelationInfo(c *gin.Context, rel *schema.Relationship, relations [][]string) RelationInfo + type Response struct + Count int64 + Data interface{} + Next string + type Route struct + HandlerFuncs []gin.HandlerFunc + Method string + Name string + PermissionsFunc model.PermissionFunc + type StructInfo struct + Fields []FieldInfo + Relations []RelationInfo + UpdateConditions []model.UpdateConditions + func GetStructInfo(c *gin.Context, schem *schema.Schema, relations [][]string) StructInfo