Documentation ¶
Index ¶
- func GetMenuDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetMenuResourceDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetRoleMenuDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetUserDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetUserRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- type Menu
- func (a *Menu) Create(ctx context.Context, item *schema.Menu) error
- func (a *Menu) Delete(ctx context.Context, id string) error
- func (a *Menu) Exists(ctx context.Context, id string) (bool, error)
- func (a *Menu) ExistsCodeByParentID(ctx context.Context, code, parentID string) (bool, error)
- func (a *Menu) ExistsNameByParentID(ctx context.Context, name, parentID string) (bool, error)
- func (a *Menu) Get(ctx context.Context, id string, opts ...schema.MenuQueryOptions) (*schema.Menu, error)
- func (a *Menu) GetByCodeAndParentID(ctx context.Context, code, parentID string, opts ...schema.MenuQueryOptions) (*schema.Menu, error)
- func (a *Menu) GetByNameAndParentID(ctx context.Context, name, parentID string, opts ...schema.MenuQueryOptions) (*schema.Menu, error)
- func (a *Menu) Query(ctx context.Context, params schema.MenuQueryParam, ...) (*schema.MenuQueryResult, error)
- func (a *Menu) Update(ctx context.Context, item *schema.Menu) error
- func (a *Menu) UpdateParentPath(ctx context.Context, id, parentPath string) error
- func (a *Menu) UpdateStatusByParentPath(ctx context.Context, parentPath, status string) error
- type MenuResource
- func (a *MenuResource) Create(ctx context.Context, item *schema.MenuResource) error
- func (a *MenuResource) Delete(ctx context.Context, id string) error
- func (a *MenuResource) DeleteByMenuID(ctx context.Context, menuID string) error
- func (a *MenuResource) Exists(ctx context.Context, id string) (bool, error)
- func (a *MenuResource) ExistsMethodPathByMenuID(ctx context.Context, method, path, menuID string) (bool, error)
- func (a *MenuResource) Get(ctx context.Context, id string, opts ...schema.MenuResourceQueryOptions) (*schema.MenuResource, error)
- func (a *MenuResource) Query(ctx context.Context, params schema.MenuResourceQueryParam, ...) (*schema.MenuResourceQueryResult, error)
- func (a *MenuResource) Update(ctx context.Context, item *schema.MenuResource) error
- type Role
- func (a *Role) Create(ctx context.Context, item *schema.Role) error
- func (a *Role) Delete(ctx context.Context, id string) error
- func (a *Role) Exists(ctx context.Context, id string) (bool, error)
- func (a *Role) ExistsCode(ctx context.Context, code string) (bool, error)
- func (a *Role) Get(ctx context.Context, id string, opts ...schema.RoleQueryOptions) (*schema.Role, error)
- func (a *Role) Query(ctx context.Context, params schema.RoleQueryParam, ...) (*schema.RoleQueryResult, error)
- func (a *Role) Update(ctx context.Context, item *schema.Role) error
- type RoleMenu
- func (a *RoleMenu) Create(ctx context.Context, item *schema.RoleMenu) error
- func (a *RoleMenu) Delete(ctx context.Context, id string) error
- func (a *RoleMenu) DeleteByMenuID(ctx context.Context, menuID string) error
- func (a *RoleMenu) DeleteByRoleID(ctx context.Context, roleID string) error
- func (a *RoleMenu) Exists(ctx context.Context, id string) (bool, error)
- func (a *RoleMenu) Get(ctx context.Context, id string, opts ...schema.RoleMenuQueryOptions) (*schema.RoleMenu, error)
- func (a *RoleMenu) Query(ctx context.Context, params schema.RoleMenuQueryParam, ...) (*schema.RoleMenuQueryResult, error)
- func (a *RoleMenu) Update(ctx context.Context, item *schema.RoleMenu) error
- type User
- func (a *User) Create(ctx context.Context, item *schema.User) error
- func (a *User) Delete(ctx context.Context, id string) error
- func (a *User) Exists(ctx context.Context, id string) (bool, error)
- func (a *User) ExistsUsername(ctx context.Context, username string) (bool, error)
- func (a *User) Get(ctx context.Context, id string, opts ...schema.UserQueryOptions) (*schema.User, error)
- func (a *User) GetByUsername(ctx context.Context, username string, opts ...schema.UserQueryOptions) (*schema.User, error)
- func (a *User) Query(ctx context.Context, params schema.UserQueryParam, ...) (*schema.UserQueryResult, error)
- func (a *User) Update(ctx context.Context, item *schema.User, selectFields ...string) error
- func (a *User) UpdatePasswordByID(ctx context.Context, id string, password string) error
- type UserRole
- func (a *UserRole) Create(ctx context.Context, item *schema.UserRole) error
- func (a *UserRole) Delete(ctx context.Context, id string) error
- func (a *UserRole) DeleteByRoleID(ctx context.Context, roleID string) error
- func (a *UserRole) DeleteByUserID(ctx context.Context, userID string) error
- func (a *UserRole) Exists(ctx context.Context, id string) (bool, error)
- func (a *UserRole) Get(ctx context.Context, id string, opts ...schema.UserRoleQueryOptions) (*schema.UserRole, error)
- func (a *UserRole) Query(ctx context.Context, params schema.UserRoleQueryParam, ...) (*schema.UserRoleQueryResult, error)
- func (a *UserRole) Update(ctx context.Context, item *schema.UserRole) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMenuResourceDB ¶
Get menu resource storage instance
func GetRoleMenuDB ¶
Get role menu storage instance
Types ¶
type Menu ¶
Menu management for RBAC
func (*Menu) ExistsCodeByParentID ¶
Checks if a menu with the specified `code` exists under the specified `parentID` in the database.
func (*Menu) ExistsNameByParentID ¶
Checks if a menu with the specified `name` exists under the specified `parentID` in the database.
func (*Menu) Get ¶
func (a *Menu) Get(ctx context.Context, id string, opts ...schema.MenuQueryOptions) (*schema.Menu, error)
Get the specified menu from the database.
func (*Menu) GetByCodeAndParentID ¶
func (*Menu) GetByNameAndParentID ¶ added in v10.0.2
func (a *Menu) GetByNameAndParentID(ctx context.Context, name, parentID string, opts ...schema.MenuQueryOptions) (*schema.Menu, error)
GetByNameAndParentID get the specified menu from the database.
func (*Menu) Query ¶
func (a *Menu) Query(ctx context.Context, params schema.MenuQueryParam, opts ...schema.MenuQueryOptions) (*schema.MenuQueryResult, error)
Query menus from the database based on the provided parameters and options.
func (*Menu) UpdateParentPath ¶
Updates the parent path of the specified menu.
type MenuResource ¶
Menu resource management for RBAC
func (*MenuResource) Create ¶
func (a *MenuResource) Create(ctx context.Context, item *schema.MenuResource) error
Create a new menu resource.
func (*MenuResource) Delete ¶
func (a *MenuResource) Delete(ctx context.Context, id string) error
Delete the specified menu resource from the database.
func (*MenuResource) DeleteByMenuID ¶
func (a *MenuResource) DeleteByMenuID(ctx context.Context, menuID string) error
Deletes the menu resource by menu id.
func (*MenuResource) ExistsMethodPathByMenuID ¶ added in v10.0.2
func (a *MenuResource) ExistsMethodPathByMenuID(ctx context.Context, method, path, menuID string) (bool, error)
ExistsMethodPathByMenuID checks if the specified menu resource exists in the database.
func (*MenuResource) Get ¶
func (a *MenuResource) Get(ctx context.Context, id string, opts ...schema.MenuResourceQueryOptions) (*schema.MenuResource, error)
Get the specified menu resource from the database.
func (*MenuResource) Query ¶
func (a *MenuResource) Query(ctx context.Context, params schema.MenuResourceQueryParam, opts ...schema.MenuResourceQueryOptions) (*schema.MenuResourceQueryResult, error)
Query menu resources from the database based on the provided parameters and options.
func (*MenuResource) Update ¶
func (a *MenuResource) Update(ctx context.Context, item *schema.MenuResource) error
Update the specified menu resource in the database.
type Role ¶
Role management for RBAC
func (*Role) Get ¶
func (a *Role) Get(ctx context.Context, id string, opts ...schema.RoleQueryOptions) (*schema.Role, error)
Get the specified role from the database.
func (*Role) Query ¶
func (a *Role) Query(ctx context.Context, params schema.RoleQueryParam, opts ...schema.RoleQueryOptions) (*schema.RoleQueryResult, error)
Query roles from the database based on the provided parameters and options.
type RoleMenu ¶
Role permissions for RBAC
func (*RoleMenu) DeleteByMenuID ¶
Deletes role menus by menu id.
func (*RoleMenu) DeleteByRoleID ¶
Deletes role menus by role id.
func (*RoleMenu) Get ¶
func (a *RoleMenu) Get(ctx context.Context, id string, opts ...schema.RoleMenuQueryOptions) (*schema.RoleMenu, error)
Get the specified role menu from the database.
func (*RoleMenu) Query ¶
func (a *RoleMenu) Query(ctx context.Context, params schema.RoleMenuQueryParam, opts ...schema.RoleMenuQueryOptions) (*schema.RoleMenuQueryResult, error)
Query role menus from the database based on the provided parameters and options.
type User ¶
User management for RBAC
func (*User) ExistsUsername ¶
func (*User) Get ¶
func (a *User) Get(ctx context.Context, id string, opts ...schema.UserQueryOptions) (*schema.User, error)
Get the specified user from the database.
func (*User) GetByUsername ¶
func (*User) Query ¶
func (a *User) Query(ctx context.Context, params schema.UserQueryParam, opts ...schema.UserQueryOptions) (*schema.UserQueryResult, error)
Query users from the database based on the provided parameters and options.
type UserRole ¶
User roles for RBAC
func (*UserRole) DeleteByRoleID ¶
func (*UserRole) DeleteByUserID ¶
func (*UserRole) Get ¶
func (a *UserRole) Get(ctx context.Context, id string, opts ...schema.UserRoleQueryOptions) (*schema.UserRole, error)
Get the specified user role from the database.
func (*UserRole) Query ¶
func (a *UserRole) Query(ctx context.Context, params schema.UserRoleQueryParam, opts ...schema.UserRoleQueryOptions) (*schema.UserRoleQueryResult, error)
Query user roles from the database based on the provided parameters and options.