{"id":15323705,"url":"https://github.com/mvrilo/go-example-repo-mock","last_synced_at":"2025-07-13T16:39:46.754Z","repository":{"id":58414087,"uuid":"526600006","full_name":"mvrilo/go-example-repo-mock","owner":"mvrilo","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-11T17:03:08.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T19:02:13.904Z","etag":null,"topics":["example","go","go-sqlmock","golang","mock","model","repository-pattern","tests","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mvrilo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-19T12:33:21.000Z","updated_at":"2022-08-22T18:07:42.000Z","dependencies_parsed_at":"2023-01-18T04:01:17.070Z","dependency_job_id":null,"html_url":"https://github.com/mvrilo/go-example-repo-mock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Fgo-example-repo-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Fgo-example-repo-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Fgo-example-repo-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Fgo-example-repo-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvrilo","download_url":"https://codeload.github.com/mvrilo/go-example-repo-mock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245864213,"owners_count":20684986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["example","go","go-sqlmock","golang","mock","model","repository-pattern","tests","unit-testing"],"created_at":"2024-10-01T09:21:09.826Z","updated_at":"2025-03-27T14:42:20.803Z","avatar_url":"https://github.com/mvrilo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## go-example-repo-mock\n\n[![CI](https://github.com/mvrilo/go-example-repo-mock/actions/workflows/ci.yaml/badge.svg)](https://github.com/mvrilo/go-example-repo-mock/actions/workflows/ci.yaml)\n\nExample of application (data storage layer only) for a `User` domain-scoped service using Go, repository pattern for data access and mysql as its implementation, github actions for ci and unit tests using `testify/suite` and `go-sqlmock`.\n\nFor a \"model-only\" package/architecture, head to [this branch](https://github.com/mvrilo/go-example-repo-mock/tree/model).\n\n### Architecture:\n\n- `entity`\ndata structures mapping to the database schema and other domain data, e.g. definition of user, custom errors, etc\n\n- `repository`\ndefinition and implementation of storage access behavior, e.g. get data, save data, etc\n\n- `mock`\ndata mocking for each repository implementation, e.g. fake sql results\n\n### Testing\n\n`make`\n\n### Project structure\n\n```\n.\n├── Makefile\n├── README.md\n├── go.mod\n├── go.sum\n├── mock                   # mock definitions\n│   └── mysql              # by repository implementation\n│       └── user.go\n├── entity                 # domain/database entity definitions\n│   └── user.go\n└── repository             # repository interface\n    ├── mysql              # and implementation\n    │   ├── user.go\n    │   └── user_test.go   # unit tests\n    └── repository.go\n\n5 directories, 9 files\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvrilo%2Fgo-example-repo-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvrilo%2Fgo-example-repo-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvrilo%2Fgo-example-repo-mock/lists"}