2022-08-31 07:49:08 +00:00
|
|
|
// Code generated by ent, DO NOT EDIT.
|
|
|
|
|
|
|
|
package card
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2024-02-21 07:06:08 +00:00
|
|
|
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
2022-08-31 07:49:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// Label holds the string label denoting the card type in the database.
|
|
|
|
Label = "card"
|
|
|
|
// FieldID holds the string denoting the id field in the database.
|
|
|
|
FieldID = "id"
|
2023-04-05 06:05:14 +00:00
|
|
|
// FieldPassword holds the string denoting the password field in the database.
|
|
|
|
FieldPassword = "password"
|
2022-08-31 07:49:08 +00:00
|
|
|
// FieldCard holds the string denoting the card field in the database.
|
|
|
|
FieldCard = "card"
|
2023-05-03 10:16:36 +00:00
|
|
|
// FieldSkill holds the string denoting the skill field in the database.
|
|
|
|
FieldSkill = "skill"
|
2022-08-31 07:49:08 +00:00
|
|
|
// FieldStatus holds the string denoting the status field in the database.
|
|
|
|
FieldStatus = "status"
|
2023-07-01 14:21:48 +00:00
|
|
|
// FieldToken holds the string denoting the token field in the database.
|
|
|
|
FieldToken = "token"
|
2022-08-31 07:49:08 +00:00
|
|
|
// FieldCp holds the string denoting the cp field in the database.
|
|
|
|
FieldCp = "cp"
|
|
|
|
// FieldURL holds the string denoting the url field in the database.
|
|
|
|
FieldURL = "url"
|
2023-08-21 13:13:44 +00:00
|
|
|
// FieldCount holds the string denoting the count field in the database.
|
|
|
|
FieldCount = "count"
|
|
|
|
// FieldAuthor holds the string denoting the author field in the database.
|
|
|
|
FieldAuthor = "author"
|
2022-08-31 07:49:08 +00:00
|
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
|
|
FieldCreatedAt = "created_at"
|
|
|
|
// EdgeOwner holds the string denoting the owner edge name in mutations.
|
|
|
|
EdgeOwner = "owner"
|
|
|
|
// Table holds the table name of the card in the database.
|
|
|
|
Table = "cards"
|
|
|
|
// OwnerTable is the table that holds the owner relation/edge.
|
|
|
|
OwnerTable = "cards"
|
|
|
|
// OwnerInverseTable is the table name for the User entity.
|
|
|
|
// It exists in this package in order to avoid circular dependency with the "user" package.
|
|
|
|
OwnerInverseTable = "users"
|
|
|
|
// OwnerColumn is the table column denoting the owner relation/edge.
|
|
|
|
OwnerColumn = "user_card"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Columns holds all SQL columns for card fields.
|
|
|
|
var Columns = []string{
|
|
|
|
FieldID,
|
2023-04-05 06:05:14 +00:00
|
|
|
FieldPassword,
|
2022-08-31 07:49:08 +00:00
|
|
|
FieldCard,
|
2023-05-03 10:16:36 +00:00
|
|
|
FieldSkill,
|
2022-08-31 07:49:08 +00:00
|
|
|
FieldStatus,
|
2023-07-01 14:21:48 +00:00
|
|
|
FieldToken,
|
2022-08-31 07:49:08 +00:00
|
|
|
FieldCp,
|
|
|
|
FieldURL,
|
2023-08-21 13:13:44 +00:00
|
|
|
FieldCount,
|
|
|
|
FieldAuthor,
|
2022-08-31 07:49:08 +00:00
|
|
|
FieldCreatedAt,
|
|
|
|
}
|
|
|
|
|
|
|
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "cards"
|
|
|
|
// table and are not defined as standalone fields in the schema.
|
|
|
|
var ForeignKeys = []string{
|
|
|
|
"user_card",
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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 (
|
2023-04-05 06:05:14 +00:00
|
|
|
// PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
|
|
PasswordValidator func(string) error
|
2022-08-31 07:49:08 +00:00
|
|
|
// DefaultCard holds the default value on creation for the "card" field.
|
|
|
|
DefaultCard func() int
|
2023-05-03 10:16:36 +00:00
|
|
|
// DefaultSkill holds the default value on creation for the "skill" field.
|
|
|
|
DefaultSkill func() string
|
2022-08-31 07:49:08 +00:00
|
|
|
// DefaultStatus holds the default value on creation for the "status" field.
|
|
|
|
DefaultStatus func() string
|
|
|
|
// DefaultCp holds the default value on creation for the "cp" field.
|
|
|
|
DefaultCp func() int
|
|
|
|
// DefaultURL holds the default value on creation for the "url" field.
|
|
|
|
DefaultURL string
|
2024-02-21 07:06:08 +00:00
|
|
|
// DefaultAuthor holds the default value on creation for the "author" field.
|
|
|
|
DefaultAuthor string
|
2022-08-31 07:49:08 +00:00
|
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
|
|
DefaultCreatedAt func() time.Time
|
|
|
|
)
|
2024-02-21 07:06:08 +00:00
|
|
|
|
|
|
|
// OrderOption defines the ordering options for the Card 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()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByPassword orders the results by the password field.
|
|
|
|
func ByPassword(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldPassword, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByCard orders the results by the card field.
|
|
|
|
func ByCard(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldCard, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// BySkill orders the results by the skill field.
|
|
|
|
func BySkill(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldSkill, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByStatus orders the results by the status field.
|
|
|
|
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByToken orders the results by the token field.
|
|
|
|
func ByToken(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldToken, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByCp orders the results by the cp field.
|
|
|
|
func ByCp(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldCp, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByURL orders the results by the url field.
|
|
|
|
func ByURL(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldURL, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByCount orders the results by the count field.
|
|
|
|
func ByCount(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldCount, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByAuthor orders the results by the author field.
|
|
|
|
func ByAuthor(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldAuthor, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ByOwnerField orders the results by owner field.
|
|
|
|
func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
return func(s *sql.Selector) {
|
|
|
|
sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func newOwnerStep() *sqlgraph.Step {
|
|
|
|
return sqlgraph.NewStep(
|
|
|
|
sqlgraph.From(Table, FieldID),
|
|
|
|
sqlgraph.To(OwnerInverseTable, FieldID),
|
|
|
|
sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
|
|
|
|
)
|
|
|
|
}
|