gomanager/ent/logentry/logentry.go

98 lines
2.8 KiB
Go
Raw Permalink Normal View History

2023-12-01 23:02:33 +01:00
// Code generated by ent, DO NOT EDIT.
package logentry
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the logentry type in the database.
Label = "logentry"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldDate holds the string denoting the date field in the database.
FieldDate = "date"
// FieldContent holds the string denoting the content field in the database.
FieldContent = "content"
// EdgeProject holds the string denoting the project edge name in mutations.
EdgeProject = "project"
// Table holds the table name of the logentry in the database.
Table = "logentries"
// ProjectTable is the table that holds the project relation/edge.
ProjectTable = "logentries"
// ProjectInverseTable is the table name for the Project entity.
// It exists in this package in order to avoid circular dependency with the "project" package.
ProjectInverseTable = "projects"
// ProjectColumn is the table column denoting the project relation/edge.
ProjectColumn = "project_logentries"
)
// Columns holds all SQL columns for logentry fields.
var Columns = []string{
FieldID,
FieldDate,
FieldContent,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "logentries"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"project_logentries",
}
// 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
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}
var (
// DefaultDate holds the default value on creation for the "date" field.
DefaultDate func() time.Time
)
// OrderOption defines the ordering options for the Logentry 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()
}
// ByDate orders the results by the date field.
func ByDate(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDate, opts...).ToFunc()
}
// ByContent orders the results by the content field.
func ByContent(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldContent, opts...).ToFunc()
}
// ByProjectField orders the results by project field.
func ByProjectField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newProjectStep(), sql.OrderByField(field, opts...))
}
}
func newProjectStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ProjectInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, ProjectTable, ProjectColumn),
)
}