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

[TransactWriteItems] Table equality check to use pointers to avoid false-negative #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Muhammad Auliya
Copyright (c) 2018 Flavio Deroo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Forked from https://github.com/gusaul/go-dynamock

[![GoDoc](https://godoc.org/github.com/gusaul/go-dynamock?status.png)](https://godoc.org/github.com/gusaul/go-dynamock) [![Go Report Card](https://goreportcard.com/badge/github.com/gusaul/go-dynamock)](https://goreportcard.com/report/github.com/gusaul/go-dynamock) [![Build Status](https://travis-ci.com/gusaul/go-dynamock.svg?branch=master)](https://travis-ci.com/gusaul/go-dynamock)
# go-dynamock
Amazon Dynamo DB Mock Driver for Golang to Test Database Interactions

## Install
```
go get github.com/gusaul/go-dynamock
go get github.com/cgstag/go-dynamock
```

## Examples Usage
Expand Down Expand Up @@ -75,7 +77,7 @@ import (

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/dynamodb"
dynamock "github.com/gusaul/go-dynamock"
dynamock "github.com/cgstag/go-dynamock"
)

var mock *dynamock.DynaMock
Expand Down Expand Up @@ -163,4 +165,4 @@ and will be treated cautiously

## License

The [MIT License](https://github.com/gusaul/go-dynamock/blob/master/LICENSE)
The [MIT License](https://github.com/cgstag/go-dynamock/blob/master/LICENSE)
2 changes: 1 addition & 1 deletion examples/example_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package examples

import (
dynamock "github.com/gusaul/go-dynamock"
dynamock "github.com/cgstag/go-dynamock"
"testing"

"github.com/aws/aws-sdk-go/aws"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/gusaul/go-dynamock
module github.com/cgstag/go-dynamock

go 1.15

Expand Down
6 changes: 3 additions & 3 deletions transact_write_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func (e *MockDynamoDB) TransactWriteItems(input *dynamodb.TransactWriteItemsInpu
for i, item := range input.TransactItems {
// comapre table name for each write transact item with `x.table`
if x.table != nil {
if (item.Update != nil && x.table != item.Update.TableName) ||
(item.Put != nil && x.table != item.Put.TableName) ||
(item.Delete != nil && x.table != item.Delete.TableName) {
if (item.Update != nil && *x.table != *item.Update.TableName) ||
(item.Put != nil && *x.table != *item.Put.TableName) ||
(item.Delete != nil && *x.table != *item.Delete.TableName) {
return &dynamodb.TransactWriteItemsOutput{}, fmt.Errorf("Expect table %s not found", *x.table)
}
}
Expand Down