// Code generated by ent, DO NOT EDIT.

package dbpackage

import (
	"fmt"

	"entgo.io/ent/dialect/sql"
)

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"
	// FieldBuildTimeStart holds the string denoting the build_time_start field in the database.
	FieldBuildTimeStart = "build_time_start"
	// FieldUpdated holds the string denoting the updated field in the database.
	FieldUpdated = "updated"
	// FieldLto holds the string denoting the lto field in the database.
	FieldLto = "lto"
	// FieldLastVersionBuild holds the string denoting the last_version_build field in the database.
	FieldLastVersionBuild = "last_version_build"
	// FieldLastVerified holds the string denoting the last_verified field in the database.
	FieldLastVerified = "last_verified"
	// FieldDebugSymbols holds the string denoting the debug_symbols field in the database.
	FieldDebugSymbols = "debug_symbols"
	// FieldMaxRss holds the string denoting the max_rss field in the database.
	FieldMaxRss = "max_rss"
	// FieldUTime holds the string denoting the u_time field in the database.
	FieldUTime = "u_time"
	// FieldSTime holds the string denoting the s_time field in the database.
	FieldSTime = "s_time"
	// FieldIoIn holds the string denoting the io_in field in the database.
	FieldIoIn = "io_in"
	// FieldIoOut holds the string denoting the io_out field in the database.
	FieldIoOut = "io_out"
	// FieldTagRev holds the string denoting the tag_rev field in the database.
	FieldTagRev = "tag_rev"
	// 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,
	FieldBuildTimeStart,
	FieldUpdated,
	FieldLto,
	FieldLastVersionBuild,
	FieldLastVerified,
	FieldDebugSymbols,
	FieldMaxRss,
	FieldUTime,
	FieldSTime,
	FieldIoIn,
	FieldIoOut,
	FieldTagRev,
}

// 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
	// MarchValidator is a validator for the "march" field. It is called by the builders before save.
	MarchValidator func(string) error
)

// Status defines the type for the "status" enum field.
type Status string

// StatusUnknown is the default value of the Status enum.
const DefaultStatus = StatusUnknown

// Status values.
const (
	StatusSkipped  Status = "skipped"
	StatusFailed   Status = "failed"
	StatusBuilt    Status = "built"
	StatusQueued   Status = "queued"
	StatusDelayed  Status = "delayed"
	StatusBuilding Status = "building"
	StatusLatest   Status = "latest"
	StatusSigning  Status = "signing"
	StatusUnknown  Status = "unknown"
)

func (s Status) String() string {
	return string(s)
}

// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
func StatusValidator(s Status) error {
	switch s {
	case StatusSkipped, StatusFailed, StatusBuilt, StatusQueued, StatusDelayed, StatusBuilding, StatusLatest, StatusSigning, StatusUnknown:
		return nil
	default:
		return fmt.Errorf("dbpackage: invalid enum value for status field: %q", s)
	}
}

// Repository defines the type for the "repository" enum field.
type Repository string

// Repository values.
const (
	RepositoryExtra    Repository = "extra"
	RepositoryCore     Repository = "core"
	RepositoryMultilib Repository = "multilib"
)

func (r Repository) String() string {
	return string(r)
}

// RepositoryValidator is a validator for the "repository" field enum values. It is called by the builders before save.
func RepositoryValidator(r Repository) error {
	switch r {
	case RepositoryExtra, RepositoryCore, RepositoryMultilib:
		return nil
	default:
		return fmt.Errorf("dbpackage: invalid enum value for repository field: %q", r)
	}
}

// Lto defines the type for the "lto" enum field.
type Lto string

// LtoUnknown is the default value of the Lto enum.
const DefaultLto = LtoUnknown

// Lto values.
const (
	LtoEnabled      Lto = "enabled"
	LtoUnknown      Lto = "unknown"
	LtoDisabled     Lto = "disabled"
	LtoAutoDisabled Lto = "auto_disabled"
)

func (l Lto) String() string {
	return string(l)
}

// LtoValidator is a validator for the "lto" field enum values. It is called by the builders before save.
func LtoValidator(l Lto) error {
	switch l {
	case LtoEnabled, LtoUnknown, LtoDisabled, LtoAutoDisabled:
		return nil
	default:
		return fmt.Errorf("dbpackage: invalid enum value for lto field: %q", l)
	}
}

// DebugSymbols defines the type for the "debug_symbols" enum field.
type DebugSymbols string

// DebugSymbolsUnknown is the default value of the DebugSymbols enum.
const DefaultDebugSymbols = DebugSymbolsUnknown

// DebugSymbols values.
const (
	DebugSymbolsAvailable    DebugSymbols = "available"
	DebugSymbolsUnknown      DebugSymbols = "unknown"
	DebugSymbolsNotAvailable DebugSymbols = "not_available"
)

func (ds DebugSymbols) String() string {
	return string(ds)
}

// DebugSymbolsValidator is a validator for the "debug_symbols" field enum values. It is called by the builders before save.
func DebugSymbolsValidator(ds DebugSymbols) error {
	switch ds {
	case DebugSymbolsAvailable, DebugSymbolsUnknown, DebugSymbolsNotAvailable:
		return nil
	default:
		return fmt.Errorf("dbpackage: invalid enum value for debug_symbols field: %q", ds)
	}
}

// OrderOption defines the ordering options for the DBPackage queries.
type OrderOption func(*sql.Selector)

// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldID, opts...).ToFunc()
}

// ByPkgbase orders the results by the pkgbase field.
func ByPkgbase(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPkgbase, opts...).ToFunc()
}

// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStatus, opts...).ToFunc()
}

// BySkipReason orders the results by the skip_reason field.
func BySkipReason(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSkipReason, opts...).ToFunc()
}

// ByRepository orders the results by the repository field.
func ByRepository(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRepository, opts...).ToFunc()
}

// ByMarch orders the results by the march field.
func ByMarch(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMarch, opts...).ToFunc()
}

// ByVersion orders the results by the version field.
func ByVersion(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldVersion, opts...).ToFunc()
}

// ByRepoVersion orders the results by the repo_version field.
func ByRepoVersion(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRepoVersion, opts...).ToFunc()
}

// ByBuildTimeStart orders the results by the build_time_start field.
func ByBuildTimeStart(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBuildTimeStart, opts...).ToFunc()
}

// ByUpdated orders the results by the updated field.
func ByUpdated(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUpdated, opts...).ToFunc()
}

// ByLto orders the results by the lto field.
func ByLto(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLto, opts...).ToFunc()
}

// ByLastVersionBuild orders the results by the last_version_build field.
func ByLastVersionBuild(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLastVersionBuild, opts...).ToFunc()
}

// ByLastVerified orders the results by the last_verified field.
func ByLastVerified(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLastVerified, opts...).ToFunc()
}

// ByDebugSymbols orders the results by the debug_symbols field.
func ByDebugSymbols(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDebugSymbols, opts...).ToFunc()
}

// ByMaxRss orders the results by the max_rss field.
func ByMaxRss(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMaxRss, opts...).ToFunc()
}

// ByUTime orders the results by the u_time field.
func ByUTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUTime, opts...).ToFunc()
}

// BySTime orders the results by the s_time field.
func BySTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSTime, opts...).ToFunc()
}

// ByIoIn orders the results by the io_in field.
func ByIoIn(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIoIn, opts...).ToFunc()
}

// ByIoOut orders the results by the io_out field.
func ByIoOut(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIoOut, opts...).ToFunc()
}

// ByTagRev orders the results by the tag_rev field.
func ByTagRev(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTagRev, opts...).ToFunc()
}
