Documentation
¶
Index ¶
- func NewDB(cfg config.DatabaseConfig) (*gorm.DB, error)
- type AuditLogEntry
- type DownloadRepo
- type SkillRepo
- func (r *SkillRepo) Create(ctx context.Context, skill *model.Skill) error
- func (r *SkillRepo) GetByID(ctx context.Context, id uuid.UUID) (*model.Skill, error)
- func (r *SkillRepo) GetBySlug(ctx context.Context, slug string) (*model.SkillWithOwner, error)
- func (r *SkillRepo) GetBySlugOrAlias(ctx context.Context, slug string) (*model.SkillWithOwner, error)
- func (r *SkillRepo) IncrementDownloads(ctx context.Context, skillID uuid.UUID) error
- func (r *SkillRepo) IsSlugReserved(ctx context.Context, slug string) (bool, error)
- func (r *SkillRepo) List(ctx context.Context, limit int, cursor string, sort string) ([]model.SkillWithOwner, string, error)
- func (r *SkillRepo) Rename(ctx context.Context, skillID uuid.UUID, oldSlug, newSlug string) error
- func (r *SkillRepo) SoftDelete(ctx context.Context, skillID uuid.UUID) error
- func (r *SkillRepo) Undelete(ctx context.Context, skillID uuid.UUID) error
- func (r *SkillRepo) Update(ctx context.Context, skill *model.Skill) error
- func (r *SkillRepo) UpdateLatestVersion(ctx context.Context, skillID uuid.UUID, versionID uuid.UUID) error
- func (r *SkillRepo) UpdateStarsCount(ctx context.Context, skillID uuid.UUID, delta int) error
- type StarRepo
- func (r *StarRepo) IsStarred(ctx context.Context, userID, skillID uuid.UUID) (bool, error)
- func (r *StarRepo) ListByUser(ctx context.Context, userID uuid.UUID) ([]model.Skill, error)
- func (r *StarRepo) Star(ctx context.Context, userID, skillID uuid.UUID) error
- func (r *StarRepo) Unstar(ctx context.Context, userID, skillID uuid.UUID) error
- type TokenRepo
- func (r *TokenRepo) Create(ctx context.Context, token *model.APIToken) error
- func (r *TokenRepo) GetByID(ctx context.Context, id uuid.UUID) (*model.APIToken, error)
- func (r *TokenRepo) GetByPrefix(ctx context.Context, prefix string) ([]model.APIToken, error)
- func (r *TokenRepo) GetByUserID(ctx context.Context, userID uuid.UUID) ([]model.APIToken, error)
- func (r *TokenRepo) Revoke(ctx context.Context, id uuid.UUID) error
- func (r *TokenRepo) UpdateLastUsed(ctx context.Context, id uuid.UUID) error
- type UserRepo
- func (r *UserRepo) Ban(ctx context.Context, id uuid.UUID, reason string) error
- func (r *UserRepo) Create(ctx context.Context, user *model.User) error
- func (r *UserRepo) GetByHandle(ctx context.Context, handle string) (*model.User, error)
- func (r *UserRepo) GetByID(ctx context.Context, id uuid.UUID) (*model.User, error)
- func (r *UserRepo) List(ctx context.Context, limit int, cursor string) ([]model.User, string, error)
- func (r *UserRepo) SetPassword(ctx context.Context, id uuid.UUID, passwordHash string) error
- func (r *UserRepo) Unban(ctx context.Context, id uuid.UUID) error
- func (r *UserRepo) UpdateRole(ctx context.Context, id uuid.UUID, role string) error
- type VersionRepo
- func (r *VersionRepo) Create(ctx context.Context, v *model.SkillVersion) error
- func (r *VersionRepo) GetByFingerprint(ctx context.Context, fingerprint string) (*model.SkillVersion, error)
- func (r *VersionRepo) GetByID(ctx context.Context, id uuid.UUID) (*model.SkillVersion, error)
- func (r *VersionRepo) GetBySHA256(ctx context.Context, hash string) (*model.SkillVersion, error)
- func (r *VersionRepo) GetBySkillAndVersion(ctx context.Context, skillID uuid.UUID, version string) (*model.SkillVersion, error)
- func (r *VersionRepo) GetLatest(ctx context.Context, skillID uuid.UUID) (*model.SkillVersion, error)
- func (r *VersionRepo) ListBySkill(ctx context.Context, skillID uuid.UUID) ([]model.SkillVersion, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuditLogEntry ¶
type AuditLogEntry struct {
ActorID *uuid.UUID
Action string
ResourceType string
ResourceID *uuid.UUID
Details interface{}
IPAddress *string
}
AuditLogEntry is kept as a convenience alias for creating audit logs.
type DownloadRepo ¶
type DownloadRepo struct {
// contains filtered or unexported fields
}
func NewDownloadRepo ¶
func NewDownloadRepo(db *gorm.DB) *DownloadRepo
func (*DownloadRepo) RecordDownload ¶
func (r *DownloadRepo) RecordDownload(ctx context.Context, skillID, versionID uuid.UUID, identityHash string) (bool, error)
RecordDownload records a download, returning true if it's new (not a duplicate).
func (*DownloadRepo) WriteAuditLog ¶
func (r *DownloadRepo) WriteAuditLog(ctx context.Context, entry AuditLogEntry) error
type SkillRepo ¶
type SkillRepo struct {
// contains filtered or unexported fields
}
func NewSkillRepo ¶
func (*SkillRepo) GetBySlugOrAlias ¶
func (*SkillRepo) IncrementDownloads ¶
func (*SkillRepo) IsSlugReserved ¶
func (*SkillRepo) SoftDelete ¶
func (*SkillRepo) UpdateLatestVersion ¶
type StarRepo ¶
type StarRepo struct {
// contains filtered or unexported fields
}
func NewStarRepo ¶
func (*StarRepo) ListByUser ¶
type TokenRepo ¶
type TokenRepo struct {
// contains filtered or unexported fields
}
func NewTokenRepo ¶
func (*TokenRepo) GetByPrefix ¶
func (*TokenRepo) GetByUserID ¶
type UserRepo ¶
type UserRepo struct {
// contains filtered or unexported fields
}
func NewUserRepo ¶
func (*UserRepo) GetByHandle ¶
func (*UserRepo) SetPassword ¶
type VersionRepo ¶
type VersionRepo struct {
// contains filtered or unexported fields
}
func NewVersionRepo ¶
func NewVersionRepo(db *gorm.DB) *VersionRepo
func (*VersionRepo) Create ¶
func (r *VersionRepo) Create(ctx context.Context, v *model.SkillVersion) error
func (*VersionRepo) GetByFingerprint ¶
func (r *VersionRepo) GetByFingerprint(ctx context.Context, fingerprint string) (*model.SkillVersion, error)
func (*VersionRepo) GetByID ¶
func (r *VersionRepo) GetByID(ctx context.Context, id uuid.UUID) (*model.SkillVersion, error)
func (*VersionRepo) GetBySHA256 ¶
func (r *VersionRepo) GetBySHA256(ctx context.Context, hash string) (*model.SkillVersion, error)
func (*VersionRepo) GetBySkillAndVersion ¶
func (r *VersionRepo) GetBySkillAndVersion(ctx context.Context, skillID uuid.UUID, version string) (*model.SkillVersion, error)
func (*VersionRepo) GetLatest ¶
func (r *VersionRepo) GetLatest(ctx context.Context, skillID uuid.UUID) (*model.SkillVersion, error)
func (*VersionRepo) ListBySkill ¶
func (r *VersionRepo) ListBySkill(ctx context.Context, skillID uuid.UUID) ([]model.SkillVersion, error)
Click to show internal directories.
Click to hide internal directories.