Created
June 27, 2021 14:28
-
-
Save reshefsharvit/9380bf54358df4021e41929d5a931355 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (m *DynamodbMockClient) GetItem(input *dynamodb.GetItemInput) ( | |
*dynamodb.GetItemOutput, | |
error, | |
) { | |
var err = errors.New("player not found") | |
val, ok := input.Key["PlayerName"] | |
if ok { | |
err = nil | |
switch *val.S { | |
case "Manu Ginobili": | |
return &dynamodb.GetItemOutput{ | |
Item: map[string]*dynamodb.AttributeValue{ | |
"PlayerName": {S: aws.String("Manu Ginobili")}, | |
"JerseyNumber": {N: aws.String("20")}, | |
"Position": {S: aws.String("Shooting Guard")}}}, nil | |
case "Tim Duncan": | |
return &dynamodb.GetItemOutput{ | |
Item: map[string]*dynamodb.AttributeValue{ | |
"PlayerName": {S: aws.String("Tim Duncan")}, | |
"JerseyNumber": {N: aws.String("21")}, | |
"Position": {S: aws.String("Power Forward")}}}, nil | |
} | |
} | |
return &dynamodb.GetItemOutput{}, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment