diff --git a/scope.go b/scope.go index 1763b68..a991227 100644 --- a/scope.go +++ b/scope.go @@ -102,6 +102,16 @@ func NewScopedConfigured(storeInstance *Store, scopedConfig ScopedStoreConfig) ( return scopedStore, nil } +// Usage example: `scopedStore, err := store.NewScopedWithQuota(storeInstance, "tenant-a", store.QuotaConfig{MaxKeys: 100, MaxGroups: 10}); if err != nil { return }` +// Prefer `NewScopedConfigured(store.ScopedStoreConfig{...})` when the full +// namespace and quota configuration are already known at the call site. +func NewScopedWithQuota(storeInstance *Store, namespace string, quota QuotaConfig) (*ScopedStore, error) { + return NewScopedConfigured(storeInstance, ScopedStoreConfig{ + Namespace: namespace, + Quota: quota, + }) +} + func (scopedStore *ScopedStore) namespacedGroup(group string) string { return scopedStore.namespace + ":" + group } diff --git a/test_helpers_test.go b/test_helpers_test.go index 155fb90..8d4a052 100644 --- a/test_helpers_test.go +++ b/test_helpers_test.go @@ -78,10 +78,3 @@ func requireResultRows(tb testing.TB, result core.Result) []map[string]any { require.True(tb, ok, "unexpected row type: %T", result.Value) return rows } - -func NewScopedWithQuota(storeInstance *Store, namespace string, quota QuotaConfig) (*ScopedStore, error) { - return NewScopedConfigured(storeInstance, ScopedStoreConfig{ - Namespace: namespace, - Quota: quota, - }) -}