models

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 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 Car

type Car struct {
	ID          uint64  `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
	Name        string  `json:"name" gorm:"column:name;index;size:100;not null"`
	Description string  `json:"description" gorm:"column:description;index;size:300;not null"`
	Price       float64 `json:"price" gorm:"column:price;index;type:float;not null"`
}

type House

type House struct {
	ID          uint64  `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
	Name        string  `json:"name" gorm:"column:name;index;size:100;not null"`
	Description string  `json:"description" gorm:"column:description;index;size:300;not null"`
	Price       float64 `json:"price" gorm:"column:price;index;type:float;not null"`
}

type Person

type Person struct {
	ID         uint64            `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
	Name       string            `json:"name" gorm:"column:name;index;size:100;not null"`
	Cars       []*Car            `json:"cars" gorm:"many2many:person_car"`
	Houses     []*House          `json:"houses" gorm:"many2many:person_house"`
	StatusList []*PersonStatus   `json:"statusList" gorm:"foreignKey:PersonID"`
	Locations  []*PersonLocation `json:"locations" gorm:"foreignKey:PersonID"`
}

func (*Person) PreloadCars

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

func (*Person) PreloadHouses

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

func (*Person) PreloadLocations

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

func (*Person) PreloadStatusList

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

type PersonLocation

type PersonLocation struct {
	ID       uint64  `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
	PersonID uint64  `json:"personId" gorm:"column:personId;index;not null"`
	Person   *Person `json:"person" gorm:"foreignKey:PersonID;OnUpdate:CASCADE;OnDelete:CASCADE"`
	Address  string  `json:"address" gorm:"column:address;index;size:200;not null"`
	City     string  `json:"city" gorm:"column:city;index;size:200;not null"`
	State    string  `json:"state" gorm:"column:state;index;size:200;not null"`
	Country  string  `json:"country" gorm:"column:country;index;size:200;not null"`
}

type PersonStatus

type PersonStatus struct {
	ID       uint64  `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
	PersonID uint64  `json:"personId" gorm:"column:personId;index;not null"`
	Person   *Person `json:"person" gorm:"foreignKey:PersonID;OnUpdate:CASCADE;OnDelete:CASCADE"`
	Name     string  `json:"name" gorm:"column:name;index;size:100;not null"`
	Text     string  `json:"text" gorm:"column:text;index;size:200;not null"`
}

Jump to

Keyboard shortcuts

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