tests

package
v0.0.0-...-7203340 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A

type A struct {
	ID       int64 `sql:"primary key;auto increment"`
	Name     string
	Age      int
	CPointer *C
}

A : A, B, C test simple one-to-one (A->C) and one-to-many(B->C) relationships

type A2

type A2 struct {
	ID int64 `sql:"primary key;auto increment"`
	B  B2
}

A2 : A2, B2, C2, D2 test nested relationship (A2->B2->C2,D2), and non-pointer reference(A2->B2)

type A3

type A3 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
	B    []*B3
}

A3 : A3, B3 test bi-directional one-to-many relation

type A4

type A4 struct {
	ID     int64 `sql:"primary key;auto increment"`
	Name   string
	B1, B2 *B4
}

A4 : A4, B4 test multiple fields with the same reference type

type A5

type A5 struct {
	ID          int64 `sql:"primary key;auto increment"`
	Name        string
	Left, Right *A5
}

A5 test self referencing

type A6

type A6 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
	B    *B6
}

A6 : A6,B6,C6 test referencing unique keys

type A7

type A7 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
	B    []B7 `sql:"relation field:A1"`
}

A7 : A7,B7 test functionality of 'relation field' A7 has one-to-many relationship to B7, and B7 has several A7 reverse references

type A8

type A8 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
	B    []B8
}

A8 : A8,B8 test many to one relationship without a relation field in B

type A9

type A9 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
	B1   []B9
	AB   []B9 `sql:"relation name:ab_relation"`
}

A9 : A9,B9 test many to many relationship with and without a relation name

type All

type All struct {
	// Annotated
	Auto   int    `sql:"primary key;autoincrement"`
	NotNil string `sql:"not null"`

	Int    int
	Int8   int8
	Int16  int16
	Int32  int32
	Int64  int64
	UInt   uint
	UInt8  uint8
	UInt16 uint16
	UInt32 uint32
	UInt64 uint64

	Time time.Time

	VarCharString string `sql:"type:VARCHAR(100)"`
	VarCharByte   []byte `sql:"type:VARCHAR(100)"`
	String        string
	Bytes         []byte

	Bool bool

	PInt    *int
	PInt8   *int8
	PInt16  *int16
	PInt32  *int32
	PInt64  *int64
	PUInt   *uint
	PUInt8  *uint8
	PUInt16 *uint16
	PUInt32 *uint32
	PUInt64 *uint64

	PTime *time.Time

	PVarCharString *string `sql:"type:VARCHAR(100)"`
	PVarCharByte   *[]byte `sql:"type:VARCHAR(100)"`
	PString        *string
	PBytes         *[]byte

	PBool *bool

	// test a case where field is a reserved name
	Select int
	// contains filtered or unexported fields
}

All is to test generation of variant fields and types

type B

type B struct {
	ID        int64 `sql:"primary key;auto increment"`
	Name      string
	Hobbies   string
	CsPointer []*C
}

B :

type B2

type B2 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
	C    *C2
	D    *D2
}

B2 :

type B3

type B3 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
	A    *A3 `sql:"foreign key:./.A3;null"`
}

B3 :

type B4

type B4 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
}

B4 :

type B6

type B6 struct {
	SureName  string `sql:"primary key"`
	FirstName string `sql:"primary key"`
	Cs        []C6
}

B6 :

type B7

type B7 struct {
	ID     int64 `sql:"primary key;auto increment"`
	Name   string
	A1, A2 *A7
}

B7 :

type B8

type B8 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
}

B8 :

type B9

type B9 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
	A1   []A9
	BA   []A9 `sql:"relation name:ab_relation"`
}

B9 :

type C

type C struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
	Year int
	B    *B
}

C :

type C2

type C2 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
}

C2 :

type C6

type C6 struct {
	Name string
	B    B6
}

C6 :

type D2

type D2 struct {
	ID   int64 `sql:"primary key;auto increment"`
	Name string
}

D2 :

type Employee

type Employee struct {
	Person
	Salary int
}

Employee is a person who works This is a test case for struct embedding

type Ignore

type Ignore struct {
	ID   int64
	Data map[string]interface{} `sql:"-"`
}

Ignore contains ignored fields.

type Migration0

type Migration0 struct {
	A string
}

Migration0 is for testing migrations

func (*Migration0) TableName

func (*Migration0) TableName() string

TableName returns the table name of Migration0 type

type Migration1

type Migration1 struct {
	A string
	B string
}

Migration1 is for testing migrations

func (*Migration1) TableName

func (*Migration1) TableName() string

TableName returns the table name of Migration1 type

type Migration2

type Migration2 struct {
	A  string
	B  string
	D  string
	P1 *C2
}

Migration2 is for testing migrations

func (*Migration2) TableName

func (*Migration2) TableName() string

TableName returns the table name of Migration2 type

type Migration3

type Migration3 struct {
	A      string
	B      string
	D      string
	P1, P2 *C2
}

Migration3 is for testing migrations

func (*Migration3) TableName

func (*Migration3) TableName() string

TableName returns the table name of Migration3 type

type Person

type Person struct {
	Name string
	Age  int
	// contains filtered or unexported fields
}

Person for testing

Jump to

Keyboard shortcuts

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