store

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSyncStateNotFound = errors.New("sync state key not found")

Functions

This section is empty.

Types

type AIResult

type AIResult struct {
	Summary   string
	Tags      []string
	Platforms []string
	Category  string
}

type Category

type Category struct {
	ID        string
	Name      string
	Keywords  []string
	SortOrder int
	IsCustom  bool
	IsHidden  bool
}

type CustomFields

type CustomFields struct {
	Description    string
	Tags           []string
	Category       string
	CategoryLocked bool
}

type Release

type Release struct {
	ID           int64
	RepoID       int64
	RepoFullName string
	TagName      string
	Name         string
	Body         string
	HTMLURL      string
	PublishedAt  string
	IsPrerelease bool
	IsDraft      bool
	IsRead       bool
	Assets       []ReleaseAsset
}

type ReleaseAsset

type ReleaseAsset struct {
	Name        string `json:"name"`
	URL         string `json:"url"`
	Size        int64  `json:"size"`
	ContentType string `json:"content_type"`
}

type Repository

type Repository struct {
	ID                 int64
	FullName           string
	Name               string
	Description        string
	URL                string
	Language           string
	Homepage           string
	StargazersCount    int
	ForksCount         int
	Topics             []string
	OwnerLogin         string
	OwnerAvatar        string
	StarredAt          string
	AISummary          string
	AITags             []string
	AIPlatforms        []string
	AICategory         string
	AnalyzedAt         *time.Time
	AnalysisFailed     bool
	CustomDescription  string
	CustomTags         []string
	CustomCategory     string
	CategoryLocked     bool
	SubscribedReleases bool
	LastReleaseFetch   *time.Time
}

type Store

type Store interface {
	Close() error

	UpsertRepository(ctx context.Context, r *Repository) error
	UpsertRepositories(ctx context.Context, rs []*Repository) error
	UpsertReposOnSync(ctx context.Context, rs []*Repository, fullSync bool) error
	GetRepository(ctx context.Context, fullName string) (*Repository, error)
	ListRepositories(ctx context.Context) ([]*Repository, error)
	ListUnanalyzed(ctx context.Context, limit int) ([]*Repository, error)
	ListByCategory(ctx context.Context, category string) ([]*Repository, error)
	UpdateAIResult(ctx context.Context, repoID int64, res *AIResult) error
	UpdateCustomFields(ctx context.Context, repoID int64, f *CustomFields) error
	SetAnalysisFailed(ctx context.Context, repoID int64, failed bool) error
	DeleteAllRepositories(ctx context.Context) error

	UpsertRelease(ctx context.Context, r *Release) error
	ListUnreadReleases(ctx context.Context) ([]*Release, error)
	ListAllReleases(ctx context.Context) ([]*Release, error)
	ListReleasesByRepo(ctx context.Context, repoFullName string) ([]*Release, error)
	MarkReleaseRead(ctx context.Context, releaseID int64) error
	MarkAllReleasesRead(ctx context.Context) error
	SetReleaseSubscription(ctx context.Context, repoFullName string, subscribed bool) error
	UpdateReleaseWatermark(ctx context.Context, repoID int64, t time.Time) error

	ListCategories(ctx context.Context, visibleOnly bool) ([]*Category, error)
	UpsertCategory(ctx context.Context, c *Category) error
	DeleteCategory(ctx context.Context, id string) error

	GetSyncState(ctx context.Context, key string) (string, error)
	SetSyncState(ctx context.Context, key, value string) error
}

func Open

func Open(dbPath string) (Store, error)

Jump to

Keyboard shortcuts

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