From 68bdabddeed2680c632f3b016b0c7bd033b70db3 Mon Sep 17 00:00:00 2001 From: fancl Date: Fri, 13 Dec 2024 09:50:13 +0800 Subject: [PATCH] fix bug --- rest.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rest.go b/rest.go index 2e50031..5ce1d54 100644 --- a/rest.go +++ b/rest.go @@ -636,9 +636,10 @@ 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 == "" { - 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)) for _, pairs := range result { feed := &types.TypeValue{}