Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moemoe89/go-unit-test-sql
๐งช Mock SQL Test for Redis in Golang for my Medium story material
https://github.com/moemoe89/go-unit-test-sql
go golang mock mysql postgresql unit-testing
Last synced: about 2 hours ago
JSON representation
๐งช Mock SQL Test for Redis in Golang for my Medium story material
- Host: GitHub
- URL: https://github.com/moemoe89/go-unit-test-sql
- Owner: moemoe89
- License: mit
- Created: 2020-06-19T08:32:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-19T09:00:47.000Z (over 4 years ago)
- Last Synced: 2024-06-19T05:40:57.945Z (5 months ago)
- Topics: go, golang, mock, mysql, postgresql, unit-testing
- Language: Go
- Homepage: https://medium.com/@bismobaruno/5af19075e68e
- Size: 5.86 KB
- Stars: 23
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![CircleCI](https://circleci.com/gh/moemoe89/go-unit-test-sql.svg?style=svg)](https://circleci.com/gh/moemoe89/go-unit-test-sql)
[![codecov](https://codecov.io/gh/moemoe89/go-unit-test-sql/branch/master/graph/badge.svg)](https://codecov.io/gh/moemoe89/go-unit-test-sql)
[![Go Report Card](https://goreportcard.com/badge/github.com/moemoe89/go-unit-test-sql)](https://goreportcard.com/report/github.com/moemoe89/go-unit-test-sql)# GO-UNIT-TEST-SQL #
Example Mock Unit Test for SQL in Golang
## Directory structure
Your project directory structure should look like this
```
+ your_gopath/
|
+--+ src/github.com/moemoe89
| |
| +--+ go-unit-test-sql/
| |
| +--+ main.go
| + repository/
| |
| +--+ repository.go
| |
| +--+ mysql
| | |
| | +--+ mysql.go
| | + mysql_test.go
| |
| +--+ postgres
| |
| +--+ postgres.go
| + postgres_test.go
|
+--+ bin/
| |
| +-- ... executable file
|
+--+ pkg/
|
+-- ... all dependency_library required```
## Setup
* Setup Golang
* Setup Docker
* Under `$GOPATH`, do the following command :
```
$ mkdir -p src/github.com/moemoe89
$ cd src/github.com/moemoe89
$ git clone
$ mv go-unit-test-sql
```## How to Run Test
```
$ go test ./...
```## License
MIT