role

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package role handles role-related operations including creating, updating, fetching, and deleting roles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePermissions

func ComparePermissions(old, new []string) (added, removed []string)

ComparePermissions returns added and removed permissions between old and new permission sets.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles role-related operations.

func New

func New(opts Opts) (*Manager, error)

New creates and returns a new instance of the Manager.

func (*Manager) Create

func (u *Manager) Create(r models.Role) (models.Role, error)

Create creates a new role.

func (*Manager) Delete

func (u *Manager) Delete(id int) error

Delete deletes a role by ID.

func (*Manager) Get

func (u *Manager) Get(id int) (models.Role, error)

Get retrieves a role by ID.

func (*Manager) GetAll

func (u *Manager) GetAll() ([]models.Role, error)

GetAll retrieves all roles.

func (*Manager) Update

func (u *Manager) Update(id int, r models.Role) (models.Role, error)

Update updates an existing role.

type Opts

type Opts struct {
	DB   *sqlx.DB
	Lo   *logf.Logger
	I18n *i18n.I18n
}

Opts contains options for initializing the Manager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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