Documentation
¶
Overview ¶
Package memory provides in-memory repository implementations for testing.
Index ¶
- type GroupRepository
- func (r *GroupRepository) AddUserToGroup(ctx context.Context, groupID, userID string) error
- func (r *GroupRepository) CreateGroup(ctx context.Context, group *models.Group) error
- func (r *GroupRepository) DeleteGroup(ctx context.Context, id string) error
- func (r *GroupRepository) GetByName(ctx context.Context, name string) (*models.Group, error)
- func (r *GroupRepository) GetGroup(ctx context.Context, id string) (*models.Group, error)
- func (r *GroupRepository) GetGroupByName(ctx context.Context, name string) (*models.Group, error)
- func (r *GroupRepository) GetUserGroups(ctx context.Context, userID string) ([]models.Group, error)
- func (r *GroupRepository) ListGroups(ctx context.Context) ([]models.Group, error)
- func (r *GroupRepository) RemoveUserFromGroup(ctx context.Context, groupID, userID string) error
- func (r *GroupRepository) UpdateGroup(ctx context.Context, group *models.Group) error
- type RoleRepository
- func (r *RoleRepository) CreateRole(ctx context.Context, role *models.Role) error
- func (r *RoleRepository) DeleteRole(ctx context.Context, id string) error
- func (r *RoleRepository) GetByName(ctx context.Context, name string) (*models.Role, error)
- func (r *RoleRepository) GetRole(ctx context.Context, id string) (*models.Role, error)
- func (r *RoleRepository) GetRoleByName(ctx context.Context, name string) (*models.Role, error)
- func (r *RoleRepository) ListRoles(ctx context.Context) ([]models.Role, error)
- func (r *RoleRepository) UpdateRole(ctx context.Context, role *models.Role) error
- type UserRepository
- func (r *UserRepository) Create(user *models.User) error
- func (r *UserRepository) Delete(id uint) error
- func (r *UserRepository) GetByEmail(email string) (*models.User, error)
- func (r *UserRepository) GetByID(id uint) (*models.User, error)
- func (r *UserRepository) GetByLogin(login string) (*models.User, error)
- func (r *UserRepository) List() ([]models.User, error)
- func (r *UserRepository) Update(user *models.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GroupRepository ¶
type GroupRepository struct {
// contains filtered or unexported fields
}
GroupRepository provides an in-memory implementation of the GroupRepository interface.
func NewGroupRepository ¶
func NewGroupRepository() *GroupRepository
NewGroupRepository creates a new in-memory group repository.
func (*GroupRepository) AddUserToGroup ¶
func (r *GroupRepository) AddUserToGroup(ctx context.Context, groupID, userID string) error
AddUserToGroup adds a user to a group.
func (*GroupRepository) CreateGroup ¶
CreateGroup creates a new group.
func (*GroupRepository) DeleteGroup ¶
func (r *GroupRepository) DeleteGroup(ctx context.Context, id string) error
DeleteGroup deletes a group.
func (*GroupRepository) GetGroupByName ¶
GetGroupByName retrieves a group by name.
func (*GroupRepository) GetUserGroups ¶
GetUserGroups returns all groups for a user.
func (*GroupRepository) ListGroups ¶
ListGroups returns all groups.
func (*GroupRepository) RemoveUserFromGroup ¶
func (r *GroupRepository) RemoveUserFromGroup(ctx context.Context, groupID, userID string) error
RemoveUserFromGroup removes a user from a group.
func (*GroupRepository) UpdateGroup ¶
UpdateGroup updates an existing group.
type RoleRepository ¶
type RoleRepository struct {
// contains filtered or unexported fields
}
RoleRepository provides an in-memory implementation of the RoleRepository interface.
func NewRoleRepository ¶
func NewRoleRepository() *RoleRepository
NewRoleRepository creates a new in-memory role repository.
func (*RoleRepository) CreateRole ¶
CreateRole creates a new role.
func (*RoleRepository) DeleteRole ¶
func (r *RoleRepository) DeleteRole(ctx context.Context, id string) error
DeleteRole deletes a role.
func (*RoleRepository) GetRoleByName ¶
GetRoleByName retrieves a role by name.
func (*RoleRepository) UpdateRole ¶
UpdateRole updates an existing role.
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository provides an in-memory implementation of the UserRepository interface.
func NewUserRepository ¶
func NewUserRepository() *UserRepository
NewUserRepository creates a new in-memory user repository.
func (*UserRepository) Create ¶
func (r *UserRepository) Create(user *models.User) error
Create creates a new user.
func (*UserRepository) Delete ¶
func (r *UserRepository) Delete(id uint) error
Delete deletes a user.
func (*UserRepository) GetByEmail ¶
func (r *UserRepository) GetByEmail(email string) (*models.User, error)
GetByEmail retrieves a user by email.
func (*UserRepository) GetByID ¶
func (r *UserRepository) GetByID(id uint) (*models.User, error)
GetByID retrieves a user by ID.
func (*UserRepository) GetByLogin ¶
func (r *UserRepository) GetByLogin(login string) (*models.User, error)
GetByLogin retrieves a user by login.