Files
2025-11-16 19:54:42 +01:00

74 lines
2.0 KiB
Go

// Code generated by ent, DO NOT EDIT.
package event
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the event type in the database.
Label = "event"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldData holds the string denoting the data field in the database.
FieldData = "data"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// Table holds the table name of the event in the database.
Table = "events"
)
// Columns holds all SQL columns for event fields.
var Columns = []string{
FieldID,
FieldName,
FieldData,
FieldCreatedAt,
FieldUserID,
}
// 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 (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
)
// OrderOption defines the ordering options for the Event 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()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}