model

package
v0.0.0-...-b76b2b2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Base

	RestaurantID uuid.UUID `gorm:"unique"`

	AddressLine1 string
	AddressLine2 string
	City         string
	PostCode     string
}

type Base

type Base struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key"` //<-:create
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

gorm.Model definition

func (*Base) BeforeCreate

func (b *Base) BeforeCreate(tx *gorm.DB) (err error)

type Company

type Company struct {
	Base
}

type Food

type Food struct {
	Base
	//CuisineTypeId uuid.UUID
	FoodType    string
	Name        string
	Description string
	Price       float64
}
type Menu struct {
	Base
	Foods []Food `gorm:"many2many:menu_foods;"`

	RestaurantID uuid.UUID
}

type QrCode

type QrCode struct {
	Base
	// contains filtered or unexported fields
}

type Restaurant

type Restaurant struct {
	Base
	//CompanyId uuid.UUID
	OwnerID uuid.UUID `gorm:"type:uuid"`
	Address Address   `gorm:"foreignKey:RestaurantID"`
	//QRCodeId  uuid.UUID
	//QrCode    QrCode
	Menu Menu `gorm:"foreignKey:RestaurantID"`

	Name        string
	Description string
}

type RoleName

type RoleName int
const (
	Admin RoleName = iota
	Customer
	Owner
	Manager
	Employee
)

func ToRoleName

func ToRoleName(s float64) RoleName

type User

type User struct {
	Base
	Username string `param:"username" query:"username" form:"username" json:"username" xml:"username"`
	Email    string `param:"email" query:"email" form:"email" json:"email" xml:"email"`
	Password string `param:"password" query:"password" form:"password" json:"password" xml:"password"`

	Role        RoleName     `param:"role" query:"role" form:"role" json:"role" xml:"role"`
	Restaurants []Restaurant `gorm:"foreignKey:OwnerID" param:"restaurants" query:"restaurants" form:"restaurants" json:"restaurants" xml:"restaurants" `
}

func (*User) CheckPassword

func (u *User) CheckPassword(plain string) bool

func (*User) HashPassword

func (u *User) HashPassword(plain string) (string, error)

Jump to

Keyboard shortcuts

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