Closed dxu429 closed 8 months ago
https://clever.atlassian.net/browse/DD-5016
~1. Fix import for dynamodb - should only be imported in dynamodb.go when there are transactions~
datetime
HASH
Currently code gen for date-time HASH keys for GSI's doesn't properly convert strfmt.Datetime to strings in the generated getBy{GSI} functions.
strfmt.Datetime
strings
here input.endDate has type strfmt.Date, which should be converted to a string
input.endDate
strfmt.Date
<<<<<<< type mismatch>>>>>>>> if input.EndDate == "" { <<<<<<< type mismatch>>>>>>>> return fmt.Errorf("Hash key input.EndDate cannot be empty") } queryInput := &dynamodb.QueryInput{ TableName: aws.String(t.name()), IndexName: aws.String("endDate"), ExpressionAttributeNames: map[string]*string{ "#ENDDATE": aws.String("endDate"), }, ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{ ":endDate": &dynamodb.AttributeValue{ <<<<<<< type mismatch>>>>>>>> S: aws.String(input.EndDate), <<<<<<< type mismatch>>>>>>>> }, }, ScanIndexForward: aws.Bool(!input.Descending), ConsistentRead: aws.Bool(false), }
if toDynamoTimeString(input.EndDate) == "" { return fmt.Errorf("Hash key input.EndDate cannot be empty") } queryInput := &dynamodb.QueryInput{ TableName: aws.String(t.name()), IndexName: aws.String("endDate"), ExpressionAttributeNames: map[string]*string{ "#ENDDATE": aws.String("endDate"), }, ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{ ":endDate": &dynamodb.AttributeValue{ S: aws.String(toDynamoTimeString(input.EndDate)), }, }, ScanIndexForward: aws.Bool(!input.Descending), ConsistentRead: aws.Bool(false), }
make build
make generate
/VERSION
ThingWithDatetimeGSI
@tnsardesai I'm using a datetime for the HASH key
Jira
https://clever.atlassian.net/browse/DD-5016
Overview
~1. Fix import for dynamodb - should only be imported in dynamodb.go when there are transactions~
datetime
HASH
keys on GSIsCurrently code gen for date-time
HASH
keys for GSI's doesn't properly convertstrfmt.Datetime
tostrings
in the generated getBy{GSI} functions.Example
here
input.endDate
has typestrfmt.Date
, which should be converted to a stringBefore
After
make build
make generate
/VERSION
file.Testing
ThingWithDatetimeGSI
make generate
on a service I'm using this on. https://github.com/Clever/order-service/compare/master...subscriptions-model