sch1

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sch1 provides database schema major version 1 verification logic. This implementation may be instantiated indirectly using the github.com/momeni/clean-arch/internal/test/schema package.

Index

Constants

View Source
const (
	Major = stlmig1.Major
	Minor = stlmig1.Minor
	Patch = stlmig1.Patch
)

These constants present the relevant major, minor, and patch semantic versions of this schema verifier package. They are initialized based on the stlmig1 package because whenever a new minor version is released, the stlmig1 has to be updated based on it and this verifier needs to verify its updated changes too. Also, the stlmig1 constants are not used directly, so users of this package do not need to import it just for checking the provided semantic version components.

Variables

This section is empty.

Functions

This section is empty.

Types

type Verifier

type Verifier struct {
	// contains filtered or unexported fields
}

Verifier implements the schema major version 1 verification logic. It implements github.com/momeni/clean-arch/internal/test/schema.Verifier interface and wraps a database connection as noted in New function.

func New

func New(c repo.Conn) *Verifier

New instantiates a Verifier struct, wrapping the `c` database connection. Since Verifier fields are not exported, the New function is required for its initialization.

func (*Verifier) VerifyDevData

func (v *Verifier) VerifyDevData(ctx context.Context, t *testing.T)

VerifyDevData checks for presence of the development suitable initial data and marks possible issues using the `t` testing argument. Presence of extra rows is acceptable.

func (*Verifier) VerifyProdData

func (v *Verifier) VerifyProdData(ctx context.Context, t *testing.T)

VerifyProdData checks for presence of the production suitable initial data and marks possible issues using the `t` testing argument. Presence of extra rows is acceptable.

func (*Verifier) VerifySchema

func (v *Verifier) VerifySchema(ctx context.Context, t *testing.T)

VerifySchema uses the corresponding database connection of `v` in order to create and query temporary records in the database (e.g., in an uncommitted transaction), ensuring that the expected database schema with Major major version and Minor minor version is in place. If a more recent minor version was settled, this verification will pass too, so it is important to update this implementation whenever a new minor version is released. This process failures are reported using the `t` testing argument.

Jump to

Keyboard shortcuts

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