2023-03-07 06:18:58 +00:00
|
|
|
// Code generated by ent, DO NOT EDIT.
|
|
|
|
|
|
|
|
package notifier
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2023-07-23 03:57:51 +00:00
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
2023-03-07 06:18:58 +00:00
|
|
|
"github.com/google/uuid"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// Label holds the string label denoting the notifier type in the database.
|
|
|
|
Label = "notifier"
|
|
|
|
// 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"
|
|
|
|
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
|
|
|
FieldUpdatedAt = "updated_at"
|
|
|
|
// FieldGroupID holds the string denoting the group_id field in the database.
|
|
|
|
FieldGroupID = "group_id"
|
|
|
|
// FieldUserID holds the string denoting the user_id field in the database.
|
|
|
|
FieldUserID = "user_id"
|
|
|
|
// FieldName holds the string denoting the name field in the database.
|
|
|
|
FieldName = "name"
|
|
|
|
// FieldURL holds the string denoting the url field in the database.
|
|
|
|
FieldURL = "url"
|
|
|
|
// FieldIsActive holds the string denoting the is_active field in the database.
|
|
|
|
FieldIsActive = "is_active"
|
|
|
|
// EdgeGroup holds the string denoting the group edge name in mutations.
|
|
|
|
EdgeGroup = "group"
|
|
|
|
// EdgeUser holds the string denoting the user edge name in mutations.
|
|
|
|
EdgeUser = "user"
|
|
|
|
// Table holds the table name of the notifier in the database.
|
|
|
|
Table = "notifiers"
|
|
|
|
// GroupTable is the table that holds the group relation/edge.
|
|
|
|
GroupTable = "notifiers"
|
|
|
|
// GroupInverseTable is the table name for the Group entity.
|
|
|
|
// It exists in this package in order to avoid circular dependency with the "group" package.
|
|
|
|
GroupInverseTable = "groups"
|
|
|
|
// GroupColumn is the table column denoting the group relation/edge.
|
|
|
|
GroupColumn = "group_id"
|
|
|
|
// UserTable is the table that holds the user relation/edge.
|
|
|
|
UserTable = "notifiers"
|
|
|
|
// 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 = "user_id"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Columns holds all SQL columns for notifier fields.
|
|
|
|
var Columns = []string{
|
|
|
|
FieldID,
|
|
|
|
FieldCreatedAt,
|
|
|
|
FieldUpdatedAt,
|
|
|
|
FieldGroupID,
|
|
|
|
FieldUserID,
|
|
|
|
FieldName,
|
|
|
|
FieldURL,
|
|
|
|
FieldIsActive,
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
|
|
|
DefaultUpdatedAt func() time.Time
|
|
|
|
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
|
|
|
UpdateDefaultUpdatedAt func() time.Time
|
|
|
|
// NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
|
|
NameValidator func(string) error
|
|
|
|
// URLValidator is a validator for the "url" field. It is called by the builders before save.
|
|
|
|
URLValidator func(string) error
|
|
|
|
// DefaultIsActive holds the default value on creation for the "is_active" field.
|
|
|
|
DefaultIsActive bool
|
|
|
|
// DefaultID holds the default value on creation for the "id" field.
|
|
|
|
DefaultID func() uuid.UUID
|
|
|
|
)
|
2023-07-23 03:57:51 +00:00
|
|
|
|
|
|
|
// OrderOption defines the ordering options for the Notifier 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()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByUpdatedAt orders the results by the updated_at field.
|
|
|
|
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByGroupID orders the results by the group_id field.
|
|
|
|
func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldGroupID, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByUserID orders the results by the user_id field.
|
|
|
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByName orders the results by the name field.
|
|
|
|
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldName, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByURL orders the results by the url field.
|
|
|
|
func ByURL(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldURL, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByIsActive orders the results by the is_active field.
|
|
|
|
func ByIsActive(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldIsActive, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByGroupField orders the results by group field.
|
|
|
|
func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return func(s *sql.Selector) {
|
|
|
|
sqlgraph.OrderByNeighborTerms(s, newGroupStep(), sql.OrderByField(field, opts...))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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...))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func newGroupStep() *sqlgraph.Step {
|
|
|
|
return sqlgraph.NewStep(
|
|
|
|
sqlgraph.From(Table, FieldID),
|
|
|
|
sqlgraph.To(GroupInverseTable, FieldID),
|
|
|
|
sqlgraph.Edge(sqlgraph.M2O, true, GroupTable, GroupColumn),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
func newUserStep() *sqlgraph.Step {
|
|
|
|
return sqlgraph.NewStep(
|
|
|
|
sqlgraph.From(Table, FieldID),
|
|
|
|
sqlgraph.To(UserInverseTable, FieldID),
|
|
|
|
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
|
|
|
|
)
|
|
|
|
}
|