Compare commits
No commits in common. "master" and "v0.0.3" have entirely different histories.
30
README.md
30
README.md
|
@ -1,31 +1 @@
|
|||
# 数据库组件
|
||||
|
||||
组件提供了操作`mysql`一些相关的内容,通过组件可以方便的实现怎删改查的接口
|
||||
|
||||
|
||||
## 插件
|
||||
|
||||
### 主键插件
|
||||
|
||||
主键插件是指的是用于生成数据库主键的插件,非自增长的ID主键插件,使用方式
|
||||
|
||||
```go
|
||||
db.Use(&identified.Identify{})
|
||||
```
|
||||
|
||||
### 数据校验插件
|
||||
|
||||
数据校验插件用户增改的时候对数据格式进行校验,使用方式
|
||||
|
||||
```go
|
||||
db.Use(validate.New())
|
||||
```
|
||||
|
||||
|
||||
### 分表插件
|
||||
|
||||
分表插件提供了自动分表的功能,使用方式
|
||||
|
||||
```go
|
||||
db.Use(sharding.New())
|
||||
```
|
7
rest.go
7
rest.go
|
@ -312,7 +312,6 @@ func fieldAttribute(field *schema.Field) types.Attribute {
|
|||
attr.Live.Columns = strings.Split(kv[1], ",")
|
||||
}
|
||||
}
|
||||
attr.Match = types.MatchExactly
|
||||
}
|
||||
|
||||
dropdown := field.Tag.Get("dropdown")
|
||||
|
@ -380,7 +379,6 @@ func fieldAttribute(field *schema.Field) types.Attribute {
|
|||
}
|
||||
attr.Values = append(attr.Values, fv)
|
||||
}
|
||||
attr.Match = types.MatchExactly
|
||||
}
|
||||
if !field.Creatable {
|
||||
attr.Disable = append(attr.Disable, types.ScenarioCreate)
|
||||
|
@ -638,10 +636,9 @@ func ModelTypes(ctx context.Context, db *gorm.DB, model any, domainName, labelCo
|
|||
tx := db.WithContext(ctx)
|
||||
result := make([]map[string]any, 0, 10)
|
||||
if domainName == "" {
|
||||
tx.Model(model).Select(labelColumn, valueColumn).Scan(&result)
|
||||
} else {
|
||||
tx.Model(model).Select(labelColumn, valueColumn).Where("domain=?", domainName).Scan(&result)
|
||||
domainName = defaultDomain
|
||||
}
|
||||
tx.Model(model).Select(labelColumn, valueColumn).Where("domain=?", domainName).Scan(&result)
|
||||
values = make([]*types.TypeValue, 0, len(result))
|
||||
for _, pairs := range result {
|
||||
feed := &types.TypeValue{}
|
||||
|
|
Loading…
Reference in New Issue