Documentation ¶
Index ¶
- Variables
- type DefaultFN
- type Field
- type Model
- func (m *Model) Default(data any)
- func (m *Model) GenOpenAPIModel() *spec.Schema
- func (m *Model) Init()
- func (m *Model) MakeField() []reflect.StructField
- func (m *Model) MakeList() any
- func (m *Model) MakeModel() any
- func (m *Model) MakeTimeField() []reflect.StructField
- func (m *Model) Migrate(db *gorm.DB) error
- func (m *Model) Pagination(ctx *gin.Context, p PaginationImp) (f func(*gorm.DB) *gorm.DB)
- func (m *Model) PrimaryKeys() []string
- func (m *Model) Search(ctx *gin.Context) (f func(*gorm.DB) *gorm.DB)
- func (m *Model) TableName() string
- func (m *Model) TableScope(db *gorm.DB) *gorm.DB
- func (m *Model) TenantScope(ctx *gin.Context, fn func(ctx *gin.Context) (any, error)) func(db *gorm.DB) *gorm.DB
- func (m *Model) URI(ctx *gin.Context) (f func(*gorm.DB) *gorm.DB)
- type ModelImpl
- type ModelProvider
- type PaginationImp
Constants ¶
This section is empty.
Variables ¶
View Source
var NowFN = func() string { return time.Now().String() }
View Source
var UUIDFN = func() string { return strings.ReplaceAll(uuid.New().String(), "-", "") }
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct { ModelID string `json:"modelID,omitempty" yaml:"modelID" binding:"required" gorm:"column:model_id;type:varchar(64);not null;comment:模型id"` Name string `json:"name" yaml:"name" binding:"required"` JsonTag string `json:"jsonTag" yaml:"jsonTag"` DataType schema.DataType `json:"type" yaml:"type" binding:"required"` PrimaryKey string `json:"primaryKey" yaml:"primaryKey"` AutoIncrement bool `json:"autoIncrement" yaml:"autoIncrement"` AutoIncrementIncrement int64 `json:"autoIncrementIncrement" yaml:"autoIncrementIncrement"` Creatable bool `json:"creatable" yaml:"creatable"` Updatable bool `json:"updatable" yaml:"updatable"` Readable bool `json:"readable" yaml:"readable"` DefaultValue string `json:"defaultValue" yaml:"defaultValue"` DefaultValueFN func() string `json:"-" yaml:"-"` NotNull bool `json:"notNull" yaml:"notNull"` Unique string `json:"unique" yaml:"unique"` Index string `json:"index" yaml:"index"` Comment string `json:"comment" yaml:"comment"` Size int `json:"size" yaml:"size"` Precision int `json:"precision" yaml:"precision"` Scale int `json:"scale" yaml:"scale"` Search string `json:"search" yaml:"search"` }
func (*Field) GenOpenAPIFie ¶ added in v0.1.0
func (*Field) MakeField ¶
func (f *Field) MakeField() reflect.StructField
type Model ¶
type Model struct { Table string `json:"tableName" yaml:"tableName" binding:"required"` Name string `json:"name" yaml:"name" binding:"required"` Description string `json:"description" yaml:"description"` HardDeleted bool `json:"hardDeleted" yaml:"hardDeleted"` Fields []*Field `json:"fields" yaml:"fields" binding:"required"` MultiTenant bool `json:"multiTenant" yaml:"multiTenant"` Auth bool `json:"auth" yaml:"auth"` }
func (*Model) GenOpenAPIModel ¶ added in v0.1.0
func (*Model) MakeField ¶
func (m *Model) MakeField() []reflect.StructField
func (*Model) MakeTimeField ¶
func (m *Model) MakeTimeField() []reflect.StructField
func (*Model) Pagination ¶
func (*Model) PrimaryKeys ¶
PrimaryKeys get primary keys support multi keys
func (*Model) TenantScope ¶ added in v0.1.4
type ModelProvider ¶ added in v0.1.0
type ModelProvider string
ModelProvider model provider
const ( // ModelProviderMgm mgm model provider ModelProviderMgm ModelProvider = "mgm" // ModelProviderGorm gorm model provider ModelProviderGorm ModelProvider = "gorm" )
type PaginationImp ¶
Click to show internal directories.
Click to hide internal directories.