Documentation ¶
Index ¶
- func All(model, data interface{}, s *Search) error
- func Count(model interface{}, field string) (int64, error)
- func Create(model interface{}) error
- func Delete(model interface{}, s *Search) error
- func DeleteById(model interface{}, id uint) error
- func FindById(model interface{}, id uint) error
- func First(model interface{}, search *Search) error
- func Found(s *Search) *gorm.DB
- func FoundByWhereScope(fields []*Field) func(db *gorm.DB) *gorm.DB
- func GetPermissionsForUser(uid uint) [][]string
- func GetRolesForUser(uid uint) []string
- func GetSelects(field string) []string
- func Init(c *Config)
- func IsNotFound(err error) bool
- func Migrate(models []interface{}) error
- func Paginate(model, data interface{}, s *Search) (int64, error)
- func PaginateScope(page, pageSize int) func(db *gorm.DB) *gorm.DB
- func RelationScope(relates []*Relate) func(db *gorm.DB) *gorm.DB
- func Save(model interface{}) error
- func Update(v, d interface{}, fileds []interface{}, id uint) error
- func UpdateWithFilde(v interface{}, filed map[string]interface{}, id uint) error
- type Config
- type EasyGorm
- type Field
- type Relate
- type Search
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FoundByWhereScope ¶
FoundByWhereScope 查询条件
func GetPermissionsForUser ¶
GetPermissionsForUser 获取角色权限
func PaginateScope ¶
PaginateScope 分页
func RelationScope ¶
RelationScope 加载关联关系
func UpdateWithFilde ¶
UpdateWithFilde 更新
Types ¶
type Config ¶
type Config struct { GormConfig *gorm.Config Adapter string // 类型 Name string // 名称 Username string // 用户名 Pwd string // 密码 Host string // 地址 Port int64 // 端口 CasbinModelPath string // casbin 模型规则路径 SqlitePath string // sqlite 模型路径 Models []interface{} // 模型数据 CasbinTablePrefix string }
Config 设置属性
type Field ¶
type Field struct { Condition string `json:"condition"` Key string `json:"key"` Value interface{} `json:"value"` // int []int uint []uint string []string }
Field 查询字段结构体
type Relate ¶
type Relate struct { Value string Func interface{} }
Relate 关联关系
func GetRelations ¶
GetRelations 转换前端获取关联关系为 []*Relate
Click to show internal directories.
Click to hide internal directories.