Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BatchWriteItemWithContext isn't implemented yet. #17

Closed
sdkim81 opened this issue Oct 8, 2019 · 3 comments
Closed

BatchWriteItemWithContext isn't implemented yet. #17

sdkim81 opened this issue Oct 8, 2019 · 3 comments

Comments

@sdkim81
Copy link

sdkim81 commented Oct 8, 2019

Hi all,

Dynamodb provides API which has 'WithContext' postfix.
This is for additional ability to pass a context and additional request parameter.

But there is no BatchWriteItemWithContext API in this project.

When I look over the other source code batch_get_item.go , both BatchGetItem and BatchGetItemWithContext have same body.

It seems to be pretty easy to add 'BatchWriteItemWithContext' which has same body of BatchWriteItem.

When I test with below code, it works well but I can't contribute to this project.

Will Somebody make PR for this?

func (e *MockDynamoDB) BatchWriteItemWithContext(ctx aws.Context, input *dynamodb.BatchWriteItemInput, opt ...request.Option) (*dynamodb.BatchWriteItemOutput, error) {
if len(e.dynaMock.BatchWriteItemExpect) > 0 {
x := e.dynaMock.BatchWriteItemExpect[0] //get first element of expectation

	if x.input != nil {
		if !reflect.DeepEqual(x.input, input.RequestItems) {
			return nil, fmt.Errorf("Expect input %+v but found input %+v", x.input, input.RequestItems)
		}
	}

	// delete first element of expectation
	e.dynaMock.BatchWriteItemExpect = append(e.dynaMock.BatchWriteItemExpect[:0], e.dynaMock.BatchWriteItemExpect[1:]...)

	return x.output, nil
}

return nil, fmt.Errorf("Batch Write Item Expectation Not Found")

}

@aultokped
Copy link
Contributor

please just create the PR

@sdkim81
Copy link
Author

sdkim81 commented Oct 8, 2019

#18

@gusaul
Copy link
Owner

gusaul commented Oct 8, 2019

merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants