Skip to content

Commit

Permalink
fix: support keylike search (#21029)
Browse files Browse the repository at this point in the history
Co-authored-by: Qiu Jian <[email protected]>
  • Loading branch information
swordqiu and Qiu Jian authored Aug 15, 2024
1 parent 350446b commit 7dfb5fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/apis/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type MetadataBaseFilterInput struct {
// 同时显示用户标签
WithUserMeta *bool `json:"with_user_meta"`

// 按key模糊匹配
KeyLike string `json:"key_like"`

// 按Key过滤
Key []string `json:"key"`

Expand Down
3 changes: 3 additions & 0 deletions pkg/cloudcommon/db/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 7dfb5fb

Please sign in to comment.