Compare commits

...

1 Commits

Author SHA1 Message Date
fancl 68bdabddee fix bug 2024-12-13 09:50:13 +08:00
1 changed files with 3 additions and 2 deletions

View File

@ -636,9 +636,10 @@ func ModelTypes(ctx context.Context, db *gorm.DB, model any, domainName, labelCo
tx := db.WithContext(ctx) tx := db.WithContext(ctx)
result := make([]map[string]any, 0, 10) result := make([]map[string]any, 0, 10)
if domainName == "" { if domainName == "" {
domainName = defaultDomain tx.Model(model).Select(labelColumn, valueColumn).Scan(&result)
} } else {
tx.Model(model).Select(labelColumn, valueColumn).Where("domain=?", domainName).Scan(&result) tx.Model(model).Select(labelColumn, valueColumn).Where("domain=?", domainName).Scan(&result)
}
values = make([]*types.TypeValue, 0, len(result)) values = make([]*types.TypeValue, 0, len(result))
for _, pairs := range result { for _, pairs := range result {
feed := &types.TypeValue{} feed := &types.TypeValue{}