repository

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(cfg config.DatabaseConfig) (*gorm.DB, error)

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 NewSkillRepo(db *gorm.DB) *SkillRepo

func (*SkillRepo) Create

func (r *SkillRepo) Create(ctx context.Context, skill *model.Skill) error

func (*SkillRepo) GetByID

func (r *SkillRepo) GetByID(ctx context.Context, id uuid.UUID) (*model.Skill, error)

func (*SkillRepo) GetBySlug

func (r *SkillRepo) GetBySlug(ctx context.Context, slug string) (*model.SkillWithOwner, error)

func (*SkillRepo) GetBySlugOrAlias

func (r *SkillRepo) GetBySlugOrAlias(ctx context.Context, slug string) (*model.SkillWithOwner, error)

func (*SkillRepo) IncrementDownloads

func (r *SkillRepo) IncrementDownloads(ctx context.Context, skillID uuid.UUID) error

func (*SkillRepo) IsSlugReserved

func (r *SkillRepo) IsSlugReserved(ctx context.Context, slug string) (bool, error)

func (*SkillRepo) List

func (r *SkillRepo) List(ctx context.Context, limit int, cursor string, sort string) ([]model.SkillWithOwner, string, error)

func (*SkillRepo) Rename

func (r *SkillRepo) Rename(ctx context.Context, skillID uuid.UUID, oldSlug, newSlug string) error

func (*SkillRepo) SoftDelete

func (r *SkillRepo) SoftDelete(ctx context.Context, skillID uuid.UUID) error

func (*SkillRepo) Undelete

func (r *SkillRepo) Undelete(ctx context.Context, skillID uuid.UUID) error

func (*SkillRepo) Update

func (r *SkillRepo) Update(ctx context.Context, skill *model.Skill) error

func (*SkillRepo) UpdateLatestVersion

func (r *SkillRepo) UpdateLatestVersion(ctx context.Context, skillID uuid.UUID, versionID uuid.UUID) error

func (*SkillRepo) UpdateStarsCount

func (r *SkillRepo) UpdateStarsCount(ctx context.Context, skillID uuid.UUID, delta int) error

type StarRepo

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

func NewStarRepo

func NewStarRepo(db *gorm.DB) *StarRepo

func (*StarRepo) IsStarred

func (r *StarRepo) IsStarred(ctx context.Context, userID, skillID uuid.UUID) (bool, error)

func (*StarRepo) ListByUser

func (r *StarRepo) ListByUser(ctx context.Context, userID uuid.UUID) ([]model.Skill, error)

func (*StarRepo) Star

func (r *StarRepo) Star(ctx context.Context, userID, skillID uuid.UUID) error

func (*StarRepo) Unstar

func (r *StarRepo) Unstar(ctx context.Context, userID, skillID uuid.UUID) error

type TokenRepo

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

func NewTokenRepo

func NewTokenRepo(db *gorm.DB) *TokenRepo

func (*TokenRepo) Create

func (r *TokenRepo) Create(ctx context.Context, token *model.APIToken) error

func (*TokenRepo) GetByID

func (r *TokenRepo) GetByID(ctx context.Context, id uuid.UUID) (*model.APIToken, error)

func (*TokenRepo) GetByPrefix

func (r *TokenRepo) GetByPrefix(ctx context.Context, prefix string) ([]model.APIToken, error)

func (*TokenRepo) GetByUserID

func (r *TokenRepo) GetByUserID(ctx context.Context, userID uuid.UUID) ([]model.APIToken, error)

func (*TokenRepo) Revoke

func (r *TokenRepo) Revoke(ctx context.Context, id uuid.UUID) error

func (*TokenRepo) UpdateLastUsed

func (r *TokenRepo) UpdateLastUsed(ctx context.Context, id uuid.UUID) error

type UserRepo

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

func NewUserRepo

func NewUserRepo(db *gorm.DB) *UserRepo

func (*UserRepo) Ban

func (r *UserRepo) Ban(ctx context.Context, id uuid.UUID, reason string) error

func (*UserRepo) Create

func (r *UserRepo) Create(ctx context.Context, user *model.User) error

func (*UserRepo) GetByHandle

func (r *UserRepo) GetByHandle(ctx context.Context, handle string) (*model.User, error)

func (*UserRepo) GetByID

func (r *UserRepo) GetByID(ctx context.Context, id uuid.UUID) (*model.User, error)

func (*UserRepo) List

func (r *UserRepo) List(ctx context.Context, limit int, cursor string) ([]model.User, string, error)

func (*UserRepo) SetPassword

func (r *UserRepo) SetPassword(ctx context.Context, id uuid.UUID, passwordHash string) error

func (*UserRepo) Unban

func (r *UserRepo) Unban(ctx context.Context, id uuid.UUID) error

func (*UserRepo) UpdateRole

func (r *UserRepo) UpdateRole(ctx context.Context, id uuid.UUID, role string) error

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)

Jump to

Keyboard shortcuts

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