dal

package
v10.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMenuDB

func GetMenuDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

Get menu storage instance

func GetMenuResourceDB

func GetMenuResourceDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

Get menu resource storage instance

func GetRoleDB

func GetRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

Get role storage instance

func GetRoleMenuDB

func GetRoleMenuDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

Get role menu storage instance

func GetUserDB

func GetUserDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

Get user storage instance

func GetUserRoleDB

func GetUserRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

Get user role storage instance

Types

type Menu struct {
	DB *gorm.DB
}

Menu management for RBAC

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

Create a new menu.

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

Delete the specified menu from the database.

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

Checks if the specified menu exists in the database.

func (a *Menu) ExistsCodeByParentID(ctx context.Context, code, parentID string) (bool, error)

Checks if a menu with the specified `code` exists under the specified `parentID` in the database.

func (a *Menu) ExistsNameByParentID(ctx context.Context, name, parentID string) (bool, error)

Checks if a menu with the specified `name` exists under the specified `parentID` in the database.

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

Get the specified menu from the database.

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)

GetByNameAndParentID get the specified menu from the database.

Query menus from the database based on the provided parameters and options.

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

Update the specified menu in the database.

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

Updates the parent path of the specified menu.

func (a *Menu) UpdateStatusByParentPath(ctx context.Context, parentPath, status string) error

Updates the status of all menus whose parent path starts with the provided parent path.

type MenuResource struct {
	DB *gorm.DB
}

Menu resource management for RBAC

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

Create a new menu resource.

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

Delete the specified menu resource from the database.

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

Deletes the menu resource by menu id.

func (a *MenuResource) Exists(ctx context.Context, id string) (bool, error)

Exist checks if the specified menu resource exists in the database.

func (a *MenuResource) ExistsMethodPathByMenuID(ctx context.Context, method, path, menuID string) (bool, error)

ExistsMethodPathByMenuID checks if the specified menu resource exists in the database.

Get the specified menu resource from the database.

Query menu resources from the database based on the provided parameters and options.

func (a *MenuResource) Update(ctx context.Context, item *schema.MenuResource) error

Update the specified menu resource in the database.

type Role

type Role struct {
	DB *gorm.DB
}

Role management for RBAC

func (*Role) Create

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

Create a new role.

func (*Role) Delete

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

Delete the specified role from the database.

func (*Role) Exists

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

Exist checks if the specified role exists in the database.

func (*Role) ExistsCode

func (a *Role) ExistsCode(ctx context.Context, code string) (bool, error)

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

Query roles from the database based on the provided parameters and options.

func (*Role) Update

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

Update the specified role in the database.

type RoleMenu

type RoleMenu struct {
	DB *gorm.DB
}

Role permissions for RBAC

func (*RoleMenu) Create

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

Create a new role menu.

func (*RoleMenu) Delete

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

Delete the specified role menu from the database.

func (*RoleMenu) DeleteByMenuID

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

Deletes role menus by menu id.

func (*RoleMenu) DeleteByRoleID

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

Deletes role menus by role id.

func (*RoleMenu) Exists

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

Exist checks if the specified role menu exists in the database.

func (*RoleMenu) Get

Get the specified role menu from the database.

func (*RoleMenu) Query

Query role menus from the database based on the provided parameters and options.

func (*RoleMenu) Update

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

Update the specified role menu in the database.

type User

type User struct {
	DB *gorm.DB
}

User management for RBAC

func (*User) Create

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

Create a new user.

func (*User) Delete

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

Delete the specified user from the database.

func (*User) Exists

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

Exist checks if the specified user exists in the database.

func (*User) ExistsUsername

func (a *User) ExistsUsername(ctx context.Context, username string) (bool, error)

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 (a *User) GetByUsername(ctx context.Context, username string, opts ...schema.UserQueryOptions) (*schema.User, error)

func (*User) Query

Query users from the database based on the provided parameters and options.

func (*User) Update

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

Update the specified user in the database.

func (*User) UpdatePasswordByID

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

type UserRole

type UserRole struct {
	DB *gorm.DB
}

User roles for RBAC

func (*UserRole) Create

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

Create a new user role.

func (*UserRole) Delete

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

Delete the specified user role from the database.

func (*UserRole) DeleteByRoleID

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

func (*UserRole) DeleteByUserID

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

func (*UserRole) Exists

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

Exist checks if the specified user role exists in the database.

func (*UserRole) Get

Get the specified user role from the database.

func (*UserRole) Query

Query user roles from the database based on the provided parameters and options.

func (*UserRole) Update

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

Update the specified user role in the database.

Jump to

Keyboard shortcuts

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