repo

package
v0.0.0-...-115e584 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2021 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DemoSet = wire.NewSet(wire.Struct(new(Demo), "*"))

DemoSet 注入Demo

View Source
var MenuActionResourceSet = wire.NewSet(wire.Struct(new(MenuActionResource), "*"))

MenuActionResourceSet 注入MenuActionResource

View Source
var MenuActionSet = wire.NewSet(wire.Struct(new(MenuAction), "*"))

MenuActionSet 注入MenuAction

View Source
var MenuSet = wire.NewSet(wire.Struct(new(Menu), "*"))

MenuSet 注入Menu

RepoSet model注入

View Source
var RoleMenuSet = wire.NewSet(wire.Struct(new(RoleMenu), "*"))

RoleMenuSet 注入RoleMenu

View Source
var RoleSet = wire.NewSet(wire.Struct(new(Role), "*"))

RoleSet 注入Role

View Source
var TransSet = wire.NewSet(wire.Struct(new(Trans), "*"))

TransSet 注入Trans

View Source
var UserRoleSet = wire.NewSet(wire.Struct(new(UserRole), "*"))

UserRoleSet 注入UserRole

View Source
var UserSet = wire.NewSet(wire.Struct(new(User), "*"))

UserSet 注入User

Functions

func Check

func Check(ctx context.Context, db *gorm.DB) (bool, error)

Check 检查数据是否存在

func ExecTrans

func ExecTrans(ctx context.Context, db *gorm.DB, fn TransFunc) error

ExecTrans 执行事务

func ExecTransWithLock

func ExecTransWithLock(ctx context.Context, db *gorm.DB, fn TransFunc) error

ExecTransWithLock 执行事务(加锁)

func FindOne

func FindOne(ctx context.Context, db *gorm.DB, out interface{}) (bool, error)

FindOne 查询单条数据

func FindPage

func FindPage(ctx context.Context, db *gorm.DB, pp schema.PaginationParam, out interface{}) (int, error)

FindPage 查询分页数据

func ParseOrder

func ParseOrder(items []*schema.OrderField, handle ...OrderFieldFunc) string

ParseOrder 解析排序字段

func WrapPageQuery

func WrapPageQuery(ctx context.Context, db *gorm.DB, pp schema.PaginationParam, out interface{}) (*schema.PaginationResult, error)

WrapPageQuery 包装带有分页的查询

Types

type Demo

type Demo struct {
	DB *gorm.DB
}

Demo 示例存储

func (*Demo) Create

func (a *Demo) Create(ctx context.Context, item schema.Demo) error

Create 创建数据

func (*Demo) Delete

func (a *Demo) Delete(ctx context.Context, id string) error

Delete 删除数据

func (*Demo) Get

func (a *Demo) Get(ctx context.Context, id string, opts ...schema.DemoQueryOptions) (*schema.Demo, error)

Get 查询指定数据

func (*Demo) Query

Query 查询数据

func (*Demo) Update

func (a *Demo) Update(ctx context.Context, id string, item schema.Demo) error

Update 更新数据

func (*Demo) UpdateStatus

func (a *Demo) UpdateStatus(ctx context.Context, id string, status int) error

UpdateStatus 更新状态

type Menu struct {
	DB *gorm.DB
}

Menu 菜单存储

func (a *Menu) Create(ctx context.Context, item schema.Menu) error

Create 创建数据

func (a *Menu) Delete(ctx context.Context, id string) error

Delete 删除数据

func (a *Menu) Get(ctx context.Context, id string, opts ...schema.MenuQueryOptions) (*schema.Menu, error)

Get 查询指定数据

Query 查询数据

func (a *Menu) Update(ctx context.Context, id string, item schema.Menu) error

Update 更新数据

func (a *Menu) UpdateParentPath(ctx context.Context, id, parentPath string) error

UpdateParentPath 更新父级路径

func (a *Menu) UpdateStatus(ctx context.Context, id string, status int) error

UpdateStatus 更新状态

type MenuAction struct {
	DB *gorm.DB
}

MenuAction 菜单动作存储

func (a *MenuAction) Create(ctx context.Context, item schema.MenuAction) error

Create 创建数据

func (a *MenuAction) Delete(ctx context.Context, id string) error

Delete 删除数据

func (a *MenuAction) DeleteByMenuID(ctx context.Context, menuID string) error

DeleteByMenuID 根据菜单ID删除数据

