Generate ent schema in admin code. (#127)
This commit is contained in:
parent
75c9c5be34
commit
37104788e7
13 changed files with 303 additions and 142 deletions
|
|
@ -9,6 +9,14 @@ type PasswordToken struct {
|
|||
CreatedAt *time.Time `form:"created_at"`
|
||||
}
|
||||
|
||||
func (e *PasswordToken) GetName() string {
|
||||
return NamePasswordToken
|
||||
}
|
||||
|
||||
func (e *PasswordToken) GetSchema() []*FieldSchema {
|
||||
return fieldsPasswordToken
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Name string `form:"name"`
|
||||
Email string `form:"email"`
|
||||
|
|
@ -18,6 +26,24 @@ type User struct {
|
|||
CreatedAt *time.Time `form:"created_at"`
|
||||
}
|
||||
|
||||
func (e *User) GetName() string {
|
||||
return NameUser
|
||||
}
|
||||
|
||||
func (e *User) GetSchema() []*FieldSchema {
|
||||
return fieldsUser
|
||||
}
|
||||
|
||||
type EntityType interface {
|
||||
GetName() string
|
||||
GetSchema() []*FieldSchema
|
||||
}
|
||||
|
||||
var entityTypes = []EntityType{
|
||||
&PasswordToken{},
|
||||
&User{},
|
||||
}
|
||||
|
||||
type EntityList struct {
|
||||
Columns []string
|
||||
Entities []EntityValues
|
||||
|
|
@ -36,9 +62,6 @@ type HandlerConfig struct {
|
|||
TimeFormat string
|
||||
}
|
||||
|
||||
func GetEntityTypeNames() []string {
|
||||
return []string{
|
||||
"PasswordToken",
|
||||
"User",
|
||||
}
|
||||
func GetEntityTypes() []EntityType {
|
||||
return entityTypes
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue