Sparta
Sparta copied to clipboard
Support Custom ScanInput/QueryInput with Accessor.DynamoAccessor
Is there a way to pass in our own custom QueryInput or ScanInput to be used with the Accessor.DynamoAccessor or would it be possible to add this functionality?
Basically something like this:
func (svc *DynamoAccessor) Query(ctx context.Context,
customInput *dynamodb.QueryInput // pass in customized QueryInput
destObject interface{}) error {
queryInput := customInput // assign customized QueryInput
queryResult, queryResultErr := svc.dynamoSvc(ctx).QueryWithContext(ctx, queryInput)
if queryResultErr != nil {
return queryResultErr
}
return dynamodbattribute.UnmarshalMap(queryResult, destObject)
}
Hi @Caoimhin89 - that seems like a very reasonable thing to add to a general DynamoDB wrapper. The accessor that's in Sparta is currently limited to a KeyValueAccessor pattern. If we added a Query
function I'm not sure that would apply to all the providers. WDYT about embedding the base accessor and extending with the new functionality?
@mweagle That makes sense.