forked from ALHP/ALHP.GO
Add database backend (SQLite) (#26)
Add database with background information for each pkgbase, for possible future use. A static status page is generated from the db. Currently includes: * sub-packages * build-time * build-duration * status (failed, latest, skipped, queued, building, build) * version (both from PKGBUILD and repo) * last checked Database is currently only used for informational purposes. Goal is to refactor many (expensive) methods to use the db instead of searching/parsing files. Reviewed-on: https://git.harting.dev/anonfunc/ALHP.GO/pulls/26 Co-authored-by: Giovanni Harting <539@idlegandalf.com> Co-committed-by: Giovanni Harting <539@idlegandalf.com>
This commit is contained in:
73
ent/dbpackage/dbpackage.go
Normal file
73
ent/dbpackage/dbpackage.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
|
||||
package dbpackage
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the dbpackage type in the database.
|
||||
Label = "db_package"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldPkgbase holds the string denoting the pkgbase field in the database.
|
||||
FieldPkgbase = "pkgbase"
|
||||
// FieldPackages holds the string denoting the packages field in the database.
|
||||
FieldPackages = "packages"
|
||||
// FieldStatus holds the string denoting the status field in the database.
|
||||
FieldStatus = "status"
|
||||
// FieldSkipReason holds the string denoting the skip_reason field in the database.
|
||||
FieldSkipReason = "skip_reason"
|
||||
// FieldRepository holds the string denoting the repository field in the database.
|
||||
FieldRepository = "repository"
|
||||
// FieldMarch holds the string denoting the march field in the database.
|
||||
FieldMarch = "march"
|
||||
// FieldVersion holds the string denoting the version field in the database.
|
||||
FieldVersion = "version"
|
||||
// FieldRepoVersion holds the string denoting the repo_version field in the database.
|
||||
FieldRepoVersion = "repo_version"
|
||||
// FieldBuildTime holds the string denoting the build_time field in the database.
|
||||
FieldBuildTime = "build_time"
|
||||
// FieldBuildDuration holds the string denoting the build_duration field in the database.
|
||||
FieldBuildDuration = "build_duration"
|
||||
// FieldUpdated holds the string denoting the updated field in the database.
|
||||
FieldUpdated = "updated"
|
||||
// Table holds the table name of the dbpackage in the database.
|
||||
Table = "db_packages"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for dbpackage fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldPkgbase,
|
||||
FieldPackages,
|
||||
FieldStatus,
|
||||
FieldSkipReason,
|
||||
FieldRepository,
|
||||
FieldMarch,
|
||||
FieldVersion,
|
||||
FieldRepoVersion,
|
||||
FieldBuildTime,
|
||||
FieldBuildDuration,
|
||||
FieldUpdated,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// PkgbaseValidator is a validator for the "pkgbase" field. It is called by the builders before save.
|
||||
PkgbaseValidator func(string) error
|
||||
// StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
||||
StatusValidator func(int) error
|
||||
// RepositoryValidator is a validator for the "repository" field. It is called by the builders before save.
|
||||
RepositoryValidator func(string) error
|
||||
// MarchValidator is a validator for the "march" field. It is called by the builders before save.
|
||||
MarchValidator func(string) error
|
||||
// BuildDurationValidator is a validator for the "build_duration" field. It is called by the builders before save.
|
||||
BuildDurationValidator func(uint64) error
|
||||
)
|
1277
ent/dbpackage/where.go
Normal file
1277
ent/dbpackage/where.go
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user