eventparticipant.go•4.79 kB
// Code generated by ent, DO NOT EDIT.
package eventparticipant
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/rs/xid"
)
const (
// Label holds the string label denoting the eventparticipant type in the database.
Label = "event_participant"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldRole holds the string denoting the role field in the database.
FieldRole = "role"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldAccountID holds the string denoting the account_id field in the database.
FieldAccountID = "account_id"
// FieldEventID holds the string denoting the event_id field in the database.
FieldEventID = "event_id"
// EdgeAccount holds the string denoting the account edge name in mutations.
EdgeAccount = "account"
// EdgeEvent holds the string denoting the event edge name in mutations.
EdgeEvent = "event"
// Table holds the table name of the eventparticipant in the database.
Table = "event_participants"
// AccountTable is the table that holds the account relation/edge.
AccountTable = "event_participants"
// AccountInverseTable is the table name for the Account entity.
// It exists in this package in order to avoid circular dependency with the "account" package.
AccountInverseTable = "accounts"
// AccountColumn is the table column denoting the account relation/edge.
AccountColumn = "account_id"
// EventTable is the table that holds the event relation/edge.
EventTable = "event_participants"
// EventInverseTable is the table name for the Event entity.
// It exists in this package in order to avoid circular dependency with the "event" package.
EventInverseTable = "events"
// EventColumn is the table column denoting the event relation/edge.
EventColumn = "event_id"
)
// Columns holds all SQL columns for eventparticipant fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldRole,
FieldStatus,
FieldAccountID,
FieldEventID,
}
// 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
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() xid.ID
// IDValidator is a validator for the "id" field. It is called by the builders before save.
IDValidator func(string) error
)
// OrderOption defines the ordering options for the EventParticipant 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()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByRole orders the results by the role field.
func ByRole(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRole, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByAccountID orders the results by the account_id field.
func ByAccountID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAccountID, opts...).ToFunc()
}
// ByEventID orders the results by the event_id field.
func ByEventID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEventID, opts...).ToFunc()
}
// ByAccountField orders the results by account field.
func ByAccountField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newAccountStep(), sql.OrderByField(field, opts...))
}
}
// ByEventField orders the results by event field.
func ByEventField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newEventStep(), sql.OrderByField(field, opts...))
}
}
func newAccountStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(AccountInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, AccountTable, AccountColumn),
)
}
func newEventStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(EventInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, EventTable, EventColumn),
)
}