test

package
v0.0.0-...-77ac5f6 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitialData = []User{
	{
		ID:        1,
		Name:      "Alice",
		Age:       20,
		GroupID:   sql.Null[int]{Valid: true, V: 1},
		CreatedAt: time.Now(),
	},
	{
		ID:        2,
		Name:      "Bob",
		Age:       21,
		GroupID:   sql.Null[int]{Valid: true, V: 1},
		CreatedAt: time.Now(),
	},
	{
		ID:        3,
		Name:      "Charlie",
		Age:       22,
		GroupID:   sql.Null[int]{},
		CreatedAt: time.Now(),
	},
	{
		ID:        4,
		Name:      "David",
		Age:       23,
		GroupID:   sql.Null[int]{Valid: true, V: 2},
		CreatedAt: time.Now(),
	},
}

Functions

func AssertUser

func AssertUser(t *testing.T, expected, actual User)

func AssertUsers

func AssertUsers(t *testing.T, expected, actual []User)

func NewDB

func NewDB(t *testing.T) *sqlx.DB

Types

type User

type User struct {
	ID        int           `db:"id"`
	Name      string        `db:"name"`
	Age       int           `db:"age"`
	GroupID   sql.Null[int] `db:"group_id"`
	CreatedAt time.Time     `db:"created_at"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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