Documentation ¶
Index ¶
- Variables
- type BatchGetItemExpectation
- type BatchWriteItemExpectation
- type CreateTableExpectation
- type DeleteItemExpectation
- type DescribeTableExpectation
- type DynaMock
- func (e *DynaMock) ExpectBatchGetItem() *BatchGetItemExpectation
- func (e *DynaMock) ExpectBatchWriteItem() *BatchWriteItemExpectation
- func (e *DynaMock) ExpectCreateTable() *CreateTableExpectation
- func (e *DynaMock) ExpectDeleteItem() *DeleteItemExpectation
- func (e *DynaMock) ExpectDescribeTable() *DescribeTableExpectation
- func (e *DynaMock) ExpectGetItem() *GetItemExpectation
- func (e *DynaMock) ExpectPutItem() *PutItemExpectation
- func (e *DynaMock) ExpectQuery() *QueryExpectation
- func (e *DynaMock) ExpectScan() *ScanExpectation
- func (e *DynaMock) ExpectUpdateItem() *UpdateItemExpectation
- func (e *DynaMock) ExpectWaitTableExist() *WaitTableExistExpectation
- type GetItemExpectation
- type MockDynamoDB
- func (e *MockDynamoDB) BatchGetItemRequest(input *dynamodb.BatchGetItemInput) dynamodb.BatchGetItemRequest
- func (e *MockDynamoDB) BatchWriteItemRequest(input *dynamodb.BatchWriteItemInput) dynamodb.BatchWriteItemRequest
- func (e *MockDynamoDB) CreateTableRequest(input *dynamodb.CreateTableInput) dynamodb.CreateTableRequest
- func (e *MockDynamoDB) DeleteItemRequest(input *dynamodb.DeleteItemInput) dynamodb.DeleteItemRequest
- func (e *MockDynamoDB) DescribeTableRequest(input *dynamodb.DescribeTableInput) dynamodb.DescribeTableRequest
- func (e *MockDynamoDB) GetItemRequest(input *dynamodb.GetItemInput) dynamodb.GetItemRequest
- func (e *MockDynamoDB) PutItemRequest(input *dynamodb.PutItemInput) dynamodb.PutItemRequest
- func (e *MockDynamoDB) QueryRequest(input *dynamodb.QueryInput) dynamodb.QueryRequest
- func (e *MockDynamoDB) ScanRequest(input *dynamodb.ScanInput) dynamodb.ScanRequest
- func (e *MockDynamoDB) UpdateItemRequest(input *dynamodb.UpdateItemInput) dynamodb.UpdateItemRequest
- func (e *MockDynamoDB) WaitUntilTableExists(ctx context.Context, input *dynamodb.DescribeTableInput, ...) error
- type PutItemExpectation
- type QueryExpectation
- type ScanExpectation
- type UpdateItemExpectation
- func (e *UpdateItemExpectation) Table(table string) *UpdateItemExpectation
- func (e *UpdateItemExpectation) Updates(attrs map[string]dynamodb.AttributeValueUpdate) *UpdateItemExpectation
- func (e *UpdateItemExpectation) WillReturn(res dynamodb.UpdateItemResponse) *UpdateItemExpectation
- func (e *UpdateItemExpectation) WithKeys(keys map[string]dynamodb.AttributeValue) *UpdateItemExpectation
- type WaitTableExistExpectation
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidInput = errors.New("invalid input") ErrNoExpectation = errors.New("expectations not found") ErrNoTable = errors.New("expectations table not found") ErrNoKey = errors.New("expectations key not found") ErrNoItem = errors.New("expectations item not found") ErrTableExpectationMismatch = errors.New("expected table was not matched") ErrKeyExpectationMismatch = errors.New("expected key was not matched") ErrItemExpectationMismatch = errors.New("expected item was not matched") )
Functions ¶
This section is empty.
Types ¶
type BatchGetItemExpectation ¶
type BatchGetItemExpectation struct {
// contains filtered or unexported fields
}
BatchGetItemExpectation struct hold expectation field, err, and result
func (*BatchGetItemExpectation) WillReturn ¶
func (e *BatchGetItemExpectation) WillReturn(res dynamodb.BatchGetItemResponse) *BatchGetItemExpectation
WillReturn - method for set desired result
func (*BatchGetItemExpectation) WithRequest ¶
func (e *BatchGetItemExpectation) WithRequest(input map[string]dynamodb.KeysAndAttributes) *BatchGetItemExpectation
WithRequest - method for set Request expectation
type BatchWriteItemExpectation ¶
type BatchWriteItemExpectation struct {
// contains filtered or unexported fields
}
BatchWriteItemExpectation struct hold expectation field, err, and result
func (*BatchWriteItemExpectation) WillReturn ¶
func (e *BatchWriteItemExpectation) WillReturn(res dynamodb.BatchWriteItemResponse) *BatchWriteItemExpectation
WillReturns - method for set desired result
func (*BatchWriteItemExpectation) WithRequest ¶
func (e *BatchWriteItemExpectation) WithRequest(input map[string][]dynamodb.WriteRequest) *BatchWriteItemExpectation
WithRequest - method for set Request expectation
type CreateTableExpectation ¶
type CreateTableExpectation struct {
// contains filtered or unexported fields
}
CreateTableExpectation struct hold expectation field, err, and result
func (*CreateTableExpectation) KeySchema ¶
func (e *CreateTableExpectation) KeySchema(keySchema []dynamodb.KeySchemaElement) *CreateTableExpectation
KeySchema - method for set KeySchema expectation
func (*CreateTableExpectation) Name ¶
func (e *CreateTableExpectation) Name(table string) *CreateTableExpectation
Name - method for set Name expectation
func (*CreateTableExpectation) WillReturn ¶
func (e *CreateTableExpectation) WillReturn(res dynamodb.CreateTableResponse) *CreateTableExpectation
WillReturn - method for set desired result
type DeleteItemExpectation ¶
type DeleteItemExpectation struct {
// contains filtered or unexported fields
}
DeleteItemExpectation struct hold expectation field, err, and result
func (*DeleteItemExpectation) Table ¶
func (e *DeleteItemExpectation) Table(table string) *DeleteItemExpectation
Table - method for set Table expectation
func (*DeleteItemExpectation) WillReturn ¶
func (e *DeleteItemExpectation) WillReturn(res dynamodb.DeleteItemResponse) *DeleteItemExpectation
WillReturn - method for set desired result
func (*DeleteItemExpectation) WithKeys ¶
func (e *DeleteItemExpectation) WithKeys(keys map[string]dynamodb.AttributeValue) *DeleteItemExpectation
WithKeys - method for set Keys expectation
type DescribeTableExpectation ¶
type DescribeTableExpectation struct {
// contains filtered or unexported fields
}
DescribeTableExpectation struct hold expectation field, err, and result
func (*DescribeTableExpectation) Table ¶
func (e *DescribeTableExpectation) Table(table string) *DescribeTableExpectation
Table - method for set Table expectation
func (*DescribeTableExpectation) WillReturn ¶
func (e *DescribeTableExpectation) WillReturn(res dynamodb.DescribeTableResponse) *DescribeTableExpectation
WillReturn - method for set desired result
type DynaMock ¶
type DynaMock struct { GetItemExpect []*GetItemExpectation BatchGetItemExpect []*BatchGetItemExpectation UpdateItemExpect []*UpdateItemExpectation PutItemExpect []*PutItemExpectation DeleteItemExpect []*DeleteItemExpectation BatchWriteItemExpect []*BatchWriteItemExpectation CreateTableExpect []*CreateTableExpectation DescribeTableExpect []*DescribeTableExpectation WaitTableExistExpect []*WaitTableExistExpectation ScanExpect []*ScanExpectation QueryExpect []*QueryExpectation }
DynaMock mock struct hold all expectation types
func New ¶
func New() (dynamodbiface.ClientAPI, *DynaMock)
New - constructor for mock instantiation Return : 1st => DynamoDBAPI implementation, used to inject app object
2nd => mock object, used to set expectation and desired result
func (*DynaMock) ExpectBatchGetItem ¶
func (e *DynaMock) ExpectBatchGetItem() *BatchGetItemExpectation
ExpectBatchGetItem - method to start do expectation
func (*DynaMock) ExpectBatchWriteItem ¶
func (e *DynaMock) ExpectBatchWriteItem() *BatchWriteItemExpectation
ExpectBatchWriteItem - method to start do expectation
func (*DynaMock) ExpectCreateTable ¶
func (e *DynaMock) ExpectCreateTable() *CreateTableExpectation
ExpectCreateTable - method to start do expectation
func (*DynaMock) ExpectDeleteItem ¶
func (e *DynaMock) ExpectDeleteItem() *DeleteItemExpectation
ExpectDeleteItem - method to start do expectation
func (*DynaMock) ExpectDescribeTable ¶
func (e *DynaMock) ExpectDescribeTable() *DescribeTableExpectation
ExpectDescribeTable - method to start do expectation
func (*DynaMock) ExpectGetItem ¶
func (e *DynaMock) ExpectGetItem() *GetItemExpectation
ExpectGetItem - method to start do expectation
func (*DynaMock) ExpectPutItem ¶
func (e *DynaMock) ExpectPutItem() *PutItemExpectation
ExpectPutItem - method to start do expectation
func (*DynaMock) ExpectQuery ¶
func (e *DynaMock) ExpectQuery() *QueryExpectation
ExpectQuery - method to start do expectation
func (*DynaMock) ExpectScan ¶
func (e *DynaMock) ExpectScan() *ScanExpectation
ExpectScan - method to start do expectation
func (*DynaMock) ExpectUpdateItem ¶
func (e *DynaMock) ExpectUpdateItem() *UpdateItemExpectation
ExpectUpdateItem - method to start do expectation
func (*DynaMock) ExpectWaitTableExist ¶
func (e *DynaMock) ExpectWaitTableExist() *WaitTableExistExpectation
ExpectWaitTableExist - method to start do expectation
type GetItemExpectation ¶
type GetItemExpectation struct {
// contains filtered or unexported fields
}
GetItemExpectation struct hold expectation field, err, and result
func (*GetItemExpectation) Table ¶
func (e *GetItemExpectation) Table(table string) *GetItemExpectation
Table - method for set Table expectation
func (*GetItemExpectation) WillReturn ¶
func (e *GetItemExpectation) WillReturn(res dynamodb.GetItemResponse) *GetItemExpectation
WillReturn - method for set desired result
func (*GetItemExpectation) WithKeys ¶
func (e *GetItemExpectation) WithKeys(keys map[string]dynamodb.AttributeValue) *GetItemExpectation
WithKeys - method for set Keys expectation
type MockDynamoDB ¶
type MockDynamoDB struct { dynamodbiface.ClientAPI // contains filtered or unexported fields }
MockDynamoDB struct hold DynamoDBAPI implementation and mock object
func (*MockDynamoDB) BatchGetItemRequest ¶
func (e *MockDynamoDB) BatchGetItemRequest(input *dynamodb.BatchGetItemInput) dynamodb.BatchGetItemRequest
BatchGetItemRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) BatchWriteItemRequest ¶
func (e *MockDynamoDB) BatchWriteItemRequest(input *dynamodb.BatchWriteItemInput) dynamodb.BatchWriteItemRequest
BatchWriteItemRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) CreateTableRequest ¶
func (e *MockDynamoDB) CreateTableRequest(input *dynamodb.CreateTableInput) dynamodb.CreateTableRequest
CreateTableRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) DeleteItemRequest ¶
func (e *MockDynamoDB) DeleteItemRequest(input *dynamodb.DeleteItemInput) dynamodb.DeleteItemRequest
DeleteItemRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) DescribeTableRequest ¶
func (e *MockDynamoDB) DescribeTableRequest(input *dynamodb.DescribeTableInput) dynamodb.DescribeTableRequest
DescribeTableRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) GetItemRequest ¶
func (e *MockDynamoDB) GetItemRequest(input *dynamodb.GetItemInput) dynamodb.GetItemRequest
GetItemRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) PutItemRequest ¶
func (e *MockDynamoDB) PutItemRequest(input *dynamodb.PutItemInput) dynamodb.PutItemRequest
PutItemRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) QueryRequest ¶
func (e *MockDynamoDB) QueryRequest(input *dynamodb.QueryInput) dynamodb.QueryRequest
QueryRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) ScanRequest ¶
func (e *MockDynamoDB) ScanRequest(input *dynamodb.ScanInput) dynamodb.ScanRequest
ScanRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) UpdateItemRequest ¶
func (e *MockDynamoDB) UpdateItemRequest(input *dynamodb.UpdateItemInput) dynamodb.UpdateItemRequest
UpdateItemRequest - this func will be invoked when test running matching expectation with actual input
func (*MockDynamoDB) WaitUntilTableExists ¶
func (e *MockDynamoDB) WaitUntilTableExists(ctx context.Context, input *dynamodb.DescribeTableInput, opt ...aws.WaiterOption) error
WaitUntilTableExists - this func will be invoked when test running matching expectation with actual input
type PutItemExpectation ¶
type PutItemExpectation struct {
// contains filtered or unexported fields
}
PutItemExpectation struct hold expectation field, err, and result
func (*PutItemExpectation) Table ¶
func (e *PutItemExpectation) Table(table string) *PutItemExpectation
Table - method for set Table expectation
func (*PutItemExpectation) WillReturn ¶
func (e *PutItemExpectation) WillReturn(res dynamodb.PutItemResponse) *PutItemExpectation
WillReturn - method for set desired result
func (*PutItemExpectation) WithItems ¶
func (e *PutItemExpectation) WithItems(item map[string]dynamodb.AttributeValue) *PutItemExpectation
WithItems - method for set Items expectation
type QueryExpectation ¶
type QueryExpectation struct {
// contains filtered or unexported fields
}
QueryExpectation struct hold expectation field, err, and result
func (*QueryExpectation) Table ¶
func (e *QueryExpectation) Table(table string) *QueryExpectation
Table - method for set Table expectation
func (*QueryExpectation) WillReturn ¶
func (e *QueryExpectation) WillReturn(res dynamodb.QueryResponse) *QueryExpectation
WillReturn - method for set desired result
type ScanExpectation ¶
type ScanExpectation struct {
// contains filtered or unexported fields
}
ScanExpectation struct hold expectation field, err, and result
func (*ScanExpectation) Table ¶
func (e *ScanExpectation) Table(table string) *ScanExpectation
Table - method for set Table expectation
func (*ScanExpectation) WillReturn ¶
func (e *ScanExpectation) WillReturn(res dynamodb.ScanResponse) *ScanExpectation
WillReturn - method for set desired result
type UpdateItemExpectation ¶
type UpdateItemExpectation struct {
// contains filtered or unexported fields
}
UpdateItemExpectation struct hold expectation field, err, and result
func (*UpdateItemExpectation) Table ¶
func (e *UpdateItemExpectation) Table(table string) *UpdateItemExpectation
Table - method for set Table expectation
func (*UpdateItemExpectation) Updates ¶
func (e *UpdateItemExpectation) Updates(attrs map[string]dynamodb.AttributeValueUpdate) *UpdateItemExpectation
Updates - method for set Updates expectation
func (*UpdateItemExpectation) WillReturn ¶
func (e *UpdateItemExpectation) WillReturn(res dynamodb.UpdateItemResponse) *UpdateItemExpectation
WillReturn - method for set desired result
func (*UpdateItemExpectation) WithKeys ¶
func (e *UpdateItemExpectation) WithKeys(keys map[string]dynamodb.AttributeValue) *UpdateItemExpectation
WithKeys - method for set Keys expectation
type WaitTableExistExpectation ¶
type WaitTableExistExpectation struct {
// contains filtered or unexported fields
}
WaitTableExistExpectation struct hold expectation field, err, and result
func (*WaitTableExistExpectation) Table ¶
func (e *WaitTableExistExpectation) Table(table string) *WaitTableExistExpectation
Table - method for set Table expectation
func (*WaitTableExistExpectation) WillReturn ¶
func (e *WaitTableExistExpectation) WillReturn(err error) *WaitTableExistExpectation
WillReturn - method for set desired result