feat: ui tags
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
package mirror
|
||||
|
||||
type Field struct {
|
||||
Name string `json:"name"`
|
||||
DisplayName string `json:"display_name"`
|
||||
Hidden bool `json:"hidden"`
|
||||
/*
|
||||
possible values are `string`, `number`, `bool`, `timestamp`, `related`
|
||||
`?` postfix means nullable type
|
||||
`[]` postfix means array type; use only with `related`
|
||||
*/
|
||||
Type string `json:"type_name"`
|
||||
RelatedModel *string `json:"related_model"`
|
||||
RelatedModelKey *string `json:"related_model_key"`
|
||||
RelationType *string `json:"relation_type"`
|
||||
}
|
||||
|
||||
type Model struct {
|
||||
Name string `json:"name"`
|
||||
Fields []Field `json:"fields"`
|
||||
}
|
||||
|
||||
type Scheme struct {
|
||||
Models []Model `json:"models"`
|
||||
}
|
||||
@@ -5,13 +5,12 @@ var Entities = []any{
|
||||
}
|
||||
|
||||
type Post struct {
|
||||
Id uint `gorm:"primaryKey" displayName:"Номер"`
|
||||
Text string `displayName:"Текст" displayName:"Текст поста"`
|
||||
CreatedAt int64 `gorm:"autoCreateTime" displayName:"Дата публикации" cellType:"timestamp"`
|
||||
Id uint `gorm:"primaryKey" ui:"hidden"`
|
||||
Text string `displayName:"Текст" ui:"label=Текст"`
|
||||
CreatedAt int64 `gorm:"autoCreateTime" ui:"hidden"`
|
||||
}
|
||||
|
||||
// Author A sample of comment
|
||||
type Author struct {
|
||||
Id uint `gorm:"primaryKey"`
|
||||
Name string
|
||||
Id uint `gorm:"primaryKey" ui:"hidden"`
|
||||
Name string `ui:"label=Имя"`
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"app/internal/dal"
|
||||
"app/internal/models"
|
||||
"errors"
|
||||
|
||||
"gorm.io/gen/field"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user