specs

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package specs defines test specifications for rel's adapter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aggregate

func Aggregate(t *testing.T, repo rel.Repository)

Aggregate tests count specifications.

func CheckConstraint

func CheckConstraint(t *testing.T, repo rel.Repository)

CheckConstraint tests foreign key constraint specifications.

func Delete

func Delete(t *testing.T, repo rel.Repository)

Delete tests delete specifications.

func DeleteAll

func DeleteAll(t *testing.T, repo rel.Repository)

DeleteAll tests delete all specifications.

func DeleteBelongsTo added in v0.4.0

func DeleteBelongsTo(t *testing.T, repo rel.Repository)

DeleteBelongsTo tests delete specifications.

func DeleteHasMany added in v0.4.0

func DeleteHasMany(t *testing.T, repo rel.Repository)

DeleteHasMany tests delete specifications.

func DeleteHasOne added in v0.4.0

func DeleteHasOne(t *testing.T, repo rel.Repository)

DeleteHasOne tests delete specifications.

func ForeignKeyConstraint

func ForeignKeyConstraint(t *testing.T, repo rel.Repository)

ForeignKeyConstraint tests foreign key constraint specifications.

func Insert

func Insert(t *testing.T, repo rel.Repository)

Insert tests specification for database insertion.

func InsertAll

func InsertAll(t *testing.T, repo rel.Repository)

InsertAll tests insert multiple specifications.

func InsertAllPartialCustomPrimary added in v0.6.0

func InsertAllPartialCustomPrimary(t *testing.T, repo rel.Repository)

InsertAllPartialCustomPrimary tests insert multiple specifications.

func InsertBelongsTo

func InsertBelongsTo(t *testing.T, repo rel.Repository)

InsertBelongsTo tests specification for insertion with belongs to association.

func InsertHasMany

func InsertHasMany(t *testing.T, repo rel.Repository)

InsertHasMany tests specification insertion with has many association.

func InsertHasOne

func InsertHasOne(t *testing.T, repo rel.Repository)

InsertHasOne tests specification for insertion with has one association.

func Inserts

func Inserts(t *testing.T, repo rel.Repository)

Inserts tests insert specifications.

func Migrate added in v0.7.0

func Migrate(t *testing.T, repo rel.Repository, flags ...Flag)

Migrate specs.

func PreloadBelongsTo

func PreloadBelongsTo(t *testing.T, repo rel.Repository)

PreloadBelongsTo tests specification for preloading belongs to association.

func PreloadBelongsToSlice

func PreloadBelongsToSlice(t *testing.T, repo rel.Repository)

PreloadBelongsToSlice tests specification for preloading belongs to association from multiple records.

func PreloadBelongsToWithQuery

func PreloadBelongsToWithQuery(t *testing.T, repo rel.Repository)

PreloadBelongsToWithQuery tests specification for preloading belongs to association.

func PreloadHasMany

func PreloadHasMany(t *testing.T, repo rel.Repository)

PreloadHasMany tests specification for preloading has many association.

func PreloadHasManySlice

func PreloadHasManySlice(t *testing.T, repo rel.Repository)

PreloadHasManySlice tests specification for preloading has many association from multiple records.

func PreloadHasManyWithQuery

func PreloadHasManyWithQuery(t *testing.T, repo rel.Repository)

PreloadHasManyWithQuery tests specification for preloading has many association.

func PreloadHasOne

func PreloadHasOne(t *testing.T, repo rel.Repository)

PreloadHasOne tests specification for preloading has one association.

func PreloadHasOneSlice

func PreloadHasOneSlice(t *testing.T, repo rel.Repository)

PreloadHasOneSlice tests specification for preloading has one association from multiple records.

func PreloadHasOneWithQuery

func PreloadHasOneWithQuery(t *testing.T, repo rel.Repository)

PreloadHasOneWithQuery tests specification for preloading has one association.

func Query

func Query(t *testing.T, repo rel.Repository)

Query tests query specifications without join.

func QueryJoin

func QueryJoin(t *testing.T, repo rel.Repository)

QueryJoin tests query specifications with join.

func QueryNotFound

func QueryNotFound(t *testing.T, repo rel.Repository)

QueryNotFound tests query specifications when no result found.

func Setup added in v0.7.0

func Setup(t *testing.T, repo rel.Repository) func()

Setup database for specs execution.

func UniqueConstraint

func UniqueConstraint(t *testing.T, repo rel.Repository)

UniqueConstraint tests unique constraint specifications.

func Update

func Update(t *testing.T, repo rel.Repository)

Update tests specification for updating a record.

func UpdateAll added in v0.5.0

func UpdateAll(t *testing.T, repo rel.Repository)

UpdateAll tests update all specifications.

func UpdateAtomic added in v0.1.1

func UpdateAtomic(t *testing.T, repo rel.Repository)

UpdateAtomic tests increment and decerement operation when updating a record.

func UpdateBelongsToInsert

func UpdateBelongsToInsert(t *testing.T, repo rel.Repository)

UpdateBelongsToInsert tests specification for updating a record and inserting belongs to association.

func UpdateBelongsToUpdate

func UpdateBelongsToUpdate(t *testing.T, repo rel.Repository)

UpdateBelongsToUpdate tests specification for updating a record and updating belongs to association.

func UpdateHasManyInsert

func UpdateHasManyInsert(t *testing.T, repo rel.Repository)

UpdateHasManyInsert tests specification for updating a record and inserting has many association.

func UpdateHasManyReplace

func UpdateHasManyReplace(t *testing.T, repo rel.Repository)

UpdateHasManyReplace tests specification for updating a record and replacing has many association.

func UpdateHasManyUpdate

func UpdateHasManyUpdate(t *testing.T, repo rel.Repository)

UpdateHasManyUpdate tests specification for updating a record and updating has many association.

func UpdateHasOneInsert

func UpdateHasOneInsert(t *testing.T, repo rel.Repository)

UpdateHasOneInsert tests specification for updating a record and inserting has many association.

func UpdateHasOneReplace

func UpdateHasOneReplace(t *testing.T, repo rel.Repository)

UpdateHasOneReplace tests specification for updating a record and replacing has one association.

func UpdateHasOneUpdate

func UpdateHasOneUpdate(t *testing.T, repo rel.Repository)

UpdateHasOneUpdate tests specification for updating a record and updating has one association.

func UpdateNotFound added in v0.2.0

func UpdateNotFound(t *testing.T, repo rel.Repository)

UpdateNotFound tests specification for updating a not found record.

func Updates

func Updates(t *testing.T, repo rel.Repository)

Updates tests update specifications.

Types

type Address

type Address struct {
	ID        int64
	User      User
	UserID    *int64
	Name      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

Address defines addresses schema.

type Composite added in v0.6.0

type Composite struct {
	Primary1 int `db:",primary"`
	Primary2 int `db:",primary"`
	Data     string
}

Composite primaries example.

type Extra

type Extra struct {
	ID     uint
	Slug   *string
	Score  int
	UserID int64
}

Extra defines extra schema.

type Flag added in v0.7.0

type Flag int

Flag for configuration.

const (
	// SkipDropColumn spec.
	SkipDropColumn Flag = 1 << iota
	// SkipRenameColumn spec.
	SkipRenameColumn
)

type User

type User struct {
	ID             int64
	Name           string
	Gender         string
	Age            int
	Note           *string
	Addresses      []Address
	PrimaryAddress *Address
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

User defines users schema.

Jump to

Keyboard shortcuts

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