roles

package
v0.0.0-...-6723153 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 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 MultipleRoleResponse

type MultipleRoleResponse struct {
	Roles []Role `json:"roles"`
}

func (*MultipleRoleResponse) Render

type Role

type Role struct {
	Name        string
	VisibleName string `db:"visible_name"`
}

type RoleCreationRequest

type RoleCreationRequest struct {
	Name        string `json:"name" validate:"required,uppercase,max=255"`
	VisibleName string `json:"visibleName" db:"visible_name" validate:"required,max=255"`
}

type RoleHandler

type RoleHandler interface {
	Routes() chi.Router

	SearchByVisibleName(w http.ResponseWriter, r *http.Request)
	Get(w http.ResponseWriter, r *http.Request)
	Create(w http.ResponseWriter, r *http.Request)
	Update(w http.ResponseWriter, r *http.Request)
	Delete(w http.ResponseWriter, r *http.Request)
}

func NewRoleHandler

func NewRoleHandler(r chi.Router, db *sqlx.DB) RoleHandler

type RoleService

type RoleService interface {
	SearchByVisibleName(name string) ([]Role, error)
	Get(name string) (*Role, error)
	Create(req *RoleCreationRequest) error
	Update(name string, req *RoleUpdateRequest) error
	Delete(name string) error
}

func NewRoleService

func NewRoleService(db *sqlx.DB) RoleService

type RoleUpdateRequest

type RoleUpdateRequest struct {
	VisibleName string `json:"visibleName" db:"visible_name" validate:"required,max=255"`
}

type SingleRoleResponse

type SingleRoleResponse struct {
	Role Role `json:"role"`
}

func (*SingleRoleResponse) Render

Jump to

Keyboard shortcuts

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