Documentation
¶
Overview ¶
Package profile exposes storage adapters for the user_profiles table.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Record ¶
type Record struct {
bun.BaseModel `bun:"table:user_profiles"`
UserID uuid.UUID `bun:"user_id,pk,type:uuid"`
DisplayName string `bun:"display_name"`
AvatarURL string `bun:"avatar_url"`
Locale string `bun:"locale"`
Timezone string `bun:"timezone"`
Bio string `bun:"bio"`
Contact map[string]any `bun:"contact,type:jsonb"`
Metadata map[string]any `bun:"metadata,type:jsonb"`
TenantID uuid.UUID `bun:"tenant_id,type:uuid"`
OrgID uuid.UUID `bun:"org_id,type:uuid"`
CreatedAt time.Time `bun:"created_at"`
CreatedBy uuid.UUID `bun:"created_by,type:uuid"`
UpdatedAt time.Time `bun:"updated_at"`
UpdatedBy uuid.UUID `bun:"updated_by,type:uuid"`
}
Record models the user_profiles row.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository implements types.ProfileRepository using Bun.
func NewRepository ¶
func NewRepository(cfg RepositoryConfig) (*Repository, error)
NewRepository constructs the default profile repository.
func (*Repository) GetProfile ¶
func (r *Repository) GetProfile(ctx context.Context, userID uuid.UUID, scope types.ScopeFilter) (*types.UserProfile, error)
GetProfile returns the profile for the supplied user within the provided scope.
func (*Repository) UpsertProfile ¶
func (r *Repository) UpsertProfile(ctx context.Context, profile types.UserProfile) (*types.UserProfile, error)
UpsertProfile inserts or updates the user profile based on whether it already exists.
type RepositoryConfig ¶
type RepositoryConfig struct {
DB *bun.DB
Repository repository.Repository[*Record]
Clock types.Clock
}
RepositoryConfig wires the Bun-backed profile repository.
Click to show internal directories.
Click to hide internal directories.