Add dynamic admin panel for managing entities (#108)
This commit is contained in:
parent
60009df0bf
commit
1a6874fd82
47 changed files with 2173 additions and 320 deletions
|
|
@ -5,6 +5,7 @@ package passwordtoken
|
|||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
|
@ -14,8 +15,10 @@ const (
|
|||
Label = "password_token"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldHash holds the string denoting the hash field in the database.
|
||||
FieldHash = "hash"
|
||||
// FieldToken holds the string denoting the token field in the database.
|
||||
FieldToken = "token"
|
||||
// FieldUserID holds the string denoting the user_id field in the database.
|
||||
FieldUserID = "user_id"
|
||||
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
||||
FieldCreatedAt = "created_at"
|
||||
// EdgeUser holds the string denoting the user edge name in mutations.
|
||||
|
|
@ -28,22 +31,17 @@ const (
|
|||
// 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 = "password_token_user"
|
||||
UserColumn = "user_id"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for passwordtoken fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldHash,
|
||||
FieldToken,
|
||||
FieldUserID,
|
||||
FieldCreatedAt,
|
||||
}
|
||||
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "password_tokens"
|
||||
// table and are not defined as standalone fields in the schema.
|
||||
var ForeignKeys = []string{
|
||||
"password_token_user",
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
|
|
@ -51,17 +49,18 @@ func ValidColumn(column string) bool {
|
|||
return true
|
||||
}
|
||||
}
|
||||
for i := range ForeignKeys {
|
||||
if column == ForeignKeys[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Note that the variables below are initialized by the runtime
|
||||
// package on the initialization of the application. Therefore,
|
||||
// it should be imported in the main as follows:
|
||||
//
|
||||
// import _ "github.com/mikestefanello/pagoda/ent/runtime"
|
||||
var (
|
||||
// HashValidator is a validator for the "hash" field. It is called by the builders before save.
|
||||
HashValidator func(string) error
|
||||
Hooks [1]ent.Hook
|
||||
// TokenValidator is a validator for the "token" field. It is called by the builders before save.
|
||||
TokenValidator func(string) error
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
)
|
||||
|
|
@ -74,9 +73,14 @@ func ByID(opts ...sql.OrderTermOption) OrderOption {
|
|||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHash orders the results by the hash field.
|
||||
func ByHash(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHash, opts...).ToFunc()
|
||||
// ByToken orders the results by the token field.
|
||||
func ByToken(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldToken, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUserID orders the results by the user_id field.
|
||||
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreatedAt orders the results by the created_at field.
|
||||
|
|
|
|||
|
|
@ -55,9 +55,14 @@ func IDLTE(id int) predicate.PasswordToken {
|
|||
return predicate.PasswordToken(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Hash applies equality check predicate on the "hash" field. It's identical to HashEQ.
|
||||
func Hash(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldEQ(FieldHash, v))
|
||||
// Token applies equality check predicate on the "token" field. It's identical to TokenEQ.
|
||||
func Token(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldEQ(FieldToken, v))
|
||||
}
|
||||
|
||||
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
|
||||
func UserID(v int) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldEQ(FieldUserID, v))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
|
|
@ -65,69 +70,89 @@ func CreatedAt(v time.Time) predicate.PasswordToken {
|
|||
return predicate.PasswordToken(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// HashEQ applies the EQ predicate on the "hash" field.
|
||||
func HashEQ(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldEQ(FieldHash, v))
|
||||
// TokenEQ applies the EQ predicate on the "token" field.
|
||||
func TokenEQ(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldEQ(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashNEQ applies the NEQ predicate on the "hash" field.
|
||||
func HashNEQ(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldNEQ(FieldHash, v))
|
||||
// TokenNEQ applies the NEQ predicate on the "token" field.
|
||||
func TokenNEQ(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldNEQ(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashIn applies the In predicate on the "hash" field.
|
||||
func HashIn(vs ...string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldIn(FieldHash, vs...))
|
||||
// TokenIn applies the In predicate on the "token" field.
|
||||
func TokenIn(vs ...string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldIn(FieldToken, vs...))
|
||||
}
|
||||
|
||||
// HashNotIn applies the NotIn predicate on the "hash" field.
|
||||
func HashNotIn(vs ...string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldNotIn(FieldHash, vs...))
|
||||
// TokenNotIn applies the NotIn predicate on the "token" field.
|
||||
func TokenNotIn(vs ...string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldNotIn(FieldToken, vs...))
|
||||
}
|
||||
|
||||
// HashGT applies the GT predicate on the "hash" field.
|
||||
func HashGT(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldGT(FieldHash, v))
|
||||
// TokenGT applies the GT predicate on the "token" field.
|
||||
func TokenGT(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldGT(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashGTE applies the GTE predicate on the "hash" field.
|
||||
func HashGTE(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldGTE(FieldHash, v))
|
||||
// TokenGTE applies the GTE predicate on the "token" field.
|
||||
func TokenGTE(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldGTE(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashLT applies the LT predicate on the "hash" field.
|
||||
func HashLT(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldLT(FieldHash, v))
|
||||
// TokenLT applies the LT predicate on the "token" field.
|
||||
func TokenLT(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldLT(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashLTE applies the LTE predicate on the "hash" field.
|
||||
func HashLTE(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldLTE(FieldHash, v))
|
||||
// TokenLTE applies the LTE predicate on the "token" field.
|
||||
func TokenLTE(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldLTE(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashContains applies the Contains predicate on the "hash" field.
|
||||
func HashContains(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldContains(FieldHash, v))
|
||||
// TokenContains applies the Contains predicate on the "token" field.
|
||||
func TokenContains(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldContains(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashHasPrefix applies the HasPrefix predicate on the "hash" field.
|
||||
func HashHasPrefix(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldHasPrefix(FieldHash, v))
|
||||
// TokenHasPrefix applies the HasPrefix predicate on the "token" field.
|
||||
func TokenHasPrefix(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldHasPrefix(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashHasSuffix applies the HasSuffix predicate on the "hash" field.
|
||||
func HashHasSuffix(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldHasSuffix(FieldHash, v))
|
||||
// TokenHasSuffix applies the HasSuffix predicate on the "token" field.
|
||||
func TokenHasSuffix(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldHasSuffix(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashEqualFold applies the EqualFold predicate on the "hash" field.
|
||||
func HashEqualFold(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldEqualFold(FieldHash, v))
|
||||
// TokenEqualFold applies the EqualFold predicate on the "token" field.
|
||||
func TokenEqualFold(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldEqualFold(FieldToken, v))
|
||||
}
|
||||
|
||||
// HashContainsFold applies the ContainsFold predicate on the "hash" field.
|
||||
func HashContainsFold(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldContainsFold(FieldHash, v))
|
||||
// TokenContainsFold applies the ContainsFold predicate on the "token" field.
|
||||
func TokenContainsFold(v string) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldContainsFold(FieldToken, v))
|
||||
}
|
||||
|
||||
// UserIDEQ applies the EQ predicate on the "user_id" field.
|
||||
func UserIDEQ(v int) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldEQ(FieldUserID, v))
|
||||
}
|
||||
|
||||
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
|
||||
func UserIDNEQ(v int) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldNEQ(FieldUserID, v))
|
||||
}
|
||||
|
||||
// UserIDIn applies the In predicate on the "user_id" field.
|
||||
func UserIDIn(vs ...int) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldIn(FieldUserID, vs...))
|
||||
}
|
||||
|
||||
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
|
||||
func UserIDNotIn(vs ...int) predicate.PasswordToken {
|
||||
return predicate.PasswordToken(sql.FieldNotIn(FieldUserID, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue