UP
This commit is contained in:
@@ -87,7 +87,13 @@ func (dao *ApiKeyDAO) FindApiKeysBySupportModel(db *gorm.DB, modelName string) (
|
|||||||
var apiKeys []model.ApiKey
|
var apiKeys []model.ApiKey
|
||||||
switch dao.cfg.DB_Type {
|
switch dao.cfg.DB_Type {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
return nil, errors.New("not support")
|
err := db.Raw(`
|
||||||
|
SELECT *
|
||||||
|
FROM apikeys
|
||||||
|
WHERE active = true
|
||||||
|
AND JSON_CONTAINS(support_models, ?, '$')`, modelName).
|
||||||
|
Scan(&apiKeys).Error
|
||||||
|
return apiKeys, err
|
||||||
case "postgres":
|
case "postgres":
|
||||||
return nil, errors.New("not support")
|
return nil, errors.New("not support")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user