relate

package
v0.0.0-...-b9b72ee Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ManyOne

type ManyOne struct {
	Id      int
	Name    string
	ManyTwo []ManyTwo `gorm:"many2many:one_two_one"` //多对多关系 必须带着个标签
}

type ManyTwo

type ManyTwo struct {
	Id  int
	Age int
}

type More

type More struct {
	gorm.Model
	Hobbies string
	OneID   int //关联键 一定得是 模型+ID   OId(×)
}

type One

type One struct {
	gorm.Model
	Name  string
	Mores []More
}

type UserMaster

type UserMaster struct {
	Id   int
	Name string
	Age  int
	Addr string
}

type UserSlave

type UserSlave struct {
	Id           int
	Pic          string
	Phone        string
	UserMasterID int
	UserMaster   UserMaster //关联关系 这个字段名得和结构体保持一致 真的坑!!!
}

Jump to

Keyboard shortcuts

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