playground/README.md

47 lines
2.0 KiB
Markdown
Raw Normal View History

2020-12-14 02:35:42 +00:00
# GORM Playground
2020-06-24 03:42:22 +00:00
2020-12-14 02:35:42 +00:00
GORM Playground can be used to play GORM and reports issues, if you encounter a bug in GORM, please report it at [https://github.com/go-gorm/gorm/issues](https://github.com/go-gorm/gorm/issues) with the Playground Pull Request's link
2020-06-24 03:42:22 +00:00
2020-06-24 04:36:31 +00:00
[![test status](https://github.com/go-gorm/playground/workflows/tests/badge.svg?branch=master "test status")](https://github.com/go-gorm/playground/actions)
2020-12-14 02:35:42 +00:00
### Quick Start
2020-06-24 03:42:22 +00:00
2020-12-14 02:35:42 +00:00
##### 1. [Fork this repo](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo)
2020-06-24 03:42:22 +00:00
2020-12-14 02:35:42 +00:00
##### 2. [Clone the forked repo to your local](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository)
2020-06-24 03:42:22 +00:00
2022-10-09 08:10:24 +00:00
##### 3. Install docker-compose
2020-06-24 03:42:22 +00:00
2022-10-09 08:10:24 +00:00
https://docs.docker.com/compose/install/
2020-06-24 04:09:43 +00:00
2020-12-14 02:35:42 +00:00
##### 4. Run tests with lastest GORM and all drivers
2020-12-14 02:35:42 +00:00
```bash
2022-10-09 08:10:24 +00:00
# run tests (retry if failed due to preparing the testing database)
2020-12-14 02:35:42 +00:00
./test.sh
2020-12-14 02:35:42 +00:00
# Run tests with cached GORM and latest drivers
GORM_ENABLE_CACHE=true ./test.sh
2020-12-14 02:35:42 +00:00
# Run tests with specfied database
GORM_DIALECT=mysql go test
```
2020-06-24 03:42:22 +00:00
2020-12-14 02:35:42 +00:00
##### 5. Modify tests and make it fail
##### 6. [Create Playground Pull Request](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) and [Create a GORM issue](https://github.com/go-gorm/gorm/issues/new?template=bug_report.md) with the link
### Advanced Usage
We are using the following configuration run your code (GORM's latest master branch, latest database drivers: sqlite, mysql, postgres, sqlserver), you could change the configuration in file [main_test.go](https://github.com/go-gorm/playground/edit/master/main_test.go)
```go
// GORM_REPO: https://github.com/go-gorm/gorm.git
// GORM_BRANCH: master
// TEST_DRIVERS: sqlite, mysql, postgres, sqlserver
```
We have prepared some structs with relationships in [https://github.com/go-gorm/playground/blob/master/models.go](https://github.com/go-gorm/playground/blob/master/models.go) that you can use for your tests
2020-06-24 03:42:22 +00:00
## Happy Hacking!