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
|
|
@ -23,6 +23,8 @@ const (
|
|||
FieldPassword = "password"
|
||||
// FieldVerified holds the string denoting the verified field in the database.
|
||||
FieldVerified = "verified"
|
||||
// FieldAdmin holds the string denoting the admin field in the database.
|
||||
FieldAdmin = "admin"
|
||||
// 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.
|
||||
|
|
@ -35,7 +37,7 @@ const (
|
|||
// It exists in this package in order to avoid circular dependency with the "passwordtoken" package.
|
||||
OwnerInverseTable = "password_tokens"
|
||||
// OwnerColumn is the table column denoting the owner relation/edge.
|
||||
OwnerColumn = "password_token_user"
|
||||
OwnerColumn = "user_id"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for user fields.
|
||||
|
|
@ -45,6 +47,7 @@ var Columns = []string{
|
|||
FieldEmail,
|
||||
FieldPassword,
|
||||
FieldVerified,
|
||||
FieldAdmin,
|
||||
FieldCreatedAt,
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +76,8 @@ var (
|
|||
PasswordValidator func(string) error
|
||||
// DefaultVerified holds the default value on creation for the "verified" field.
|
||||
DefaultVerified bool
|
||||
// DefaultAdmin holds the default value on creation for the "admin" field.
|
||||
DefaultAdmin bool
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
)
|
||||
|
|
@ -105,6 +110,11 @@ func ByVerified(opts ...sql.OrderTermOption) OrderOption {
|
|||
return sql.OrderByField(FieldVerified, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAdmin orders the results by the admin field.
|
||||
func ByAdmin(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAdmin, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreatedAt orders the results by the created_at field.
|
||||
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
||||
|
|
|
|||
|
|
@ -75,6 +75,11 @@ func Verified(v bool) predicate.User {
|
|||
return predicate.User(sql.FieldEQ(FieldVerified, v))
|
||||
}
|
||||
|
||||
// Admin applies equality check predicate on the "admin" field. It's identical to AdminEQ.
|
||||
func Admin(v bool) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldAdmin, v))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
func CreatedAt(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldCreatedAt, v))
|
||||
|
|
@ -285,6 +290,16 @@ func VerifiedNEQ(v bool) predicate.User {
|
|||
return predicate.User(sql.FieldNEQ(FieldVerified, v))
|
||||
}
|
||||
|
||||
// AdminEQ applies the EQ predicate on the "admin" field.
|
||||
func AdminEQ(v bool) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldAdmin, v))
|
||||
}
|
||||
|
||||
// AdminNEQ applies the NEQ predicate on the "admin" field.
|
||||
func AdminNEQ(v bool) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldAdmin, v))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldCreatedAt, v))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue