mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-30 17:13:08 +08:00
fix: support keylike search (#21029)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -54,6 +54,9 @@ type MetadataBaseFilterInput struct {
|
||||
// 同时显示用户标签
|
||||
WithUserMeta *bool `json:"with_user_meta"`
|
||||
|
||||
// 按key模糊匹配
|
||||
KeyLike string `json:"key_like"`
|
||||
|
||||
// 按Key过滤
|
||||
Key []string `json:"key"`
|
||||
|
||||
|
||||
@@ -341,6 +341,9 @@ func (manager *SMetadataManager) metaDataQuery2List(ctx context.Context, q *sqlc
|
||||
}
|
||||
|
||||
func (manager *SMetadataManager) metadataBaseFilter(q *sqlchemy.SQuery, input apis.MetadataBaseFilterInput) *sqlchemy.SQuery {
|
||||
if len(input.KeyLike) > 0 {
|
||||
q = q.Contains("key", input.KeyLike)
|
||||
}
|
||||
if len(input.Key) > 0 {
|
||||
q = q.In("key", input.Key)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user