Skip to content

Commit

Permalink
Merge pull request #1185 from openmeterio/feat/allow-searching-by-fea…
Browse files Browse the repository at this point in the history
…ture-key

feat: allow searching by feature key
  • Loading branch information
turip authored Jul 10, 2024
2 parents 6c684cc + f52b8f0 commit 2f05b2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/entitlement/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type ListEntitlementsParams struct {
Namespaces []string
SubjectKey string
FeatureIDs []string
FeatureKeys []string
Limit int
Offset int
OrderBy ListEntitlementsOrderBy
Expand Down
4 changes: 4 additions & 0 deletions internal/entitlement/postgresadapter/entitlement.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ func (a *entitlementDBAdapter) ListEntitlements(ctx context.Context, params enti
query = query.Where(db_entitlement.FeatureIDIn(params.FeatureIDs...))
}

if len(params.FeatureKeys) > 0 {
query = query.Where(db_entitlement.FeatureKeyIn(params.FeatureKeys...))
}

if !params.IncludeDeleted {
query = query.Where(db_entitlement.Or(db_entitlement.DeletedAtGT(clock.Now()), db_entitlement.DeletedAtIsNil()))
}
Expand Down

0 comments on commit 2f05b2c

Please sign in to comment.