Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/go-rel/reltest
Database unit testing for Golang
https://github.com/go-rel/reltest
golang hacktoberfest orm testing
Last synced: 8 days ago
JSON representation
Database unit testing for Golang
- Host: GitHub
- URL: https://github.com/go-rel/reltest
- Owner: go-rel
- License: mit
- Created: 2021-08-21T11:15:24.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-02T05:05:02.000Z (5 months ago)
- Last Synced: 2024-10-29T16:20:42.785Z (17 days ago)
- Topics: golang, hacktoberfest, orm, testing
- Language: Go
- Homepage:
- Size: 145 KB
- Stars: 1
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# reltest
[![GoDoc](https://godoc.org/github.com/go-rel/reltest?status.svg)](https://pkg.go.dev/github.com/go-rel/reltest)
[![Test](https://github.com/go-rel/reltest/actions/workflows/test.yml/badge.svg)](https://github.com/go-rel/reltest/actions/workflows/test.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-rel/reltest)](https://goreportcard.com/report/github.com/go-rel/reltest)
[![codecov](https://codecov.io/gh/go-rel/reltest/branch/main/graph/badge.svg?token=vxG9e5nJ3R)](https://codecov.io/gh/go-rel/reltest)
[![Gitter chat](https://badges.gitter.im/go-rel/rel.png)](https://gitter.im/go-rel/rel)Database unit testing for Golang.
## Example
```go
package mainimport (
"context"
"fmt""github.com/go-rel/rel/where"
"github.com/go-rel/reltest"
)type Movie struct {
ID int
Title string
}func main() {
var (
repo = reltest.New()
)// Mock query
repo.ExpectFind(where.Eq("id", 1)).Result(Movie{ID: 1, Title: "Golang"})// Application code
var movie Movie
repo.MustFind(context.Background(), &movie, where.Eq("id", 1))
fmt.Println(movie.Title)
// Output: Golang
}
```**More Examples:**
- [gin-example](https://github.com/go-rel/gin-example) - Todo Backend using Gin and REL
- [go-todo-backend](https://github.com/Fs02/go-todo-backend) - Todo Backend using Chi and REL## License
Released under the [MIT License](https://github.com/go-rel/reltest/blob/master/LICENSE)