Documentation ¶
Index ¶
- Constants
- func Close() error
- func DB(ctx context.Context) *sqlx.DB
- func DeletePkgs(ctx context.Context, where string, args ...any) error
- func GetPkgs(ctx context.Context, where string, args ...any) (*sqlx.Rows, error)
- func GetVersion(ctx context.Context) (int, bool)
- func InsertPackage(ctx context.Context, pkg Package) error
- func IsEmpty(ctx context.Context) bool
- type JSON
- type Package
Constants ¶
View Source
const CurrentVersion = 2
CurrentVersion is the current version of the database. The database is reset if its version doesn't match this.
Variables ¶
This section is empty.
Functions ¶
func DB ¶
DB returns the LURE database. The first time it's called, it opens the SQLite database file. Subsequent calls return the same connection.
func DeletePkgs ¶
DeletePkgs deletes all packages matching the where conditions
func GetVersion ¶
GetVersion returns the database version and a boolean indicating whether the database contained a version number
func InsertPackage ¶
InsertPackage adds a package to the database
Types ¶
type JSON ¶
type JSON[T any] struct { Val T }
JSON represents a JSON value in the database
func (JSON[T]) MarshalYAML ¶
type Package ¶
type Package struct { Name string `sh:"name,required" db:"name"` Version string `sh:"version,required" db:"version"` Release int `sh:"release,required" db:"release"` Epoch uint `sh:"epoch" db:"epoch"` Description JSON[map[string]string] `db:"description"` Homepage JSON[map[string]string] `db:"homepage"` Maintainer JSON[map[string]string] `db:"maintainer"` Architectures JSON[[]string] `sh:"architectures" db:"architectures"` Licenses JSON[[]string] `sh:"license" db:"licenses"` Provides JSON[[]string] `sh:"provides" db:"provides"` Conflicts JSON[[]string] `sh:"conflicts" db:"conflicts"` Replaces JSON[[]string] `sh:"replaces" db:"replaces"` Depends JSON[map[string][]string] `db:"depends"` BuildDepends JSON[map[string][]string] `db:"builddepends"` OptDepends JSON[map[string][]string] `db:"optdepends"` Repository string `db:"repository"` }
Package is a LURE package's database representation
Click to show internal directories.
Click to hide internal directories.