tests

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 1 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
}

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 `input:"email,required"`
	Password string `input:"password,required"`
}

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) ModelName added in v0.4.0

func (MultiA) ModelName() 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) ModelName added in v0.4.0

func (*PointerReceiver) ModelName() 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 `input:"name,min=2,max=100"`
	Email    string `db:"not_null" input:"email,required" json:",omitempty"`
	Password string `input:"password,required,min=8"`
	Bio      string `input:"textarea,tilde,spaces" json:",omitempty"`
	Age      int64
}

ormc:form

type UserWithJSON added in v0.2.7

type UserWithJSON struct {
	ID       string  `db:"pk"`
	Name     string  ``
	Email    string  `input:"email"`
	Bio      string  `input:"textarea" json:",omitempty"`
	HomeAddr Address ``
}

ormc:form

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