dbtest

package module
v0.0.0-...-d0b8ee3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2023 License: MIT Imports: 10 Imported by: 0

README

dbtest

Database testing made easy in Go.

Features

  1. Declarative

    Define the minimum test specification in a YAML-based DSL, then all tests can be generated automatically.

  2. Customizable

    You can specify your own Go template when generating tests.

  3. Opinionated

Installation

Make a custom build of protogo:

$ protogo build --plugin=github.com/protogodev/dbtest

Or build from a local fork:

$ protogo build --plugin=github.com/protogodev/dbtest=../my-fork
Usage
$ protogo dbtest -h
Usage: protogo dbtest <source-file> <interface-name>

Arguments:
  <source-file>       source-file
  <interface-name>    interface-name

Flags:
  -h, --help                         Show context-sensitive help.

      --out=STRING                   output filename (default "./<srcPkgName>_test.go")
      --fmt                          whether to make the test code formatted
      --spec="./dbtest.spec.yaml"    the test specification in YAML
      --tmpl=STRING                  the template to render (default to builtin template)

Examples

See examples.

Documentation

Check out the Godoc.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	OutFileName      string `name:"out" help:"output filename (default \"./<srcPkgName>_test.go\")"`
	Formatted        bool   `name:"fmt" default:"true" help:"whether to make the test code formatted"`
	TestSpecFileName string `name:"spec" default:"./dbtest.spec.yaml" help:"the test specification in YAML"`
	TemplateFileName string `name:"tmpl" help:"the template to render (default to builtin template)"`
}

func (*Generator) Generate

func (g *Generator) Generate(data *ifacetool.Data) (*generator.File, error)

func (*Generator) PkgName

func (g *Generator) PkgName() string

Directories

Path Synopsis
sql

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL