fix select key
This commit is contained in:
@@ -91,11 +91,11 @@ func (dao *ApiKeyDAO) FindApiKeysBySupportModel(db *gorm.DB, modelName string) (
|
||||
case "postgres":
|
||||
return nil, errors.New("not support")
|
||||
}
|
||||
err := db.Model(&model.ApiKey{}).
|
||||
Joins("CROSS JOIN JSON_EACH(apikeys.support_models)").
|
||||
Where("active = true").
|
||||
Where("value = ?", modelName).
|
||||
Find(&apiKeys).Error
|
||||
err := db.Raw(`
|
||||
SELECT a.*
|
||||
FROM apikeys a
|
||||
JOIN json_each(a.support_models) AS je ON je.value = ?
|
||||
WHERE a.active = true`, modelName).Scan(&apiKeys).Error
|
||||
return apiKeys, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user