Documentation
¶
Index ¶
- Variables
- func MigrateUserModels(db *gorm.DB) error
- func NewCachedRoleRepository(repo domain.RoleRepository, cache Cache) domain.RoleRepository
- func NewCachedUserRepository(repo domain.UserRepository, cache Cache) domain.UserRepository
- func NewFileStorageAdapter(baseDir string) (domain.FileStorage, error)
- func NewGormAccountMemberRepository(db *gorm.DB) domain.AccountMemberRepository
- func NewGormAccountMemberWriteRepository(db *gorm.DB) domain.AccountMemberWriteRepository
- func NewGormAccountRepository(db *gorm.DB) domain.AccountRepository
- func NewGormAccountWriteRepository(db *gorm.DB) domain.AccountWriteRepository
- func NewGormInvitationRepository(db *gorm.DB) domain.InvitationRepository
- func NewGormInvitationWriteRepository(db *gorm.DB) domain.InvitationWriteRepository
- func NewGormRoleRepository(db *gorm.DB) domain.RoleRepository
- func NewGormUserRepository(db *gorm.DB) domain.UserRepository
- func NewGormUserWriteRepository(db *gorm.DB) domain.UserWriteRepository
- func NewOptimizedGormAccountMemberRepository(db *gorm.DB) domain.AccountMemberRepository
- func NewOptimizedGormUserRepository(db *gorm.DB, cache Cache) domain.UserRepository
- func ProvideAccountMemberRepository(db *gorm.DB) (domain.AccountMemberRepository, error)
- func ProvideAccountMemberWriteRepository(db *gorm.DB) (domain.AccountMemberWriteRepository, error)
- func ProvideAccountRepository(db *gorm.DB) (domain.AccountRepository, error)
- func ProvideAccountWriteRepository(db *gorm.DB) (domain.AccountWriteRepository, error)
- func ProvideFileStorage(baseDir string) (domain.FileStorage, error)
- func ProvideInvitationRepository(db *gorm.DB) (domain.InvitationRepository, error)
- func ProvideInvitationWriteRepository(db *gorm.DB) (domain.InvitationWriteRepository, error)
- func ProvideRoleRepository(db *gorm.DB, cache Cache) (domain.RoleRepository, error)
- func ProvideUserDatabase(db *gorm.DB) (*gorm.DB, error)
- func ProvideUserRepository(db *gorm.DB, cache Cache) (domain.UserRepository, error)
- func ProvideUserWriteRepository(db *gorm.DB) (domain.UserWriteRepository, error)
- func ProvideWebIDGenerator(baseURL string) (domain.WebIDGenerator, error)
- func SeedSystemRoles(db *gorm.DB) error
- type AccountMemberModel
- type AccountModel
- type Cache
- type CachedRoleRepository
- type CachedUserRepository
- func (r *CachedUserRepository) Exists(ctx context.Context, id string) (bool, error)
- func (r *CachedUserRepository) GetByEmail(ctx context.Context, email string) (*domain.User, error)
- func (r *CachedUserRepository) GetByID(ctx context.Context, id string) (*domain.User, error)
- func (r *CachedUserRepository) GetByWebID(ctx context.Context, webid string) (*domain.User, error)
- func (r *CachedUserRepository) List(ctx context.Context, filter domain.UserFilter) ([]*domain.User, error)
- type GormAccountMemberRepository
- func (r *GormAccountMemberRepository) GetByAccountAndUser(ctx context.Context, accountID, userID string) (*domain.AccountMember, error)
- func (r *GormAccountMemberRepository) GetByID(ctx context.Context, id string) (*domain.AccountMember, error)
- func (r *GormAccountMemberRepository) ListByAccount(ctx context.Context, accountID string) ([]*domain.AccountMember, error)
- func (r *GormAccountMemberRepository) ListByUser(ctx context.Context, userID string) ([]*domain.AccountMember, error)
- type GormAccountMemberWriteRepository
- func (r *GormAccountMemberWriteRepository) Create(ctx context.Context, member *domain.AccountMember) error
- func (r *GormAccountMemberWriteRepository) Delete(ctx context.Context, id string) error
- func (r *GormAccountMemberWriteRepository) Update(ctx context.Context, member *domain.AccountMember) error
- type GormAccountRepository
- type GormAccountWriteRepository
- type GormInvitationRepository
- func (r *GormInvitationRepository) GetByID(ctx context.Context, id string) (*domain.Invitation, error)
- func (r *GormInvitationRepository) GetByToken(ctx context.Context, token string) (*domain.Invitation, error)
- func (r *GormInvitationRepository) ListByAccount(ctx context.Context, accountID string) ([]*domain.Invitation, error)
- func (r *GormInvitationRepository) ListByEmail(ctx context.Context, email string) ([]*domain.Invitation, error)
- type GormInvitationWriteRepository
- type GormRoleRepository
- type GormUserRepository
- func (r *GormUserRepository) Exists(ctx context.Context, id string) (bool, error)
- func (r *GormUserRepository) GetByEmail(ctx context.Context, email string) (*domain.User, error)
- func (r *GormUserRepository) GetByID(ctx context.Context, id string) (*domain.User, error)
- func (r *GormUserRepository) GetByWebID(ctx context.Context, webid string) (*domain.User, error)
- func (r *GormUserRepository) List(ctx context.Context, filter domain.UserFilter) ([]*domain.User, error)
- type GormUserWriteRepository
- type InMemoryCache
- func (c *InMemoryCache) Clear()
- func (c *InMemoryCache) DeleteRole(id string)
- func (c *InMemoryCache) DeleteUser(id string)
- func (c *InMemoryCache) GetRole(id string) (*domain.Role, bool)
- func (c *InMemoryCache) GetUser(id string) (*domain.User, bool)
- func (c *InMemoryCache) SetRole(id string, role *domain.Role)
- func (c *InMemoryCache) SetUser(id string, user *domain.User)
- type InvitationModel
- func (i *InvitationModel) Accept(ctx context.Context) error
- func (i *InvitationModel) MarkExpired(ctx context.Context) error
- func (i *InvitationModel) Revoke(ctx context.Context) error
- func (InvitationModel) TableName() string
- func (i *InvitationModel) UpdateStatus(ctx context.Context, status string) error
- type OptimizedGormAccountMemberRepository
- func (r *OptimizedGormAccountMemberRepository) GetByAccountAndUser(ctx context.Context, accountID, userID string) (*domain.AccountMember, error)
- func (r *OptimizedGormAccountMemberRepository) GetByID(ctx context.Context, id string) (*domain.AccountMember, error)
- func (r *OptimizedGormAccountMemberRepository) ListByAccount(ctx context.Context, accountID string) ([]*domain.AccountMember, error)
- func (r *OptimizedGormAccountMemberRepository) ListByUser(ctx context.Context, userID string) ([]*domain.AccountMember, error)
- type OptimizedGormUserRepository
- func (r *OptimizedGormUserRepository) Exists(ctx context.Context, id string) (bool, error)
- func (r *OptimizedGormUserRepository) GetByEmail(ctx context.Context, email string) (*domain.User, error)
- func (r *OptimizedGormUserRepository) GetByID(ctx context.Context, id string) (*domain.User, error)
- func (r *OptimizedGormUserRepository) GetByWebID(ctx context.Context, webid string) (*domain.User, error)
- func (r *OptimizedGormUserRepository) List(ctx context.Context, filter domain.UserFilter) ([]*domain.User, error)
- type RoleModel
- type UserFileStorage
- type UserModel
- type WebIDGenerator
- type WebIDUniquenessChecker
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUserNotFound is returned when a user's data is not found ErrUserNotFound = fmt.Errorf("user not found") // ErrInvalidUserID is returned when a user ID is invalid ErrInvalidUserID = fmt.Errorf("invalid user ID") )
var ( // ErrInvalidWebID is returned when a WebID format is invalid ErrInvalidWebID = fmt.Errorf("invalid WebID format") // ErrWebIDNotUnique is returned when a WebID is not unique ErrWebIDNotUnique = fmt.Errorf("WebID is not unique") )
var UserInfrastructureProviderSet = wire.NewSet( ProvideUserDatabase, ProvideWebIDGenerator, ProvideFileStorage, ProvideCache, )
Provider Sets
var UserManagementProviderSet = wire.NewSet( UserInfrastructureProviderSet, UserRepositoryProviderSet, UserWriteRepositoryProviderSet, )
Complete provider set for user management
var UserRepositoryProviderSet = wire.NewSet( ProvideUserRepository, ProvideAccountRepository, ProvideRoleRepository, ProvideAccountMemberRepository, ProvideInvitationRepository, )
var UserWriteRepositoryProviderSet = wire.NewSet( ProvideUserWriteRepository, ProvideAccountWriteRepository, ProvideAccountMemberWriteRepository, ProvideInvitationWriteRepository, )
Functions ¶
func MigrateUserModels ¶
MigrateUserModels performs auto-migration for all user management models
func NewCachedRoleRepository ¶
func NewCachedRoleRepository(repo domain.RoleRepository, cache Cache) domain.RoleRepository
NewCachedRoleRepository creates a cached role repository
func NewCachedUserRepository ¶
func NewCachedUserRepository(repo domain.UserRepository, cache Cache) domain.UserRepository
NewCachedUserRepository creates a cached user repository
func NewFileStorageAdapter ¶
func NewFileStorageAdapter(baseDir string) (domain.FileStorage, error)
NewFileStorageAdapter creates a new file storage adapter
func NewGormAccountMemberRepository ¶
func NewGormAccountMemberRepository(db *gorm.DB) domain.AccountMemberRepository
NewGormAccountMemberRepository creates a new GORM-based account member repository
func NewGormAccountMemberWriteRepository ¶
func NewGormAccountMemberWriteRepository(db *gorm.DB) domain.AccountMemberWriteRepository
NewGormAccountMemberWriteRepository creates a new GORM-based account member write repository
func NewGormAccountRepository ¶
func NewGormAccountRepository(db *gorm.DB) domain.AccountRepository
NewGormAccountRepository creates a new GORM-based account repository
func NewGormAccountWriteRepository ¶
func NewGormAccountWriteRepository(db *gorm.DB) domain.AccountWriteRepository
NewGormAccountWriteRepository creates a new GORM-based account write repository
func NewGormInvitationRepository ¶
func NewGormInvitationRepository(db *gorm.DB) domain.InvitationRepository
NewGormInvitationRepository creates a new GORM-based invitation repository
func NewGormInvitationWriteRepository ¶
func NewGormInvitationWriteRepository(db *gorm.DB) domain.InvitationWriteRepository
NewGormInvitationWriteRepository creates a new GORM-based invitation write repository
func NewGormRoleRepository ¶
func NewGormRoleRepository(db *gorm.DB) domain.RoleRepository
NewGormRoleRepository creates a new GORM-based role repository
func NewGormUserRepository ¶
func NewGormUserRepository(db *gorm.DB) domain.UserRepository
NewGormUserRepository creates a new GORM-based user repository
func NewGormUserWriteRepository ¶
func NewGormUserWriteRepository(db *gorm.DB) domain.UserWriteRepository
NewGormUserWriteRepository creates a new GORM-based user write repository
func NewOptimizedGormAccountMemberRepository ¶
func NewOptimizedGormAccountMemberRepository(db *gorm.DB) domain.AccountMemberRepository
NewOptimizedGormAccountMemberRepository creates an optimized account member repository
func NewOptimizedGormUserRepository ¶
func NewOptimizedGormUserRepository(db *gorm.DB, cache Cache) domain.UserRepository
NewOptimizedGormUserRepository creates a new optimized GORM-based user repository
func ProvideAccountMemberRepository ¶
func ProvideAccountMemberRepository(db *gorm.DB) (domain.AccountMemberRepository, error)
func ProvideAccountMemberWriteRepository ¶
func ProvideAccountMemberWriteRepository(db *gorm.DB) (domain.AccountMemberWriteRepository, error)
func ProvideAccountRepository ¶
func ProvideAccountRepository(db *gorm.DB) (domain.AccountRepository, error)
func ProvideAccountWriteRepository ¶
func ProvideAccountWriteRepository(db *gorm.DB) (domain.AccountWriteRepository, error)
func ProvideFileStorage ¶
func ProvideFileStorage(baseDir string) (domain.FileStorage, error)
func ProvideInvitationRepository ¶
func ProvideInvitationRepository(db *gorm.DB) (domain.InvitationRepository, error)
func ProvideInvitationWriteRepository ¶
func ProvideInvitationWriteRepository(db *gorm.DB) (domain.InvitationWriteRepository, error)
func ProvideRoleRepository ¶
func ProvideUserDatabase ¶
ProvideUserDatabase provides a GORM database instance with user models migrated
func ProvideUserRepository ¶
Repository Providers (Read-only) - now with caching and optimization
func ProvideUserWriteRepository ¶
func ProvideUserWriteRepository(db *gorm.DB) (domain.UserWriteRepository, error)
Write Repository Providers
func ProvideWebIDGenerator ¶
func ProvideWebIDGenerator(baseURL string) (domain.WebIDGenerator, error)
Service Infrastructure Providers
func SeedSystemRoles ¶
SeedSystemRoles creates the predefined system roles with proper permissions
Types ¶
type AccountMemberModel ¶
type AccountMemberModel struct {
ID string `gorm:"primaryKey;type:varchar(255)"`
AccountID string `gorm:"not null;type:varchar(255);index:idx_member_account;uniqueIndex:idx_account_user"`
Account AccountModel `gorm:"foreignKey:AccountID;references:ID;constraint:OnDelete:CASCADE"`
UserID string `gorm:"not null;type:varchar(255);index:idx_member_user;uniqueIndex:idx_account_user"`
User UserModel `gorm:"foreignKey:UserID;references:ID;constraint:OnDelete:CASCADE"`
RoleID string `gorm:"not null;type:varchar(255);index:idx_member_role"`
Role RoleModel `gorm:"foreignKey:RoleID;references:ID;constraint:OnDelete:CASCADE"`
InvitedBy string `gorm:"type:varchar(255);index:idx_member_inviter"`
Inviter *UserModel `gorm:"foreignKey:InvitedBy;references:ID;constraint:OnDelete:SET NULL"`
JoinedAt time.Time `gorm:"index:idx_member_joined;not null"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
AccountMemberModel represents the GORM model for account membership (projection from events)
func (AccountMemberModel) TableName ¶
func (AccountMemberModel) TableName() string
TableName specifies the table name for AccountMemberModel
func (*AccountMemberModel) UpdateInviter ¶
func (m *AccountMemberModel) UpdateInviter(ctx context.Context, inviterID string) error
UpdateInviter updates the inviter information with logging
func (*AccountMemberModel) UpdateRole ¶
func (m *AccountMemberModel) UpdateRole(ctx context.Context, newRoleID string) error
UpdateRole updates the member's role with logging
type AccountModel ¶
type AccountModel struct {
ID string `gorm:"primaryKey;type:varchar(255)"`
OwnerID string `gorm:"not null;type:varchar(255);index:idx_account_owner"`
Owner UserModel `gorm:"foreignKey:OwnerID;references:ID;constraint:OnDelete:CASCADE"`
Name string `gorm:"not null;type:varchar(255);index:idx_account_name"`
Description string `gorm:"type:text"`
Settings string `gorm:"type:text"` // JSON serialized AccountSettings
CreatedAt time.Time `gorm:"index:idx_account_created;not null"`
UpdatedAt time.Time `gorm:"not null"`
}
AccountModel represents the GORM model for accounts table
func (AccountModel) TableName ¶
func (AccountModel) TableName() string
TableName specifies the table name for AccountModel
func (*AccountModel) TransferOwnership ¶
func (a *AccountModel) TransferOwnership(ctx context.Context, newOwnerID string) error
TransferOwnership transfers account ownership with logging
func (*AccountModel) UpdateAccount ¶
func (a *AccountModel) UpdateAccount(ctx context.Context, name, description, settings string) error
UpdateAccount updates the account information with logging
type Cache ¶
type Cache interface {
GetUser(id string) (*domain.User, bool)
SetUser(id string, user *domain.User)
DeleteUser(id string)
GetRole(id string) (*domain.Role, bool)
SetRole(id string, role *domain.Role)
DeleteRole(id string)
Clear()
}
Cache interface for user management caching
func ProvideCache ¶
func ProvideCache() Cache
ProvideCache provides an in-memory cache for user management
type CachedRoleRepository ¶
type CachedRoleRepository struct {
// contains filtered or unexported fields
}
CachedRoleRepository wraps a role repository with caching
func (*CachedRoleRepository) GetSystemRoles ¶
GetSystemRoles retrieves system roles with caching
type CachedUserRepository ¶
type CachedUserRepository struct {
// contains filtered or unexported fields
}
CachedUserRepository wraps a user repository with caching
func (*CachedUserRepository) GetByEmail ¶
GetByEmail retrieves a user by email (no caching for now, could be added)
func (*CachedUserRepository) GetByWebID ¶
GetByWebID retrieves a user by WebID (no caching for now, could be added)
func (*CachedUserRepository) List ¶
func (r *CachedUserRepository) List(ctx context.Context, filter domain.UserFilter) ([]*domain.User, error)
List retrieves users with filtering (no caching for list operations)
type GormAccountMemberRepository ¶
type GormAccountMemberRepository struct {
// contains filtered or unexported fields
}
GormAccountMemberRepository implements domain.AccountMemberRepository using GORM
func (*GormAccountMemberRepository) GetByAccountAndUser ¶
func (r *GormAccountMemberRepository) GetByAccountAndUser(ctx context.Context, accountID, userID string) (*domain.AccountMember, error)
GetByAccountAndUser retrieves an account member by account ID and user ID
func (*GormAccountMemberRepository) GetByID ¶
func (r *GormAccountMemberRepository) GetByID(ctx context.Context, id string) (*domain.AccountMember, error)
GetByID retrieves an account member by ID
func (*GormAccountMemberRepository) ListByAccount ¶
func (r *GormAccountMemberRepository) ListByAccount(ctx context.Context, accountID string) ([]*domain.AccountMember, error)
ListByAccount retrieves all members of an account
func (*GormAccountMemberRepository) ListByUser ¶
func (r *GormAccountMemberRepository) ListByUser(ctx context.Context, userID string) ([]*domain.AccountMember, error)
ListByUser retrieves all account memberships for a user
type GormAccountMemberWriteRepository ¶
type GormAccountMemberWriteRepository struct {
// contains filtered or unexported fields
}
GormAccountMemberWriteRepository implements domain.AccountMemberWriteRepository using GORM
func (*GormAccountMemberWriteRepository) Create ¶
func (r *GormAccountMemberWriteRepository) Create(ctx context.Context, member *domain.AccountMember) error
Create creates a new account member in the database
func (*GormAccountMemberWriteRepository) Delete ¶
func (r *GormAccountMemberWriteRepository) Delete(ctx context.Context, id string) error
Delete deletes an account member from the database
func (*GormAccountMemberWriteRepository) Update ¶
func (r *GormAccountMemberWriteRepository) Update(ctx context.Context, member *domain.AccountMember) error
Update updates an existing account member in the database
type GormAccountRepository ¶
type GormAccountRepository struct {
// contains filtered or unexported fields
}
GormAccountRepository implements domain.AccountRepository using GORM
func (*GormAccountRepository) GetByOwner ¶
func (r *GormAccountRepository) GetByOwner(ctx context.Context, ownerID string) ([]*domain.Account, error)
GetByOwner retrieves accounts by owner ID
type GormAccountWriteRepository ¶
type GormAccountWriteRepository struct {
// contains filtered or unexported fields
}
GormAccountWriteRepository implements domain.AccountWriteRepository using GORM
type GormInvitationRepository ¶
type GormInvitationRepository struct {
// contains filtered or unexported fields
}
GormInvitationRepository implements domain.InvitationRepository using GORM
func (*GormInvitationRepository) GetByID ¶
func (r *GormInvitationRepository) GetByID(ctx context.Context, id string) (*domain.Invitation, error)
GetByID retrieves an invitation by ID
func (*GormInvitationRepository) GetByToken ¶
func (r *GormInvitationRepository) GetByToken(ctx context.Context, token string) (*domain.Invitation, error)
GetByToken retrieves an invitation by token
func (*GormInvitationRepository) ListByAccount ¶
func (r *GormInvitationRepository) ListByAccount(ctx context.Context, accountID string) ([]*domain.Invitation, error)
ListByAccount retrieves all invitations for an account
func (*GormInvitationRepository) ListByEmail ¶
func (r *GormInvitationRepository) ListByEmail(ctx context.Context, email string) ([]*domain.Invitation, error)
ListByEmail retrieves all invitations for an email address
type GormInvitationWriteRepository ¶
type GormInvitationWriteRepository struct {
// contains filtered or unexported fields
}
GormInvitationWriteRepository implements domain.InvitationWriteRepository using GORM
func (*GormInvitationWriteRepository) Create ¶
func (r *GormInvitationWriteRepository) Create(ctx context.Context, invitation *domain.Invitation) error
Create creates a new invitation in the database
func (*GormInvitationWriteRepository) Delete ¶
func (r *GormInvitationWriteRepository) Delete(ctx context.Context, id string) error
Delete deletes an invitation from the database
func (*GormInvitationWriteRepository) Update ¶
func (r *GormInvitationWriteRepository) Update(ctx context.Context, invitation *domain.Invitation) error
Update updates an existing invitation in the database
type GormRoleRepository ¶
type GormRoleRepository struct {
// contains filtered or unexported fields
}
GormRoleRepository implements domain.RoleRepository using GORM
func (*GormRoleRepository) GetSystemRoles ¶
GetSystemRoles retrieves all system roles (predefined roles)
type GormUserRepository ¶
type GormUserRepository struct {
// contains filtered or unexported fields
}
GormUserRepository implements domain.UserRepository using GORM
func (*GormUserRepository) GetByEmail ¶
GetByEmail retrieves a user by email
func (*GormUserRepository) GetByWebID ¶
GetByWebID retrieves a user by WebID
func (*GormUserRepository) List ¶
func (r *GormUserRepository) List(ctx context.Context, filter domain.UserFilter) ([]*domain.User, error)
List retrieves users with filtering
type GormUserWriteRepository ¶
type GormUserWriteRepository struct {
// contains filtered or unexported fields
}
GormUserWriteRepository implements domain.UserWriteRepository using GORM
type InMemoryCache ¶
type InMemoryCache struct {
// contains filtered or unexported fields
}
InMemoryCache provides a simple in-memory cache implementation
func NewInMemoryCache ¶
func NewInMemoryCache(ttl time.Duration) *InMemoryCache
NewInMemoryCache creates a new in-memory cache with TTL
func (*InMemoryCache) DeleteRole ¶
func (c *InMemoryCache) DeleteRole(id string)
DeleteRole removes a role from cache
func (*InMemoryCache) DeleteUser ¶
func (c *InMemoryCache) DeleteUser(id string)
DeleteUser removes a user from cache
func (*InMemoryCache) GetRole ¶
func (c *InMemoryCache) GetRole(id string) (*domain.Role, bool)
GetRole retrieves a role from cache
func (*InMemoryCache) GetUser ¶
func (c *InMemoryCache) GetUser(id string) (*domain.User, bool)
GetUser retrieves a user from cache
type InvitationModel ¶
type InvitationModel struct {
ID string `gorm:"primaryKey;type:varchar(255)"`
AccountID string `gorm:"not null;type:varchar(255);index:idx_invitation_account"`
Account AccountModel `gorm:"foreignKey:AccountID;references:ID;constraint:OnDelete:CASCADE"`
Email string `gorm:"not null;type:varchar(255);index:idx_invitation_email"`
RoleID string `gorm:"not null;type:varchar(255);index:idx_invitation_role"`
Role RoleModel `gorm:"foreignKey:RoleID;references:ID;constraint:OnDelete:CASCADE"`
Token string `gorm:"uniqueIndex:idx_invitation_token;not null;type:varchar(255)"`
InvitedBy string `gorm:"not null;type:varchar(255);index:idx_invitation_inviter"`
Inviter UserModel `gorm:"foreignKey:InvitedBy;references:ID;constraint:OnDelete:CASCADE"`
Status string `gorm:"index:idx_invitation_status;not null;type:varchar(50)"` // pending, accepted, expired, revoked
ExpiresAt time.Time `gorm:"index:idx_invitation_expires;not null"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
InvitationModel represents the GORM model for invitations table
func (*InvitationModel) Accept ¶
func (i *InvitationModel) Accept(ctx context.Context) error
Accept marks the invitation as accepted with logging
func (*InvitationModel) MarkExpired ¶
func (i *InvitationModel) MarkExpired(ctx context.Context) error
MarkExpired marks the invitation as expired with logging
func (*InvitationModel) Revoke ¶
func (i *InvitationModel) Revoke(ctx context.Context) error
Revoke marks the invitation as revoked with logging
func (InvitationModel) TableName ¶
func (InvitationModel) TableName() string
TableName specifies the table name for InvitationModel
func (*InvitationModel) UpdateStatus ¶
func (i *InvitationModel) UpdateStatus(ctx context.Context, status string) error
UpdateStatus updates the invitation status with logging
type OptimizedGormAccountMemberRepository ¶
type OptimizedGormAccountMemberRepository struct {
// contains filtered or unexported fields
}
OptimizedGormAccountMemberRepository implements optimized membership queries
func (*OptimizedGormAccountMemberRepository) GetByAccountAndUser ¶
func (r *OptimizedGormAccountMemberRepository) GetByAccountAndUser(ctx context.Context, accountID, userID string) (*domain.AccountMember, error)
GetByAccountAndUser retrieves membership with compound index optimization
func (*OptimizedGormAccountMemberRepository) GetByID ¶
func (r *OptimizedGormAccountMemberRepository) GetByID(ctx context.Context, id string) (*domain.AccountMember, error)
GetByID retrieves an account member by ID with optimized query
func (*OptimizedGormAccountMemberRepository) ListByAccount ¶
func (r *OptimizedGormAccountMemberRepository) ListByAccount(ctx context.Context, accountID string) ([]*domain.AccountMember, error)
ListByAccount retrieves all members with optimized indexing and batching
func (*OptimizedGormAccountMemberRepository) ListByUser ¶
func (r *OptimizedGormAccountMemberRepository) ListByUser(ctx context.Context, userID string) ([]*domain.AccountMember, error)
ListByUser retrieves all memberships for a user with optimized indexing
type OptimizedGormUserRepository ¶
type OptimizedGormUserRepository struct {
// contains filtered or unexported fields
}
OptimizedGormUserRepository implements domain.UserRepository with performance optimizations
func (*OptimizedGormUserRepository) GetByEmail ¶
func (r *OptimizedGormUserRepository) GetByEmail(ctx context.Context, email string) (*domain.User, error)
GetByEmail retrieves a user by email with optimized indexing
func (*OptimizedGormUserRepository) GetByID ¶
GetByID retrieves a user by ID with caching and optimized queries
func (*OptimizedGormUserRepository) GetByWebID ¶
func (r *OptimizedGormUserRepository) GetByWebID(ctx context.Context, webid string) (*domain.User, error)
GetByWebID retrieves a user by WebID with optimized indexing
func (*OptimizedGormUserRepository) List ¶
func (r *OptimizedGormUserRepository) List(ctx context.Context, filter domain.UserFilter) ([]*domain.User, error)
List retrieves users with filtering and optimized pagination
type RoleModel ¶
type RoleModel struct {
ID string `gorm:"primaryKey;type:varchar(255)"`
Name string `gorm:"not null;type:varchar(255)"`
Description string `gorm:"type:text"`
Permissions string `gorm:"type:text"` // JSON serialized permissions
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
RoleModel represents the GORM model for roles table
type UserFileStorage ¶
type UserFileStorage interface {
// Profile operations
StoreUserProfile(ctx context.Context, userID string, profile domain.UserProfile) error
LoadUserProfile(ctx context.Context, userID string) (domain.UserProfile, error)
UserProfileExists(ctx context.Context, userID string) (bool, error)
// WebID document operations
StoreWebIDDocument(ctx context.Context, userID, webID, document string) error
LoadWebIDDocument(ctx context.Context, userID string) (string, error)
WebIDDocumentExists(ctx context.Context, userID string) (bool, error)
// User data management
DeleteUserData(ctx context.Context, userID string) error
GetUserDirectory(userID string) string
}
UserFileStorage defines the interface for user file storage operations
func NewUserFileStorage ¶
func NewUserFileStorage(baseDir string) UserFileStorage
NewUserFileStorage creates a new user file storage with the given base directory
func NewUserFileStorageWithValidation ¶
func NewUserFileStorageWithValidation(baseDir string) (UserFileStorage, error)
NewUserFileStorageWithValidation creates a new user file storage with validation
type UserModel ¶
type UserModel struct {
ID string `gorm:"primaryKey;type:varchar(255)"`
WebID string `gorm:"uniqueIndex:idx_user_webid;not null;type:varchar(500)"`
Email string `gorm:"uniqueIndex:idx_user_email;not null;type:varchar(255)"`
Name string `gorm:"index:idx_user_name;type:varchar(255)"`
Status string `gorm:"index:idx_user_status;not null;type:varchar(50)"`
CreatedAt time.Time `gorm:"index:idx_user_created;not null"`
UpdatedAt time.Time `gorm:"not null"`
}
UserModel represents the GORM model for users table
func (*UserModel) UpdateProfile ¶
UpdateProfile updates the user profile information with logging
type WebIDGenerator ¶
type WebIDGenerator interface {
GenerateWebID(ctx context.Context, userID, email, userName string) (string, error)
GenerateWebIDDocument(ctx context.Context, webID, email, userName string) (string, error)
ValidateWebID(ctx context.Context, webID string) error
IsUniqueWebID(ctx context.Context, webID string) (bool, error)
GenerateAlternativeWebID(ctx context.Context, baseWebID string) (string, error)
SetUniquenessChecker(checker WebIDUniquenessChecker)
}
WebIDGenerator defines the interface for WebID generation and validation
func NewWebIDGenerator ¶
func NewWebIDGenerator(baseURL string) WebIDGenerator
NewWebIDGenerator creates a new WebID generator with the given base URL
func NewWebIDGeneratorWithValidation ¶
func NewWebIDGeneratorWithValidation(baseURL string) (WebIDGenerator, error)
NewWebIDGeneratorWithValidation creates a new WebID generator with validation
Source Files
¶
- account_member_repository.go
- account_member_write_repository.go
- account_repository.go
- account_write_repository.go
- cache.go
- file_storage.go
- file_storage_adapter.go
- invitation_repository.go
- invitation_write_repository.go
- migration.go
- models.go
- optimized_user_repository.go
- role_repository.go
- test_helpers.go
- user_repository.go
- user_write_repository.go
- webid_generator.go
- wire.go