infrastructure

package
v0.0.0-...-7e80ac8 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
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")
)

Provider Sets

Complete provider set for user management

Functions

func MigrateUserModels

func MigrateUserModels(db *gorm.DB) error

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 ProvideRoleRepository(db *gorm.DB, cache Cache) (domain.RoleRepository, error)

func ProvideUserDatabase

func ProvideUserDatabase(db *gorm.DB) (*gorm.DB, error)

ProvideUserDatabase provides a GORM database instance with user models migrated

func ProvideUserRepository

func ProvideUserRepository(db *gorm.DB, cache Cache) (domain.UserRepository, error)

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

func SeedSystemRoles(db *gorm.DB) error

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) GetByID

func (r *CachedRoleRepository) GetByID(ctx context.Context, id string) (*domain.Role, error)

GetByID retrieves a role by ID with caching

func (*CachedRoleRepository) GetSystemRoles

func (r *CachedRoleRepository) GetSystemRoles(ctx context.Context) ([]*domain.Role, error)

GetSystemRoles retrieves system roles with caching

func (*CachedRoleRepository) List

func (r *CachedRoleRepository) List(ctx context.Context) ([]*domain.Role, error)

List retrieves all roles (cache system roles)

type CachedUserRepository

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

CachedUserRepository wraps a user repository with caching

func (*CachedUserRepository) Exists

func (r *CachedUserRepository) Exists(ctx context.Context, id string) (bool, error)

Exists checks if a user exists by ID

func (*CachedUserRepository) GetByEmail

func (r *CachedUserRepository) GetByEmail(ctx context.Context, email string) (*domain.User, error)

GetByEmail retrieves a user by email (no caching for now, could be added)

func (*CachedUserRepository) GetByID

func (r *CachedUserRepository) GetByID(ctx context.Context, id string) (*domain.User, error)

GetByID retrieves a user by ID with caching

func (*CachedUserRepository) GetByWebID

func (r *CachedUserRepository) GetByWebID(ctx context.Context, webid string) (*domain.User, error)

GetByWebID retrieves a user by WebID (no caching for now, could be added)

func (*CachedUserRepository) List

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

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

Create creates a new account member in the database

func (*GormAccountMemberWriteRepository) Delete

Delete deletes an account member from the database

func (*GormAccountMemberWriteRepository) Update

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) GetByID

GetByID retrieves an account by ID

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

func (*GormAccountWriteRepository) Create

func (r *GormAccountWriteRepository) Create(ctx context.Context, account *domain.Account) error

Create creates a new account in the database

func (*GormAccountWriteRepository) Delete

Delete deletes an account from the database (with cascade delete for related data)

func (*GormAccountWriteRepository) Update

func (r *GormAccountWriteRepository) Update(ctx context.Context, account *domain.Account) error

Update updates an existing account in the database

type GormInvitationRepository

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

GormInvitationRepository implements domain.InvitationRepository using GORM

func (*GormInvitationRepository) GetByID

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

Create creates a new invitation in the database

func (*GormInvitationWriteRepository) Delete

Delete deletes an invitation from the database

func (*GormInvitationWriteRepository) Update

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) GetByID

func (r *GormRoleRepository) GetByID(ctx context.Context, id string) (*domain.Role, error)

GetByID retrieves a role by ID

func (*GormRoleRepository) GetSystemRoles

func (r *GormRoleRepository) GetSystemRoles(ctx context.Context) ([]*domain.Role, error)

GetSystemRoles retrieves all system roles (predefined roles)

func (*GormRoleRepository) List

func (r *GormRoleRepository) List(ctx context.Context) ([]*domain.Role, error)

List retrieves all roles

type GormUserRepository

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

GormUserRepository implements domain.UserRepository using GORM

func (*GormUserRepository) Exists

func (r *GormUserRepository) Exists(ctx context.Context, id string) (bool, error)

Exists checks if a user exists by ID

func (*GormUserRepository) GetByEmail

func (r *GormUserRepository) GetByEmail(ctx context.Context, email string) (*domain.User, error)

GetByEmail retrieves a user by email

func (*GormUserRepository) GetByID

func (r *GormUserRepository) GetByID(ctx context.Context, id string) (*domain.User, error)

GetByID retrieves a user by ID

func (*GormUserRepository) GetByWebID

func (r *GormUserRepository) GetByWebID(ctx context.Context, webid string) (*domain.User, error)

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

func (*GormUserWriteRepository) Create

func (r *GormUserWriteRepository) Create(ctx context.Context, user *domain.User) error

Create creates a new user in the database

func (*GormUserWriteRepository) Delete

func (r *GormUserWriteRepository) Delete(ctx context.Context, id string) error

Delete deletes a user from the database

func (*GormUserWriteRepository) Update

func (r *GormUserWriteRepository) Update(ctx context.Context, user *domain.User) error

Update updates an existing user in the database

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) Clear

func (c *InMemoryCache) Clear()

Clear removes all entries from cache

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

func (*InMemoryCache) SetRole

func (c *InMemoryCache) SetRole(id string, role *domain.Role)

SetRole stores a role in cache

func (*InMemoryCache) SetUser

func (c *InMemoryCache) SetUser(id string, user *domain.User)

SetUser stores a user in 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

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

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) Exists

Exists checks if a user exists by ID with caching

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

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

func (RoleModel) TableName

func (RoleModel) TableName() string

TableName specifies the table name for RoleModel

func (*RoleModel) UpdateRole

func (r *RoleModel) UpdateRole(ctx context.Context, name, description, permissions string) error

UpdateRole updates the role information with logging

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) TableName

func (UserModel) TableName() string

TableName specifies the table name for UserModel

func (*UserModel) UpdateProfile

func (u *UserModel) UpdateProfile(ctx context.Context, name string) error

UpdateProfile updates the user profile information with logging

func (*UserModel) UpdateStatus

func (u *UserModel) UpdateStatus(ctx context.Context, status string) error

UpdateStatus updates the user status 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

type WebIDUniquenessChecker

type WebIDUniquenessChecker interface {
	WebIDExists(ctx context.Context, webID string) (bool, error)
}

WebIDUniquenessChecker defines the interface for checking WebID uniqueness

Jump to

Keyboard shortcuts

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