roles

package
v0.0.0-...-ec225d0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBRepository

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

func (*DBRepository) Destroy

func (r *DBRepository) Destroy(ctx context.Context, roleID uuid.UUID) error

func (*DBRepository) Index

func (r *DBRepository) Index(ctx context.Context) (*[]Role, error)

func (*DBRepository) Show

func (r *DBRepository) Show(ctx context.Context, roleID uuid.UUID) (*Role, error)

func (*DBRepository) Store

func (r *DBRepository) Store(ctx context.Context, role *Role) error

func (*DBRepository) Update

func (r *DBRepository) Update(
	ctx context.Context,
	roleID uuid.UUID,
	role *Role) error

type Role

type Role struct {
	ID          uuid.UUID `gorm:"type:uuid" json:"id"`
	Privilege   string    `gorm:"type:string" json:"privilege"`
	Description string    `gorm:"type:string" json:"description"`
	CreatedAt   time.Time `gorm:"autoUpdateTime" json:"created_at"`
	UpdatedAt   time.Time `gorm:"autoCreateTime" json:"updated_at"`
}

func (*Role) BeforeCreate

func (role *Role) BeforeCreate(tx *gorm.DB) (err error)

func (Role) CreateRoleValidation

func (r Role) CreateRoleValidation() error

type RoleController

type RoleController struct {
	RoleUseCase RoleUseCase
}

func (*RoleController) CreateRoleController

func (h *RoleController) CreateRoleController(c *fiber.Ctx) error

func (*RoleController) DeleteRoleController

func (h *RoleController) DeleteRoleController(c *fiber.Ctx) error

func (*RoleController) GetRoleController

func (h *RoleController) GetRoleController(c *fiber.Ctx) error

func (*RoleController) GetRolesController

func (h *RoleController) GetRolesController(c *fiber.Ctx) error

func (*RoleController) UpdateRoleController

func (h *RoleController) UpdateRoleController(c *fiber.Ctx) error

type RoleRepository

type RoleRepository interface {
	Store(ctx context.Context, role *Role) error
	Update(ctx context.Context, roleID uuid.UUID, role *Role) error
	Destroy(ctx context.Context, roleID uuid.UUID) error
	Index(ctx context.Context) (*[]Role, error)
	Show(ctx context.Context, roleID uuid.UUID) (*Role, error)
}

func NewRoleRepository

func NewRoleRepository(dbConn *gorm.DB) RoleRepository

type RoleUseCase

type RoleUseCase interface {
	GetRoles(ctx context.Context) (*[]Role, error)
	GetRole(ctx context.Context, roleID uuid.UUID) (*Role, error)
	DeleteRole(ctx context.Context, roleID uuid.UUID) error
	UpdateRole(ctx context.Context, roleID uuid.UUID, role *Role) error
	CreateRole(ctx context.Context, role *Role) error
}

func NewRoleUseCase

func NewRoleUseCase(r RoleRepository) RoleUseCase

Jump to

Keyboard shortcuts

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