create a new helper to check if an index has a noncomposite attribute
@@ -110,6 +110,7 @@ var funcMap = template.FuncMap(map[string]interface{}{
},
"findCompositeAttribute": findCompositeAttribute,
"indexContainsCompositeAttribute": indexContainsCompositeAttribute,
+ "indexContainsNonCompositeAttribute": indexContainsNonCompositeAttribute,
"isComposite": isComposite,
"stringPropertiesInComposites": func(config XDBConfig) map[string][]string {
sepToProps := map[string][]string{}
@@ -348,6 +349,15 @@ func indexContainsCompositeAttribute(config XDBConfig, keySchema []resources.AWS
return false
}
+func indexContainsNonCompositeAttribute(config XDBConfig, keySchema []resources.AWSDynamoDBTable_KeySchema) bool {
+ for _, ks := range keySchema {
+ if !isComposite(config, ks.AttributeName) {
+ return true
+ }
+ }
+ return false
+}
+
func difference(a, b []string) []string {
diff := []string{}
for _, el := range a {
