model

package
v0.0.0-...-2bc4f80 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 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 Book

type Book struct {
	gorm.Model
	UserId    int    `gorm:"not null"`
	User      User   `gorm:"foreignKey:UserId;AssociationForeignKey:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	RoomId    int    `gorm:"not null"`
	Room      Room   `gorm:"foreignKey:RoomId;AssociationForeignKey:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	StartTime int64  `gorm:"not null"`
	EndTime   int64  `gorm:"not null"`
	Theme     string `gorm:"not null"`
}

type Company

type Company struct {
	gorm.Model
	Name           string `gorm:"not null;unique"`
	Address        string `gorm:"not null"`
	OfficialMobile string `gorm:"not null"`
	OfficialSite   string `gorm:"not null"`
	CompanyType    string `gorm:"not null"`
	Introduction   string `gorm:"not null"`
	Picture        string `gorm:"not null"`
}

type Photo

type Photo struct {
	gorm.Model
	RoomId int    `gorm:"not null"`
	Room   Room   `gorm:"foreignKey:RoomId;AssociationForeignKey:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Url    string `gorm:"not null"`
}

type Room

type Room struct {
	gorm.Model
	CompanyId int     `gorm:"not null"`
	Company   Company `gorm:"foreignKey:CompanyId;AssociationForeignKey:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`

	Name     string `gorm:"not null"`
	Capacity int    `gorm:"not null"`
	Location string `gorm:"not null"`
	Facility string `gorm:"not null"`
}

type User

type User struct {
	gorm.Model
	Username  string  `gorm:"not null"`
	Password  string  `gorm:"not null"`
	Mobile    string  `gorm:"not null"`
	CompanyId int     `gorm:"not null"`
	Company   Company `gorm:"foreignKey:CompanyId;AssociationForeignKey:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Avatar    string  `gorm:"not null;default:http://s42es6gy4.hn-bkt.clouddn.com/avatar.jpg"`
	Face      string  `gorm:"null"`
	Role      int     `gorm:"not null;default:1;check: role in(1,2)"` // 1:普通用户 2:管理员
}

Jump to

Keyboard shortcuts

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