Documentation ¶
Index ¶
Constants ¶
View Source
const (
// The database table name for roles.
TableName = "roles"
)
Variables ¶
View Source
var ( // ErrRoleExists is returned by validate when // a role name already exists. ErrRoleExists = errors.New("role already exists") )
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface { List() (domain.Roles, error) Find(id int) (domain.Role, error) Create(r domain.Role) (domain.Role, error) Update(r domain.Role) (domain.Role, error) Exists(name string) bool }
Repository defines methods for roles to interact with the database.
type Store ¶
Store defines the data layer for roles.
func (*Store) Create ¶
Create
Returns a new role upon creation. Returns errors.INTERNAL if the SQL query was invalid. Returns errors.CONFLICT if the the role ID already exists.
func (*Store) Exists ¶
Exists
Returns a bool indicating if the role exists by ID. Logs errors.INTERNAL if there was an error executing the query.
func (*Store) Find ¶
Find
Returns a roles by searching with the given ID. Returns errors.INTERNAL if there was an error executing the query. Returns errors.NOTFOUND if the role was not found by the given ID.
Click to show internal directories.
Click to hide internal directories.