@@ -118,6 +118,82 @@ func TestIndexForFilter(t *testing.T) {
118
118
},
119
119
expected : "" ,
120
120
},
121
+ {
122
+ name : "filter by resource type, relation and subject type and relation" ,
123
+ filter : datastore.RelationshipsFilter {
124
+ OptionalResourceType : "foo" ,
125
+ OptionalResourceRelation : "bar" ,
126
+ OptionalSubjectsSelectors : []datastore.SubjectsSelector {
127
+ {
128
+ OptionalSubjectType : "foo" ,
129
+ RelationFilter : datastore.SubjectRelationFilter {
130
+ NonEllipsisRelation : "baz" ,
131
+ },
132
+ },
133
+ },
134
+ },
135
+ expected : "ix_relation_tuple_by_subject_relation" ,
136
+ },
137
+ {
138
+ name : "filter by resource type, relation and subject type" ,
139
+ filter : datastore.RelationshipsFilter {
140
+ OptionalResourceType : "foo" ,
141
+ OptionalResourceRelation : "bar" ,
142
+ OptionalSubjectsSelectors : []datastore.SubjectsSelector {
143
+ {
144
+ OptionalSubjectType : "foo" ,
145
+ },
146
+ },
147
+ },
148
+ expected : "pk_relation_tuple" ,
149
+ },
150
+ {
151
+ name : "filter by resource type, relation and subject relation" ,
152
+ filter : datastore.RelationshipsFilter {
153
+ OptionalResourceType : "foo" ,
154
+ OptionalResourceRelation : "bar" ,
155
+ OptionalSubjectsSelectors : []datastore.SubjectsSelector {
156
+ {
157
+ RelationFilter : datastore.SubjectRelationFilter {
158
+ NonEllipsisRelation : "baz" ,
159
+ },
160
+ },
161
+ },
162
+ },
163
+ expected : "pk_relation_tuple" ,
164
+ },
165
+ {
166
+ name : "filter by resource relation and subject type and relation" ,
167
+ filter : datastore.RelationshipsFilter {
168
+ OptionalResourceRelation : "bar" ,
169
+ OptionalSubjectsSelectors : []datastore.SubjectsSelector {
170
+ {
171
+ OptionalSubjectType : "foo" ,
172
+ RelationFilter : datastore.SubjectRelationFilter {
173
+ NonEllipsisRelation : "baz" ,
174
+ },
175
+ },
176
+ },
177
+ },
178
+ expected : "" ,
179
+ },
180
+ {
181
+ name : "filter by resource type, relation and subject type and relation, include ellipsis" ,
182
+ filter : datastore.RelationshipsFilter {
183
+ OptionalResourceType : "foo" ,
184
+ OptionalResourceRelation : "bar" ,
185
+ OptionalSubjectsSelectors : []datastore.SubjectsSelector {
186
+ {
187
+ OptionalSubjectType : "foo" ,
188
+ RelationFilter : datastore.SubjectRelationFilter {
189
+ IncludeEllipsisRelation : true ,
190
+ NonEllipsisRelation : "baz" ,
191
+ },
192
+ },
193
+ },
194
+ },
195
+ expected : "pk_relation_tuple" ,
196
+ },
121
197
}
122
198
123
199
schema := Schema (common .ColumnOptimizationOptionNone , false , false )
0 commit comments