tests

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEqual

func AssertEqual(t *testing.T, got, expect interface{})

func AssertObjEqual

func AssertObjEqual(t *testing.T, r, e interface{}, names ...string)

func Now

func Now() *time.Time

Types

type Account

type Account struct {
	UserID sql.NullInt64
	Number string
}

type Company

type Company struct {
	ID   int
	Name string
}

type Language

type Language struct {
	Code string `dao:"primarykey"`
	Name string
}

type Pet

type Pet struct {
	UserID *uint
	Name   string
	Toy    Toy `dao:"polymorphic:Owner;"`
}

type Toy

type Toy struct {
	Name      string
	OwnerID   string
	OwnerType string
}

type User

type User struct {
	Name      string
	Age       uint
	Birthday  *time.Time
	Account   Account
	Pets      []*Pet
	Toys      []Toy `dao:"polymorphic:Owner"`
	CompanyID *int
	Company   Company
	ManagerID *uint
	Manager   *User
	Team      []User     `dao:"foreignkey:ManagerID"`
	Languages []Language `dao:"many2many:UserSpeak;"`
	Friends   []*User    `dao:"many2many:user_friends;"`
	Active    bool
}

User has one `Account` (has one), many `Pets` (has many) and `Toys` (has many - polymorphic) He works in a Company (belongs to), he has a Manager (belongs to - single-table), and also managed a Team (has many - single-table) He speaks many languages (many to many) and has many friends (many to many - single-table) His pet also has one Toy (has one - polymorphic)

Jump to

Keyboard shortcuts

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