model

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	gorm.Model
	UserName    string `gorm:"unique;not null"`
	State       int32  `gorm:"not null;default:1"` // 1: active, 2:inactive
	HashPass    []byte `gorm:"not null"`
	Salt        []byte `gorm:"not null"`
	DisplayName string `gorm:"not null"`
	Phone       Phone  `gorm:"embedded;embeddedPrefix:Phone"`
	Address     `gorm:"embedded;embeddedPrefix:Address"`
	RoleID      uint
	Role        Role `gorm:"foreignKey:RoleID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

type Address

type Address struct {
	Val string
}

type BlogRocord

type BlogRocord struct {
	gorm.Model

	Children []*Store `gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

type Page

type Page struct {
	// LoginRecord PageOperation `gorm:"embedded;embeddedPrefix:LoginRecord"`
	Role    PageOperation `gorm:"embedded;embeddedPrefix:Role"`
	Setting PageOperation `gorm:"embedded;embeddedPrefix:Setting"`
	Account PageOperation `gorm:"embedded;embeddedPrefix:Account"`
}

type PageOperation

type PageOperation struct {
	Create bool `gorm:"not null;default:false"`
	Read   bool `gorm:"not null;default:false"`
	Update bool `gorm:"not null;default:false"`
	Delete bool `gorm:"not null;default:false"`
}

type Phone

type Phone struct {
	Number string
}

type Role

type Role struct {
	gorm.Model
	Name string `gorm:"not null;uniqueIndex:idx_store_name"`
	Page Page   `gorm:"embedded; embeddedPrefix:Page"`

	Accounts []Account
}

type Store

type Store struct {
	gorm.Model
	Name     string     `gorm:"unique"`
	ParentID *uuid.UUID `gorm:"type:uuid"`

	Children []*Store `gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

Jump to

Keyboard shortcuts

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