@@ -14,27 +14,28 @@ sealed interface Bucket : Fromable, Joinable, Nestable, Deletable, Updatable, Si
1414 val scope: BucketScope ?
1515}
1616
17+ data class BucketScope (val name : String , val collection : ScopeCollection ? = null ) {
18+ fun withCollection (collectionName : String ) = copy(collection = ScopeCollection (collectionName))
19+
20+ fun withCollection (collection : ScopeCollection ) = copy(collection = collection)
21+ }
22+
23+ data class ScopeCollection (val name : String )
24+
1725data class UnaliasedBucket (
1826 override val name : String ,
1927 override val scope : BucketScope ? = null ,
2028) : Bucket {
29+
2130 fun alias (alias : String ) = AliasedBucket (name, alias, scope)
2231
2332 fun withScope (scopeName : String ) = copy(scope = BucketScope (scopeName))
2433
2534 fun withScope (scope : BucketScope ) = copy(scope = scope)
26-
27- fun withScopeAndCollection (scopeName : String , collectionName : String ) = copy(
28- scope = BucketScope (scopeName, BucketCollection (collectionName)),
29- )
30- }
31-
32- data class BucketScope (val name : String , val collection : BucketCollection ? = null ) {
33- fun withCollection (collectionName : String ) = copy(collection = BucketCollection (collectionName))
35+ fun withScopeAndCollection (scopeName : String , collectionName : String ) =
36+ copy(scope = BucketScope (scopeName, ScopeCollection (collectionName)))
3437}
3538
36- data class BucketCollection (val name : String )
37-
3839data class AliasedBucket (
3940 override val name : String ,
4041 val alias : String ,
0 commit comments