{"id":13397116,"url":"https://github.com/gusaul/go-dynamock","last_synced_at":"2026-01-24T16:56:37.714Z","repository":{"id":19828550,"uuid":"88024193","full_name":"gusaul/go-dynamock","owner":"gusaul","description":"Amazon Dynamo DB Mock Driver for Golang to Test Database Interactions","archived":false,"fork":false,"pushed_at":"2022-07-26T04:05:07.000Z","size":76,"stargazers_count":115,"open_issues_count":15,"forks_count":50,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T18:19:03.430Z","etag":null,"topics":["dynamodb","go","golang","mock","nosql","tdd","testing"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gusaul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-12T07:44:58.000Z","updated_at":"2024-05-26T06:57:55.000Z","dependencies_parsed_at":"2022-08-07T09:15:39.343Z","dependency_job_id":null,"html_url":"https://github.com/gusaul/go-dynamock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gusaul/go-dynamock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusaul%2Fgo-dynamock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusaul%2Fgo-dynamock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusaul%2Fgo-dynamock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusaul%2Fgo-dynamock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gusaul","download_url":"https://codeload.github.com/gusaul/go-dynamock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusaul%2Fgo-dynamock/sbom","scorecard":{"id":449913,"data":{"date":"2025-08-11","repo":{"name":"github.com/gusaul/go-dynamock","commit":"3e989056e1e6f90e8333708f7e9eebea2856f5b2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0635","Warn: Project is vulnerable to: GO-2022-0646"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T07:57:01.917Z","repository_id":19828550,"created_at":"2025-08-19T07:57:01.917Z","updated_at":"2025-08-19T07:57:01.917Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28732209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dynamodb","go","golang","mock","nosql","tdd","testing"],"created_at":"2024-07-30T18:01:11.178Z","updated_at":"2026-01-24T16:56:37.696Z","avatar_url":"https://github.com/gusaul.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![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)\n# go-dynamock\nAmazon Dynamo DB Mock Driver for Golang to Test Database Interactions\n\n## Install\n```\ngo get github.com/gusaul/go-dynamock\n```\n\n## Examples Usage\nVisit [godoc](https://godoc.org/github.com/gusaul/go-dynamock) for general examples and public api reference.\n\n### DynamoDB configuration\nFirst of all, change the dynamodb configuration to use the ***dynamodb interface***. see code below:\n``` go\npackage main\n\nimport (\n    \"github.com/aws/aws-sdk-go/aws\"\n    \"github.com/aws/aws-sdk-go/aws/session\"\n    \"github.com/aws/aws-sdk-go/service/dynamodb\"\n    \"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface\"\n)\n\ntype MyDynamo struct {\n    Db dynamodbiface.DynamoDBAPI\n}\n\nvar Dyna *MyDynamo\n\nfunc ConfigureDynamoDB() {\n\tDyna = new(MyDynamo)\n\tawsSession, _ := session.NewSession(\u0026aws.Config{Region: aws.String(\"ap-southeast-2\")})\n\tsvc := dynamodb.New(awsSession)\n\tDyna.Db = dynamodbiface.DynamoDBAPI(svc)\n}\n```\nthe purpose of code above is to make your dynamoDB object can be mocked by ***dynamock*** through the dynamodbiface.\n\n### Something you may wanna test\n``` go\npackage main\n\nimport (\n    \"github.com/aws/aws-sdk-go/aws\"\n    \"github.com/aws/aws-sdk-go/service/dynamodb\"\n)\n\nfunc GetName(id string) (*string, error) {\n\tparameter := \u0026dynamodb.GetItemInput{\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\"id\": {\n\t\t\t\tN: aws.String(id),\n\t\t\t},\n\t\t},\n\t\tTableName: aws.String(\"employee\"),\n\t}\n\n\tresponse, err := Dyna.Db.GetItem(parameter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tname := response.Item[\"name\"].S\n\treturn name, nil\n}\n```\n\n### Test with DynaMock\n``` go\npackage examples\n\nimport (\n\t\"testing\"\n\n\t\"github.com/aws/aws-sdk-go/aws\"\n\t\"github.com/aws/aws-sdk-go/service/dynamodb\"\n\tdynamock \"github.com/gusaul/go-dynamock\"\n)\n\nvar mock *dynamock.DynaMock\n\nfunc init() {\n\tDyna = new(MyDynamo)\n\tDyna.Db, mock = dynamock.New()\n}\n\nfunc TestGetName(t *testing.T) {\n\texpectKey := map[string]*dynamodb.AttributeValue{\n\t\t\"id\": {\n\t\t\tN: aws.String(\"1\"),\n\t\t},\n\t}\n\n\texpectedResult := aws.String(\"jaka\")\n\tresult := dynamodb.GetItemOutput{\n\t\tItem: map[string]*dynamodb.AttributeValue{\n\t\t\t\"name\": {\n\t\t\t\tS: expectedResult,\n\t\t\t},\n\t\t},\n\t}\n\n\t//lets start dynamock in action\n\tmock.ExpectGetItem().ToTable(\"employee\").WithKeys(expectKey).WillReturns(result)\n\n\tactualResult, _ := GetName(\"1\")\n\tif actualResult != expectedResult {\n\t\tt.Errorf(\"Test Fail\")\n\t}\n}\n```\nif you just wanna expect the table\n``` go\nmock.ExpectGetItem().ToTable(\"employee\").WillReturns(result)\n```\nor maybe you didn't care with any arguments, you just need to determine the result\n``` go\nmock.ExpectGetItem().WillReturns(result)\n```\nand you can do multiple expectations at once, then the expectation will be executed sequentially.\n``` go\nmock.ExpectGetItem().WillReturns(resultOne)\nmock.ExpectUpdateItem().WillReturns(resultTwo)\nmock.ExpectGetItem().WillReturns(resultThree)\n\n/* Result\nthe first call of GetItem will return resultOne\nthe second call of GetItem will return resultThree\nand the only call of UpdateItem will return resultTwo */\n```\n### Currently Supported Functions\n``` go\nCreateTable(*dynamodb.CreateTableInput) (*dynamodb.CreateTableOutput, error)\nDescribeTable(*dynamodb.DescribeTableInput) (*dynamodb.DescribeTableOutput, error)\nGetItem(*dynamodb.GetItemInput) (*dynamodb.GetItemOutput, error)\nGetItemWithContext(aws.Context, *dynamodb.GetItemInput, ...request.Option) (*dynamodb.GetItemOutput, error)\nPutItem(*dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error)\nPutItemWithContext(aws.Context, *dynamodb.PutItemInput, ...request.Option) (*dynamodb.PutItemOutput, error)\nUpdateItem(*dynamodb.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)\nUpdateItemWithContext(aws.Context, *dynamodb.UpdateItemInput, ...request.Option) (*dynamodb.UpdateItemOutput, error)\nDeleteItem(*dynamodb.DeleteItemInput) (*dynamodb.DeleteItemOutput, error)\nDeleteItemWithContext(aws.Context, *dynamodb.DeleteItemInput, ...request.Option) (*dynamodb.DeleteItemOutput, error)\nBatchGetItem(*dynamodb.BatchGetItemInput) (*dynamodb.BatchGetItemOutput, error)\nBatchGetItemWithContext(aws.Context, *dynamodb.BatchGetItemInput, ...request.Option) (*dynamodb.BatchGetItemOutput, error)\nBatchWriteItem(*dynamodb.BatchWriteItemInput) (*dynamodb.BatchWriteItemOutput, error)\nBatchWriteItemWithContext(aws.Context, *dynamodb.BatchWriteItemInput, ...request.Option) (*dynamodb.BatchWriteItemOutput, error)\nWaitUntilTableExists(*dynamodb.DescribeTableInput) error\nScan(input *dynamodb.ScanInput) (*dynamodb.ScanOutput, error)\nScanPages(input *ScanInput, fn func(*ScanOutput, bool) bool) error\nScanPagesWithContext(ctx aws.Context, input *ScanInput, fn func(*ScanOutput, bool) bool, opts ...request.Option) error\nScanWithContext(aws.Context, *dynamodb.ScanInput, ...request.Option) (*dynamodb.ScanOutput, error)\nQuery(input *dynamodb.QueryInput) (*dynamodb.QueryOutput, error)\nQueryWithContext(aws.Context, *dynamodb.QueryInput, request.Option) (*dynamodb.QueryOutput, error)\nQueryPages(*dynamodb.QueryInput, func(*dynamodb.QueryOutput, bool) bool) error\nQueryPagesWithContext(aws.Context, *dynamodb.QueryInput, func(*dynamodb.QueryOutput, bool) bool, ...request.Option) error\n```\n## Contributions\n\nFeel free to open a pull request. Note, if you wish to contribute an extension to public (exported methods or types) -\nplease open an issue before, to discuss whether these changes can be accepted. All backward incompatible changes are\nand will be treated cautiously\n\n## License\n\nThe [MIT License](https://github.com/gusaul/go-dynamock/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgusaul%2Fgo-dynamock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgusaul%2Fgo-dynamock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgusaul%2Fgo-dynamock/lists"}