tests

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address added in v0.2.7

type Address struct {
	Street string
	City   string
}

func (Address) Pointers added in v0.2.7

func (Address) Pointers() []any

func (Address) Schema added in v0.2.7

func (Address) Schema() []fmt.Field

type BadAutoInc added in v0.1.0

type BadAutoInc struct {
	ID string `db:"autoincrement"`
}

type BadTimeNoTag added in v0.1.3

type BadTimeNoTag struct {
	ID        string `db:"pk"`
	Name      string
	CreatedAt time.Time
}

type LoginForm added in v0.2.6

type LoginForm struct {
	Email    string `form:"email"`
	Password string `form:"password"`
}

ormc:formonly

type MockChild added in v0.1.4

type MockChild struct {
	ID           string `db:"pk"`
	MockParentID string `db:"ref=mock_parent"`
	Value        string
}

type MockParent added in v0.1.4

type MockParent struct {
	ID   string
	Name string
	Kids []MockChild // no tag — relation auto-detected via MockChild.MockParentID
}

MockParent / MockChild: relation auto-detection fixture.

type ModelWithIgnored added in v0.1.3

type ModelWithIgnored struct {
	ID      string `db:"pk"`
	Name    string
	Tags    []string `db:"-"` // slice: silently ignored
	Friends []User   `db:"-"` // struct slice: silently ignored
	Score   float64
}

type MultiA added in v0.1.3

type MultiA struct {
	ID   string `db:"pk"`
	Name string
}

func (MultiA) TableName added in v0.1.3

func (MultiA) TableName() string

type MultiB added in v0.1.3

type MultiB struct {
	ID    string `db:"pk"`
	Value int64
}

type NumericTypes added in v0.1.1

type NumericTypes struct {
	IDNumeric int32 `db:"pk,not_null"` // PK + NotNull → bitmask 5
	CountUint uint64
	RatioF32  float32
}

NumericTypes covers int32, uint64, float32 mapping and bitmask constraints.

type Order added in v0.1.0

type Order struct {
	ID     string `db:"pk"`
	UserID int    `db:"ref=user:id"`
	Total  float64
}

type PointerReceiver added in v0.1.4

type PointerReceiver struct {
	ID   string `db:"pk"`
	Name string
}

PointerReceiver tests that detectTableName handles pointer receivers (*T).

func (*PointerReceiver) TableName added in v0.1.4

func (*PointerReceiver) TableName() string

type RefNoColumn added in v0.1.1

type RefNoColumn struct {
	IDRef    string `db:"pk"`
	ParentID int64  `db:"ref=parent"`
}

RefNoColumn covers db:"ref=table" without a specific column (RefColumn must be "").

type Unsupp added in v0.1.0

type Unsupp struct {
	Ch chan int
}

type User

type User struct {
	ID        int    `db:"pk"`
	FirstName string `db:"not_null"`
	LastName  string
	Email     string `db:"unique"`
	Score     float64
	IsActive  bool
	Avatar    []byte
	// contains filtered or unexported fields
}

type UserForm added in v0.2.6

type UserForm struct {
	ID       string `db:"pk"`
	Name     string
	Email    string `db:"not_null" form:"email"`
	Password string `form:"password"`
	Bio      string `form:"textarea"`
	Age      int64  `form:"-"`
}

type UserWithJSON added in v0.2.7

type UserWithJSON struct {
	ID       string  `db:"pk"           json:"id"`
	Name     string  `json:"name"`
	Email    string  `form:"email"      json:"email"`
	Bio      string  `form:"textarea"   json:"bio,omitempty"`
	HomeAddr Address `json:"home_addr"`
}

type WithPointers added in v0.2.7

type WithPointers struct {
	ID    string   `db:"pk"`
	Count *int     // pointer to primitive -> should be skipped with warning
	Addr  *Address // pointer to struct -> FieldStruct
}

Jump to

Keyboard shortcuts

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