8000 GitHub - go-rel/reltest: Database unit testing for Golang
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

go-rel/reltest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reltest

GoDoc Test Go Report Card codecov Gitter chat

Database unit testing for Golang.

Example

package main

import (
	"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:

License

Released under the MIT License

About

Database unit testing for Golang

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 7

Languages

0