Compare commits
No commits in common. "master" and "v0.0.2" have entirely different histories.
12
rest.go
12
rest.go
|
@ -552,9 +552,6 @@ func CloneSchemas(ctx context.Context, db *gorm.DB, domain string) (err error) {
|
|||
models []*types.Schema
|
||||
)
|
||||
tx := db.WithContext(ctx)
|
||||
if domain == "" {
|
||||
domain = defaultDomain
|
||||
}
|
||||
if err = tx.Where("domain=?", defaultDomain).Find(&values).Error; err != nil {
|
||||
return fmt.Errorf("schema not found")
|
||||
}
|
||||
|
@ -611,9 +608,6 @@ func GetSchemas(ctx context.Context, db *gorm.DB, domain, moduleName, tableName
|
|||
|
||||
// VisibleSchemas 获取某个场景下面的schema
|
||||
func VisibleSchemas(ctx context.Context, db *gorm.DB, domain, moduleName, tableName, scenario string) ([]*types.Schema, error) {
|
||||
if domain == "" {
|
||||
domain = defaultDomain
|
||||
}
|
||||
schemas, err := GetSchemas(ctx, db, domain, moduleName, tableName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -635,11 +629,7 @@ func VisibleSchemas(ctx context.Context, db *gorm.DB, domain, moduleName, tableN
|
|||
func ModelTypes(ctx context.Context, db *gorm.DB, model any, domainName, labelColumn, valueColumn string) (values []*types.TypeValue) {
|
||||
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)
|
||||
}
|
||||
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