diff --git a/VERSION b/VERSION index ce18e473..c8778cba 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,6 @@ -v8.2.0 +v8.2.1 + +v8.2.1 Sort attributes list used in v8.2.0 to reduce diffs v8.2.0 Allow filtering with non key fields on auto generated dynamo db code diff --git a/samples/gen-go-db-custom-path/db/dynamodb/thing.go b/samples/gen-go-db-custom-path/db/dynamodb/thing.go index e237040f..2a71cc03 100644 --- a/samples/gen-go-db-custom-path/db/dynamodb/thing.go +++ b/samples/gen-go-db-custom-path/db/dynamodb/thing.go @@ -315,13 +315,6 @@ func (t ThingTable) scanThings(ctx context.Context, input db.ScanThingsInput, fn func (t ThingTable) getThingsByNameAndVersionParseFilters(queryInput *dynamodb.QueryInput, input db.GetThingsByNameAndVersionInput) { for _, filterValue := range input.FilterValues { switch filterValue.AttributeName { - case db.ThingRangeNullable: - queryInput.ExpressionAttributeNames["#RANGENULLABLE"] = aws.String(string(db.ThingRangeNullable)) - for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingRangeNullable), i)] = &dynamodb.AttributeValue{ - S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), - } - } case db.ThingCreatedAt: queryInput.ExpressionAttributeNames["#CREATEDAT"] = aws.String(string(db.ThingCreatedAt)) for i, attributeValue := range filterValue.AttributeValues { @@ -343,6 +336,13 @@ func (t ThingTable) getThingsByNameAndVersionParseFilters(queryInput *dynamodb.Q S: aws.String(attributeValue.(string)), } } + case db.ThingRangeNullable: + queryInput.ExpressionAttributeNames["#RANGENULLABLE"] = aws.String(string(db.ThingRangeNullable)) + for i, attributeValue := range filterValue.AttributeValues { + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingRangeNullable), i)] = &dynamodb.AttributeValue{ + S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), + } + } } } } diff --git a/samples/gen-go-db-custom-path/db/dynamodb/thingwithadditionalattributes.go b/samples/gen-go-db-custom-path/db/dynamodb/thingwithadditionalattributes.go index 79bc2e90..316d8e68 100644 --- a/samples/gen-go-db-custom-path/db/dynamodb/thingwithadditionalattributes.go +++ b/samples/gen-go-db-custom-path/db/dynamodb/thingwithadditionalattributes.go @@ -315,17 +315,24 @@ func (t ThingWithAdditionalAttributesTable) scanThingWithAdditionalAttributess(c func (t ThingWithAdditionalAttributesTable) getThingWithAdditionalAttributessByNameAndVersionParseFilters(queryInput *dynamodb.QueryInput, input db.GetThingWithAdditionalAttributessByNameAndVersionInput) { for _, filterValue := range input.FilterValues { switch filterValue.AttributeName { - case db.ThingWithAdditionalAttributesHashNullable: - queryInput.ExpressionAttributeNames["#HASHNULLABLE"] = aws.String(string(db.ThingWithAdditionalAttributesHashNullable)) + case db.ThingWithAdditionalAttributesAdditionalBAttribute: + queryInput.ExpressionAttributeNames["#ADDITIONALBATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalBAttribute)) for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesHashNullable), i)] = &dynamodb.AttributeValue{ - S: aws.String(attributeValue.(string)), + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalBAttribute), i)] = &dynamodb.AttributeValue{ + B: attributeValue.([]byte), } } - case db.ThingWithAdditionalAttributesID: - queryInput.ExpressionAttributeNames["#ID"] = aws.String(string(db.ThingWithAdditionalAttributesID)) + case db.ThingWithAdditionalAttributesAdditionalNAttribute: + queryInput.ExpressionAttributeNames["#ADDITIONALNATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalNAttribute)) for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesID), i)] = &dynamodb.AttributeValue{ + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalNAttribute), i)] = &dynamodb.AttributeValue{ + N: aws.String(fmt.Sprint(attributeValue.(int64))), + } + } + case db.ThingWithAdditionalAttributesAdditionalSAttribute: + queryInput.ExpressionAttributeNames["#ADDITIONALSATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalSAttribute)) + for i, attributeValue := range filterValue.AttributeValues { + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalSAttribute), i)] = &dynamodb.AttributeValue{ S: aws.String(attributeValue.(string)), } } @@ -336,17 +343,17 @@ func (t ThingWithAdditionalAttributesTable) getThingWithAdditionalAttributessByN S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), } } - case db.ThingWithAdditionalAttributesAdditionalNAttribute: - queryInput.ExpressionAttributeNames["#ADDITIONALNATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalNAttribute)) + case db.ThingWithAdditionalAttributesHashNullable: + queryInput.ExpressionAttributeNames["#HASHNULLABLE"] = aws.String(string(db.ThingWithAdditionalAttributesHashNullable)) for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalNAttribute), i)] = &dynamodb.AttributeValue{ - N: aws.String(fmt.Sprint(attributeValue.(int64))), + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesHashNullable), i)] = &dynamodb.AttributeValue{ + S: aws.String(attributeValue.(string)), } } - case db.ThingWithAdditionalAttributesAdditionalSAttribute: - queryInput.ExpressionAttributeNames["#ADDITIONALSATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalSAttribute)) + case db.ThingWithAdditionalAttributesID: + queryInput.ExpressionAttributeNames["#ID"] = aws.String(string(db.ThingWithAdditionalAttributesID)) for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalSAttribute), i)] = &dynamodb.AttributeValue{ + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesID), i)] = &dynamodb.AttributeValue{ S: aws.String(attributeValue.(string)), } } @@ -357,13 +364,6 @@ func (t ThingWithAdditionalAttributesTable) getThingWithAdditionalAttributessByN S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), } } - case db.ThingWithAdditionalAttributesAdditionalBAttribute: - queryInput.ExpressionAttributeNames["#ADDITIONALBATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalBAttribute)) - for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalBAttribute), i)] = &dynamodb.AttributeValue{ - B: attributeValue.([]byte), - } - } } } } diff --git a/samples/gen-go-db-only/db/dynamodb/thing.go b/samples/gen-go-db-only/db/dynamodb/thing.go index 96888fed..7ccfccaf 100644 --- a/samples/gen-go-db-only/db/dynamodb/thing.go +++ b/samples/gen-go-db-only/db/dynamodb/thing.go @@ -315,13 +315,6 @@ func (t ThingTable) scanThings(ctx context.Context, input db.ScanThingsInput, fn func (t ThingTable) getThingsByNameAndVersionParseFilters(queryInput *dynamodb.QueryInput, input db.GetThingsByNameAndVersionInput) { for _, filterValue := range input.FilterValues { switch filterValue.AttributeName { - case db.ThingRangeNullable: - queryInput.ExpressionAttributeNames["#RANGENULLABLE"] = aws.String(string(db.ThingRangeNullable)) - for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingRangeNullable), i)] = &dynamodb.AttributeValue{ - S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), - } - } case db.ThingCreatedAt: queryInput.ExpressionAttributeNames["#CREATEDAT"] = aws.String(string(db.ThingCreatedAt)) for i, attributeValue := range filterValue.AttributeValues { @@ -343,6 +336,13 @@ func (t ThingTable) getThingsByNameAndVersionParseFilters(queryInput *dynamodb.Q S: aws.String(attributeValue.(string)), } } + case db.ThingRangeNullable: + queryInput.ExpressionAttributeNames["#RANGENULLABLE"] = aws.String(string(db.ThingRangeNullable)) + for i, attributeValue := range filterValue.AttributeValues { + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingRangeNullable), i)] = &dynamodb.AttributeValue{ + S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), + } + } } } } diff --git a/samples/gen-go-db-only/db/dynamodb/thingwithadditionalattributes.go b/samples/gen-go-db-only/db/dynamodb/thingwithadditionalattributes.go index 495726f0..05e98e61 100644 --- a/samples/gen-go-db-only/db/dynamodb/thingwithadditionalattributes.go +++ b/samples/gen-go-db-only/db/dynamodb/thingwithadditionalattributes.go @@ -315,20 +315,6 @@ func (t ThingWithAdditionalAttributesTable) scanThingWithAdditionalAttributess(c func (t ThingWithAdditionalAttributesTable) getThingWithAdditionalAttributessByNameAndVersionParseFilters(queryInput *dynamodb.QueryInput, input db.GetThingWithAdditionalAttributessByNameAndVersionInput) { for _, filterValue := range input.FilterValues { switch filterValue.AttributeName { - case db.ThingWithAdditionalAttributesID: - queryInput.ExpressionAttributeNames["#ID"] = aws.String(string(db.ThingWithAdditionalAttributesID)) - for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesID), i)] = &dynamodb.AttributeValue{ - S: aws.String(attributeValue.(string)), - } - } - case db.ThingWithAdditionalAttributesRangeNullable: - queryInput.ExpressionAttributeNames["#RANGENULLABLE"] = aws.String(string(db.ThingWithAdditionalAttributesRangeNullable)) - for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesRangeNullable), i)] = &dynamodb.AttributeValue{ - S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), - } - } case db.ThingWithAdditionalAttributesAdditionalBAttribute: queryInput.ExpressionAttributeNames["#ADDITIONALBATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalBAttribute)) for i, attributeValue := range filterValue.AttributeValues { @@ -336,10 +322,17 @@ func (t ThingWithAdditionalAttributesTable) getThingWithAdditionalAttributessByN B: attributeValue.([]byte), } } - case db.ThingWithAdditionalAttributesHashNullable: - queryInput.ExpressionAttributeNames["#HASHNULLABLE"] = aws.String(string(db.ThingWithAdditionalAttributesHashNullable)) + case db.ThingWithAdditionalAttributesAdditionalNAttribute: + queryInput.ExpressionAttributeNames["#ADDITIONALNATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalNAttribute)) for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesHashNullable), i)] = &dynamodb.AttributeValue{ + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalNAttribute), i)] = &dynamodb.AttributeValue{ + N: aws.String(fmt.Sprint(attributeValue.(int64))), + } + } + case db.ThingWithAdditionalAttributesAdditionalSAttribute: + queryInput.ExpressionAttributeNames["#ADDITIONALSATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalSAttribute)) + for i, attributeValue := range filterValue.AttributeValues { + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalSAttribute), i)] = &dynamodb.AttributeValue{ S: aws.String(attributeValue.(string)), } } @@ -350,20 +343,27 @@ func (t ThingWithAdditionalAttributesTable) getThingWithAdditionalAttributessByN S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), } } - case db.ThingWithAdditionalAttributesAdditionalNAttribute: - queryInput.ExpressionAttributeNames["#ADDITIONALNATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalNAttribute)) + case db.ThingWithAdditionalAttributesHashNullable: + queryInput.ExpressionAttributeNames["#HASHNULLABLE"] = aws.String(string(db.ThingWithAdditionalAttributesHashNullable)) for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalNAttribute), i)] = &dynamodb.AttributeValue{ - N: aws.String(fmt.Sprint(attributeValue.(int64))), + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesHashNullable), i)] = &dynamodb.AttributeValue{ + S: aws.String(attributeValue.(string)), } } - case db.ThingWithAdditionalAttributesAdditionalSAttribute: - queryInput.ExpressionAttributeNames["#ADDITIONALSATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalSAttribute)) + case db.ThingWithAdditionalAttributesID: + queryInput.ExpressionAttributeNames["#ID"] = aws.String(string(db.ThingWithAdditionalAttributesID)) for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalSAttribute), i)] = &dynamodb.AttributeValue{ + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesID), i)] = &dynamodb.AttributeValue{ S: aws.String(attributeValue.(string)), } } + case db.ThingWithAdditionalAttributesRangeNullable: + queryInput.ExpressionAttributeNames["#RANGENULLABLE"] = aws.String(string(db.ThingWithAdditionalAttributesRangeNullable)) + for i, attributeValue := range filterValue.AttributeValues { + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesRangeNullable), i)] = &dynamodb.AttributeValue{ + S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), + } + } } } } diff --git a/samples/gen-go-db-only/db/interface.go b/samples/gen-go-db-only/db/interface.go index c1233f28..cb284257 100644 --- a/samples/gen-go-db-only/db/interface.go +++ b/samples/gen-go-db-only/db/interface.go @@ -1106,13 +1106,13 @@ type ScanThingWithAdditionalAttributessInput struct { // ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute represents the fields we can apply filters to for queries on this index type ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute string -const ThingWithAdditionalAttributesAdditionalSAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalSAttribute" -const ThingWithAdditionalAttributesHashNullable ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "hashNullable" const ThingWithAdditionalAttributesAdditionalBAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalBAttribute" +const ThingWithAdditionalAttributesAdditionalNAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalNAttribute" +const ThingWithAdditionalAttributesAdditionalSAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalSAttribute" const ThingWithAdditionalAttributesCreatedAt ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "createdAt" +const ThingWithAdditionalAttributesHashNullable ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "hashNullable" const ThingWithAdditionalAttributesID ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "id" const ThingWithAdditionalAttributesRangeNullable ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "rangeNullable" -const ThingWithAdditionalAttributesAdditionalNAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalNAttribute" // ThingWithAdditionalAttributesByNameAndVersionFilterValues represents a filter on a particular field to be included in the query type ThingWithAdditionalAttributesByNameAndVersionFilterValues struct { diff --git a/samples/gen-go-db/server/db/dynamodb/thing.go b/samples/gen-go-db/server/db/dynamodb/thing.go index 4dd746bd..6eda440f 100644 --- a/samples/gen-go-db/server/db/dynamodb/thing.go +++ b/samples/gen-go-db/server/db/dynamodb/thing.go @@ -315,6 +315,13 @@ func (t ThingTable) scanThings(ctx context.Context, input db.ScanThingsInput, fn func (t ThingTable) getThingsByNameAndVersionParseFilters(queryInput *dynamodb.QueryInput, input db.GetThingsByNameAndVersionInput) { for _, filterValue := range input.FilterValues { switch filterValue.AttributeName { + case db.ThingCreatedAt: + queryInput.ExpressionAttributeNames["#CREATEDAT"] = aws.String(string(db.ThingCreatedAt)) + for i, attributeValue := range filterValue.AttributeValues { + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingCreatedAt), i)] = &dynamodb.AttributeValue{ + S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), + } + } case db.ThingHashNullable: queryInput.ExpressionAttributeNames["#HASHNULLABLE"] = aws.String(string(db.ThingHashNullable)) for i, attributeValue := range filterValue.AttributeValues { @@ -336,13 +343,6 @@ func (t ThingTable) getThingsByNameAndVersionParseFilters(queryInput *dynamodb.Q S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), } } - case db.ThingCreatedAt: - queryInput.ExpressionAttributeNames["#CREATEDAT"] = aws.String(string(db.ThingCreatedAt)) - for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingCreatedAt), i)] = &dynamodb.AttributeValue{ - S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), - } - } } } } diff --git a/samples/gen-go-db/server/db/dynamodb/thingwithadditionalattributes.go b/samples/gen-go-db/server/db/dynamodb/thingwithadditionalattributes.go index d942c252..7179bba1 100644 --- a/samples/gen-go-db/server/db/dynamodb/thingwithadditionalattributes.go +++ b/samples/gen-go-db/server/db/dynamodb/thingwithadditionalattributes.go @@ -315,6 +315,13 @@ func (t ThingWithAdditionalAttributesTable) scanThingWithAdditionalAttributess(c func (t ThingWithAdditionalAttributesTable) getThingWithAdditionalAttributessByNameAndVersionParseFilters(queryInput *dynamodb.QueryInput, input db.GetThingWithAdditionalAttributessByNameAndVersionInput) { for _, filterValue := range input.FilterValues { switch filterValue.AttributeName { + case db.ThingWithAdditionalAttributesAdditionalBAttribute: + queryInput.ExpressionAttributeNames["#ADDITIONALBATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalBAttribute)) + for i, attributeValue := range filterValue.AttributeValues { + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalBAttribute), i)] = &dynamodb.AttributeValue{ + B: attributeValue.([]byte), + } + } case db.ThingWithAdditionalAttributesAdditionalNAttribute: queryInput.ExpressionAttributeNames["#ADDITIONALNATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalNAttribute)) for i, attributeValue := range filterValue.AttributeValues { @@ -329,20 +336,6 @@ func (t ThingWithAdditionalAttributesTable) getThingWithAdditionalAttributessByN S: aws.String(attributeValue.(string)), } } - case db.ThingWithAdditionalAttributesRangeNullable: - queryInput.ExpressionAttributeNames["#RANGENULLABLE"] = aws.String(string(db.ThingWithAdditionalAttributesRangeNullable)) - for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesRangeNullable), i)] = &dynamodb.AttributeValue{ - S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), - } - } - case db.ThingWithAdditionalAttributesAdditionalBAttribute: - queryInput.ExpressionAttributeNames["#ADDITIONALBATTRIBUTE"] = aws.String(string(db.ThingWithAdditionalAttributesAdditionalBAttribute)) - for i, attributeValue := range filterValue.AttributeValues { - queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesAdditionalBAttribute), i)] = &dynamodb.AttributeValue{ - B: attributeValue.([]byte), - } - } case db.ThingWithAdditionalAttributesCreatedAt: queryInput.ExpressionAttributeNames["#CREATEDAT"] = aws.String(string(db.ThingWithAdditionalAttributesCreatedAt)) for i, attributeValue := range filterValue.AttributeValues { @@ -364,6 +357,13 @@ func (t ThingWithAdditionalAttributesTable) getThingWithAdditionalAttributessByN S: aws.String(attributeValue.(string)), } } + case db.ThingWithAdditionalAttributesRangeNullable: + queryInput.ExpressionAttributeNames["#RANGENULLABLE"] = aws.String(string(db.ThingWithAdditionalAttributesRangeNullable)) + for i, attributeValue := range filterValue.AttributeValues { + queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithAdditionalAttributesRangeNullable), i)] = &dynamodb.AttributeValue{ + S: aws.String(toDynamoTimeString(attributeValue.(strfmt.DateTime))), + } + } } } } diff --git a/samples/gen-go-db/server/db/interface.go b/samples/gen-go-db/server/db/interface.go index d51a277e..24af266f 100644 --- a/samples/gen-go-db/server/db/interface.go +++ b/samples/gen-go-db/server/db/interface.go @@ -1106,13 +1106,13 @@ type ScanThingWithAdditionalAttributessInput struct { // ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute represents the fields we can apply filters to for queries on this index type ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute string +const ThingWithAdditionalAttributesAdditionalBAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalBAttribute" +const ThingWithAdditionalAttributesAdditionalNAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalNAttribute" +const ThingWithAdditionalAttributesAdditionalSAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalSAttribute" const ThingWithAdditionalAttributesCreatedAt ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "createdAt" const ThingWithAdditionalAttributesHashNullable ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "hashNullable" const ThingWithAdditionalAttributesID ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "id" const ThingWithAdditionalAttributesRangeNullable ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "rangeNullable" -const ThingWithAdditionalAttributesAdditionalBAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalBAttribute" -const ThingWithAdditionalAttributesAdditionalNAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalNAttribute" -const ThingWithAdditionalAttributesAdditionalSAttribute ThingWithAdditionalAttributesByNameAndVersionFilterableAttribute = "additionalSAttribute" // ThingWithAdditionalAttributesByNameAndVersionFilterValues represents a filter on a particular field to be included in the query type ThingWithAdditionalAttributesByNameAndVersionFilterValues struct { diff --git a/samples/go.sum b/samples/go.sum index fd6abdf4..193ab6b6 100644 --- a/samples/go.sum +++ b/samples/go.sum @@ -111,6 +111,8 @@ github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL9 github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= +github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= diff --git a/server/gendb/templatefuncs.go b/server/gendb/templatefuncs.go index cf8285c5..6a755eac 100644 --- a/server/gendb/templatefuncs.go +++ b/server/gendb/templatefuncs.go @@ -292,7 +292,10 @@ var funcMap = template.FuncMap(map[string]interface{}{ for _, ia := range indexAttributeNames { allAttributeNames.Remove(ia) } - return allAttributeNames.ToList() + + allAttributeNamesList := allAttributeNames.ToList() + sort.Strings(allAttributeNamesList) + return allAttributeNamesList }, "modelAttributeNamesForKeyType": func(config XDBConfig, keySchema []resources.AWSDynamoDBTable_KeySchema, keyType string) []string { attributeNames := []string{}