pcmt/ent/trackedbreaches/trackedbreaches.go

160 lines
5.4 KiB
Go
Raw Normal View History

// Code generated by ent, DO NOT EDIT.
package trackedbreaches
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
)
const (
// Label holds the string label denoting the trackedbreaches type in the database.
Label = "tracked_breaches"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldBreach holds the string denoting the breach field in the database.
FieldBreach = "breach"
// FieldOnline holds the string denoting the online field in the database.
FieldOnline = "online"
// FieldOwner holds the string denoting the owner field in the database.
FieldOwner = "owner"
// EdgeUser holds the string denoting the user edge name in mutations.
EdgeUser = "user"
// EdgeLocalbreach holds the string denoting the localbreach edge name in mutations.
EdgeLocalbreach = "localbreach"
// EdgeHibp holds the string denoting the hibp edge name in mutations.
EdgeHibp = "hibp"
// Table holds the table name of the trackedbreaches in the database.
Table = "tracked_breaches"
// UserTable is the table that holds the user relation/edge.
UserTable = "tracked_breaches"
// UserInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
UserInverseTable = "users"
// UserColumn is the table column denoting the user relation/edge.
UserColumn = "owner"
// LocalbreachTable is the table that holds the localbreach relation/edge. The primary key declared below.
LocalbreachTable = "tracked_breaches_localbreach"
// LocalbreachInverseTable is the table name for the LocalBreach entity.
// It exists in this package in order to avoid circular dependency with the "localbreach" package.
LocalbreachInverseTable = "local_breaches"
// HibpTable is the table that holds the hibp relation/edge.
HibpTable = "hib_ps"
// HibpInverseTable is the table name for the HIBP entity.
// It exists in this package in order to avoid circular dependency with the "hibp" package.
HibpInverseTable = "hib_ps"
// HibpColumn is the table column denoting the hibp relation/edge.
HibpColumn = "tracked_breaches_hibp"
)
// Columns holds all SQL columns for trackedbreaches fields.
var Columns = []string{
FieldID,
FieldBreach,
FieldOnline,
FieldOwner,
}
var (
// LocalbreachPrimaryKey and LocalbreachColumn2 are the table columns denoting the
// primary key for the localbreach relation (M2M).
LocalbreachPrimaryKey = []string{"tracked_breaches_id", "local_breach_id"}
)
// 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 (
// DefaultOnline holds the default value on creation for the "online" field.
DefaultOnline bool
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() uuid.UUID
)
// OrderOption defines the ordering options for the TrackedBreaches 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()
}
// ByBreach orders the results by the breach field.
func ByBreach(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBreach, opts...).ToFunc()
}
// ByOnline orders the results by the online field.
func ByOnline(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOnline, opts...).ToFunc()
}
// ByOwner orders the results by the owner field.
func ByOwner(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOwner, opts...).ToFunc()
}
// ByUserField orders the results by user field.
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
}
}
// ByLocalbreachCount orders the results by localbreach count.
func ByLocalbreachCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newLocalbreachStep(), opts...)
}
}
// ByLocalbreach orders the results by localbreach terms.
func ByLocalbreach(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newLocalbreachStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByHibpCount orders the results by hibp count.
func ByHibpCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newHibpStep(), opts...)
}
}
// ByHibp orders the results by hibp terms.
func ByHibp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newHibpStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
)
}
func newLocalbreachStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(LocalbreachInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, LocalbreachTable, LocalbreachPrimaryKey...),
)
}
func newHibpStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(HibpInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, HibpTable, HibpColumn),
)
}