memory

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package memory provides in-memory repository implementations for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLDAPRepository

func NewLDAPRepository() repository.LDAPRepository

NewLDAPRepository creates a new in-memory LDAP repository.

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 LDAPRepository

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

LDAPRepository is an in-memory implementation of LDAPRepository.

func (*LDAPRepository) CreateAuthLog

func (r *LDAPRepository) CreateAuthLog(log *models.LDAPAuthenticationLog) error

func (*LDAPRepository) CreateConfig

func (r *LDAPRepository) CreateConfig(config *models.LDAPConfiguration) error

func (*LDAPRepository) CreateGroupMapping

func (r *LDAPRepository) CreateGroupMapping(mapping *models.LDAPGroupMapping) error

func (*LDAPRepository) CreateSyncHistory

func (r *LDAPRepository) CreateSyncHistory(history *models.LDAPSyncHistory) error

func (*LDAPRepository) CreateUserMapping

func (r *LDAPRepository) CreateUserMapping(mapping *models.LDAPUserMapping) error

func (*LDAPRepository) DeleteConfig

func (r *LDAPRepository) DeleteConfig(id int) error

func (*LDAPRepository) DeleteGroupMapping

func (r *LDAPRepository) DeleteGroupMapping(id int) error

func (*LDAPRepository) DeleteOldAuthLogs

func (r *LDAPRepository) DeleteOldAuthLogs(configID int, keepDays int) error

func (*LDAPRepository) DeleteOldSyncHistory

func (r *LDAPRepository) DeleteOldSyncHistory(configID int, keepDays int) error

func (*LDAPRepository) DeleteUserMapping

func (r *LDAPRepository) DeleteUserMapping(id int) error

func (*LDAPRepository) GetActiveConfig

func (r *LDAPRepository) GetActiveConfig() (*models.LDAPConfiguration, error)

func (*LDAPRepository) GetAuthLogsByTimeRange

func (r *LDAPRepository) GetAuthLogsByTimeRange(configID int, startTime, endTime time.Time) ([]*models.LDAPAuthenticationLog, error)

func (*LDAPRepository) GetAuthLogsByUsername

func (r *LDAPRepository) GetAuthLogsByUsername(username string, limit int) ([]*models.LDAPAuthenticationLog, error)

func (*LDAPRepository) GetAuthStatistics

func (r *LDAPRepository) GetAuthStatistics(configID int, days int) (map[string]interface{}, error)

func (*LDAPRepository) GetConfigByID

func (r *LDAPRepository) GetConfigByID(id int) (*models.LDAPConfiguration, error)

func (*LDAPRepository) GetGroupMappingByGroupID

func (r *LDAPRepository) GetGroupMappingByGroupID(groupID int) (*models.LDAPGroupMapping, error)

func (*LDAPRepository) GetGroupMappingByLDAPDN

func (r *LDAPRepository) GetGroupMappingByLDAPDN(configID int, dn string) (*models.LDAPGroupMapping, error)

func (*LDAPRepository) GetGroupMappingByLDAPGUID

func (r *LDAPRepository) GetGroupMappingByLDAPGUID(configID int, guid string) (*models.LDAPGroupMapping, error)

func (*LDAPRepository) GetLatestSyncHistory

func (r *LDAPRepository) GetLatestSyncHistory(configID int) (*models.LDAPSyncHistory, error)

func (*LDAPRepository) GetSyncHistoryByID

func (r *LDAPRepository) GetSyncHistoryByID(id int) (*models.LDAPSyncHistory, error)

func (*LDAPRepository) GetSyncStatistics

func (r *LDAPRepository) GetSyncStatistics(configID int) (*models.LDAPSyncStatistics, error)

func (*LDAPRepository) GetUserMappingByLDAPDN

func (r *LDAPRepository) GetUserMappingByLDAPDN(configID int, dn string) (*models.LDAPUserMapping, error)

func (*LDAPRepository) GetUserMappingByLDAPGUID

func (r *LDAPRepository) GetUserMappingByLDAPGUID(configID int, guid string) (*models.LDAPUserMapping, error)

func (*LDAPRepository) GetUserMappingByUserID

func (r *LDAPRepository) GetUserMappingByUserID(userID int) (*models.LDAPUserMapping, error)

func (*LDAPRepository) ListConfigs

func (r *LDAPRepository) ListConfigs() ([]*models.LDAPConfiguration, error)

func (*LDAPRepository) ListGroupMappings

func (r *LDAPRepository) ListGroupMappings(configID int) ([]*models.LDAPGroupMapping, error)

func (*LDAPRepository) ListSyncHistory

func (r *LDAPRepository) ListSyncHistory(configID int, limit, offset int) ([]*models.LDAPSyncHistory, error)

func (*LDAPRepository) ListUserMappings

func (r *LDAPRepository) ListUserMappings(configID int) ([]*models.LDAPUserMapping, error)

func (*LDAPRepository) RecordConnectionTest

func (r *LDAPRepository) RecordConnectionTest(test *models.LDAPConnectionTest) error

func (*LDAPRepository) UpdateConfig

func (r *LDAPRepository) UpdateConfig(config *models.LDAPConfiguration) error

func (*LDAPRepository) UpdateGroupMapping

func (r *LDAPRepository) UpdateGroupMapping(mapping *models.LDAPGroupMapping) error

func (*LDAPRepository) UpdateSyncHistory

func (r *LDAPRepository) UpdateSyncHistory(history *models.LDAPSyncHistory) error

func (*LDAPRepository) UpdateUserMapping

func (r *LDAPRepository) UpdateUserMapping(mapping *models.LDAPUserMapping) error

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