Get 查询指定数据

Query 查询数据

func (a *MenuAction) Update(ctx context.Context, id string, item schema.MenuAction) error

Update 更新数据

type MenuActionResource struct {
	DB *gorm.DB
}

MenuActionResource 菜单动作关联资源存储

Create 创建数据

func (a *MenuActionResource) Delete(ctx context.Context, id string) error

Delete 删除数据

func (a *MenuActionResource) DeleteByActionID(ctx context.Context, actionID string) error

DeleteByActionID 根据动作ID删除数据

func (a *MenuActionResource) DeleteByMenuID(ctx context.Context, menuID string) error

DeleteByMenuID 根据菜单ID删除数据

Get 查询指定数据

Query 查询数据

Update 更新数据

type OrderFieldFunc

type OrderFieldFunc func(string) string

OrderFieldFunc 排序字段转换函数

type Role

type Role struct {
	DB *gorm.DB
}

Role 角色存储

func (*Role) Create

func (a *Role) Create(ctx context.Context, item schema.Role) error

Create 创建数据

func (*Role) Delete

func (a *Role) Delete(ctx context.Context, id string) error

Delete 删除数据

func (*Role) Get

func (a *Role) Get(ctx context.Context, id string, opts ...schema.RoleQueryOptions) (*schema.Role, error)

Get 查询指定数据

func (*Role) Query

Query 查询数据

func (*Role) Update

func (a *Role) Update(ctx context.Context, id string, item schema.Role) error

Update 更新数据

func (*Role) UpdateStatus

func (a *Role) UpdateStatus(ctx context.Context, id string, status int) error

UpdateStatus 更新状态

type RoleMenu

type RoleMenu struct {
	DB *gorm.DB
}

RoleMenu 角色菜单存储

func (*RoleMenu) Create

func (a *RoleMenu) Create(ctx context.Context, item schema.RoleMenu) error

Create 创建数据

func (*RoleMenu) Delete

func (a *RoleMenu) Delete(ctx context.Context, id string) error

Delete 删除数据

func (*RoleMenu) DeleteByRoleID

func (a *RoleMenu) DeleteByRoleID(ctx context.Context, roleID string) error

DeleteByRoleID 根据角色ID删除数据

func (*RoleMenu) Get

Get 查询指定数据

func (*RoleMenu) Query

Query 查询数据

func (*RoleMenu) Update

func (a *RoleMenu) Update(ctx context.Context, id string, item schema.RoleMenu) error

Update 更新数据

type Trans

type Trans struct {
	DB *gorm.DB
}

Trans 事务管理

func (*Trans) Exec

func (a *Trans) Exec(ctx context.Context, fn func(context.Context) error) error

Exec 执行事务

type TransFunc

type TransFunc func(context.Context) error

TransFunc 定义事务执行函数

type User

type User struct {
	DB *gorm.DB
}

User 用户存储

func (*User) Create

func (a *User) Create(ctx context.Context, item schema.User) error

Create 创建数据

func (*User) Delete

func (a *User) Delete(ctx context.Context, id string) error

Delete 删除数据

func (*User) Get

func (a *User) Get(ctx context.Context, id string, opts ...schema.UserQueryOptions) (*schema.User, error)

Get 查询指定数据

func (*User) Query

Query 查询数据

func (*User) Update

func (a *User) Update(ctx context.Context, id string, item schema.User) error

Update 更新数据

func (*User) UpdatePassword

func (a *User) UpdatePassword(ctx context.Context, id, password string) error

UpdatePassword 更新密码

func (*User) UpdateStatus

func (a *User) UpdateStatus(ctx context.Context, id string, status int) error

UpdateStatus 更新状态

type UserRole

type UserRole struct {
	DB *gorm.DB
}

UserRole 用户角色存储

func (*UserRole) Create

func (a *UserRole) Create(ctx context.Context, item schema.UserRole) error

Create 创建数据

func (*UserRole) Delete

func (a *UserRole) Delete(ctx context.Context, id string) error

Delete 删除数据

func (*UserRole) DeleteByUserID

func (a *UserRole) DeleteByUserID(ctx context.Context, userID string) error

DeleteByUserID 根据用户ID删除数据

func (*UserRole) Get

Get 查询指定数据

func (*UserRole) Query

Query 查询数据

func (*UserRole) Update

func (a *UserRole) Update(ctx context.Context, id string, item schema.UserRole) error

Update 更新数据

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL