db

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentVersion = 1

Variables

This section is empty.

Functions

func DeletePkgs

func DeletePkgs(db *sqlx.DB, where string, args ...any) error

DeletePkgs deletes all packages matching the where conditions

func GetPkgs

func GetPkgs(db *sqlx.DB, where string, args ...any) (*sqlx.Rows, error)

GetPkgs returns a result containing packages that match the where conditions

func GetVersion added in v0.0.7

func GetVersion(db *sqlx.DB) (int, bool)

func Init

func Init(db *sqlx.DB, dsn string) error

Init initializes the database

func InsertPackage

func InsertPackage(db *sqlx.DB, pkg Package) error

InsertPackage adds a package to the database

func JsonArrayContains added in v0.0.6

func JsonArrayContains(ctx *sqlite.FunctionContext, args []driver.Value) (driver.Value, error)

func Open added in v0.0.7

func Open(dsn string) (*sqlx.DB, error)

Types

type JSON added in v0.0.6

type JSON[T any] struct {
	Val T
}

func NewJSON added in v0.0.6

func NewJSON[T any](v T) JSON[T]

func (JSON[T]) GoString added in v0.0.6

func (s JSON[T]) GoString() string

func (JSON[T]) MarshalYAML added in v0.0.6

func (s JSON[T]) MarshalYAML() (any, error)

func (*JSON[T]) Scan added in v0.0.6

func (s *JSON[T]) Scan(val any) error

func (JSON[T]) String added in v0.0.6

func (s JSON[T]) String() string

func (JSON[T]) Value added in v0.0.6

func (s JSON[T]) Value() (driver.Value, error)

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"`
	Repository    string                    `db:"repository"`
}

Package is a LURE package's database representation

func GetPkg added in v0.0.6

func GetPkg(db *sqlx.DB, where string, args ...any) (*Package, error)

GetPkg returns a single package that match the where conditions

Jump to

Keyboard shortcuts

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