125 lines
4.0 KiB
Go
125 lines
4.0 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package profile
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the profile type in the database.
|
|
Label = "profile"
|
|
// 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"
|
|
// FieldName holds the string denoting the name field in the database.
|
|
FieldName = "name"
|
|
// FieldAddress holds the string denoting the address field in the database.
|
|
FieldAddress = "address"
|
|
// FieldPhone holds the string denoting the phone field in the database.
|
|
FieldPhone = "phone"
|
|
// EdgePosts holds the string denoting the posts edge name in mutations.
|
|
EdgePosts = "posts"
|
|
// Table holds the table name of the profile in the database.
|
|
Table = "profiles"
|
|
// PostsTable is the table that holds the posts relation/edge.
|
|
PostsTable = "posts"
|
|
// PostsInverseTable is the table name for the Post entity.
|
|
// It exists in this package in order to avoid circular dependency with the "post" package.
|
|
PostsInverseTable = "posts"
|
|
// PostsColumn is the table column denoting the posts relation/edge.
|
|
PostsColumn = "profile_posts"
|
|
)
|
|
|
|
// Columns holds all SQL columns for profile fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
FieldName,
|
|
FieldAddress,
|
|
FieldPhone,
|
|
}
|
|
|
|
// 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
|
|
// DefaultID holds the default value on creation for the "id" field.
|
|
DefaultID func() uuid.UUID
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Profile 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()
|
|
}
|
|
|
|
// ByName orders the results by the name field.
|
|
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByAddress orders the results by the address field.
|
|
func ByAddress(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldAddress, opts...).ToFunc()
|
|
}
|
|
|
|
// ByPhone orders the results by the phone field.
|
|
func ByPhone(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldPhone, opts...).ToFunc()
|
|
}
|
|
|
|
// ByPostsCount orders the results by posts count.
|
|
func ByPostsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newPostsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByPosts orders the results by posts terms.
|
|
func ByPosts(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newPostsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
func newPostsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(PostsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, PostsTable, PostsColumn),
|
|
)
|
|
}
|