memory

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package memory provides in-memory repository implementations for testing.

Index

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

func (r *GroupRepository) CreateGroup(ctx context.Context, group *models.Group) error

CreateGroup creates a new group.

func (*GroupRepository) DeleteGroup

func (r *GroupRepository) DeleteGroup(ctx context.Context, id string) error

DeleteGroup deletes a group.

func (*GroupRepository) GetByName

func (r *GroupRepository) GetByName(ctx context.Context, name string) (*models.Group, error)

GetByName retrieves a group by name (alias for GetGroupByName).

func (*GroupRepository) GetGroup

func (r *GroupRepository) GetGroup(ctx context.Context, id string) (*models.Group, error)

GetGroup retrieves a group by ID.

func (*GroupRepository) GetGroupByName

func (r *GroupRepository) GetGroupByName(ctx context.Context, name string) (*models.Group, error)

GetGroupByName retrieves a group by name.

func (*GroupRepository) GetUserGroups

func (r *GroupRepository) GetUserGroups(ctx context.Context, userID string) ([]models.Group, error)

GetUserGroups returns all groups for a user.

func (*GroupRepository) ListGroups

func (r *GroupRepository) ListGroups(ctx context.Context) ([]models.Group, error)

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

func (r *GroupRepository) UpdateGroup(ctx context.Context, group *models.Group) error

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

func (r *RoleRepository) CreateRole(ctx context.Context, role *models.Role) error

CreateRole creates a new role.

func (*RoleRepository) DeleteRole

func (r *RoleRepository) DeleteRole(ctx context.Context, id string) error

DeleteRole deletes a role.

func (*RoleRepository) GetByName

func (r *RoleRepository) GetByName(ctx context.Context, name string) (*models.Role, error)

GetByName retrieves a role by name (alias for GetRoleByName).

func (*RoleRepository) GetRole

func (r *RoleRepository) GetRole(ctx context.Context, id string) (*models.Role, error)

GetRole retrieves a role by ID.

func (*RoleRepository) GetRoleByName

func (r *RoleRepository) GetRoleByName(ctx context.Context, name string) (*models.Role, error)

GetRoleByName retrieves a role by name.

func (*RoleRepository) ListRoles

func (r *RoleRepository) ListRoles(ctx context.Context) ([]models.Role, error)

ListRoles returns all roles.

func (*RoleRepository) UpdateRole

func (r *RoleRepository) UpdateRole(ctx context.Context, role *models.Role) error

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.

func (*UserRepository) List

func (r *UserRepository) List() ([]models.User, error)

List returns all users.

func (*UserRepository) Update

func (r *UserRepository) Update(user *models.User) error

Update updates an existing user.

Jump to

Keyboard shortcuts

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