models

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 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 Actor added in v1.8.4

type Actor struct {
	ID   uint64 `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
	Name string `gorm:"index;column:name"`
	Age  int    `gorm:"index;column:age"`
}

func (*Actor) ScopeAdult added in v1.8.4

func (x *Actor) ScopeAdult(db *gorm.DB) *gorm.DB

type Car

type Car struct {
	ID      uint64  `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
	Brand   string  `gorm:"index;column:brand"`
	Color   string  `gorm:"index;column:color"`
	OwnerID uint64  `gorm:"index;column:ownerId"`
	Owner   *Person `gorm:"foreignKey:OwnerID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type Movie added in v1.8.3

type Movie struct {
	ID       uint64  `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
	Name     string  `gorm:"index;column:name"`
	IsSeries bool    `gorm:"index;column:isSeries;not null;default:false"`
	OwnerID  uint64  `gorm:"index;column:ownerId"`
	Owner    *Person `gorm:"foreignKey:OwnerID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type Person

type Person struct {
	ID     uint64   `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
	Name   string   `gorm:"index;column:name"`
	Cars   []*Car   `gorm:"foreignKey:OwnerID" gokit-dbo:"preload"`
	Movies []*Movie `gorm:"foreignKey:OwnerID" gokit-dbo:"preload"`
}

func (Person) MoviesPreloader added in v1.8.3

func (x Person) MoviesPreloader(db *gorm.DB) *gorm.DB

Jump to

Keyboard shortcuts

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