models

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	ID             string                `gorm:"primaryKey,size:36" json:"id,omitempty"`
	UserName       string                `gorm:"size:20" json:"userName,omitempty"`
	Name           string                `gorm:"size:200;not null;uniqueIndex:idx_parent_name" json:"name"`
	ParentId       string                `gorm:"size:36;default:'';uniqueIndex:idx_parent_name" json:"parentId"`
	AbsolutePath   string                `gorm:"size:300;not null;" json:"absolutePath"`
	IsDict         sql.NullBool          `gorm:"not null;default:false" json:"isDict"`
	Children       []*File               `gorm:"-" json:"children"`
	FileType       string                `gorm:"size:100;not null;default:''" json:"fileType"`
	FileSize       int64                 `gorm:"not null;default:0" json:"fileSize"`
	Permission     Permission            `grom:"not null;default:0" json:"permission,omitempty"`
	FileStatus     FileStatus            `grom:"not null;default:1" json:"fileStatus,omitempty"`
	LastModifyTime time.Time             `gorm:"not null;" json:"createAt,omitempty"`
	DownloadUrls   []*driver.DownloadUrl `gorm:"-" json:"downloadUrls"`
	Password       string                `gorm:"size:30" json:"-"`
}

type FileStatus

type FileStatus int
const (
	READY   FileStatus = 0
	SUCCESS FileStatus = 1
)

type JWTClaims

type JWTClaims struct {
	Role     string `json:"role"`
	Email    string `json:"email"`
	ShowName string `json:"showname"`
	jwt.StandardClaims
}

type PageResult

type PageResult struct {
	Total     int                    `json:"total"`
	Page      int                    `json:"page"`
	PageCount int                    `json:"pageCount"`
	List      interface{}            `json:"list"`
	Extend    map[string]interface{} `json:"extend,omitempty"`
}

type Permission

type Permission int
const (
	PUBLICREAD Permission = 0
	USERREAD   Permission = 1
	MEREAD     Permission = 2
	PASSWORD   Permission = 3
)

type Role

type Role string
const (
	SuperAdminRole Role = "superadmin"
	AdminRole      Role = "admin"
	UserRole       Role = "user"
)

type User

type User struct {
	ID        string       `gorm:"primaryKey,size:36" json:"id,omitempty"`
	UserName  string       `gorm:"size:20;uniqueIndex:idx_username" json:"userName,omitempty" validate:"required,min=5,max=20"`
	ShowName  string       `gorm:"size:40" json:"showName,omitempty" validate:"min=5,max=40"`
	Email     string       `gorm:"size:40;uniqueIndex:idx_email" json:"email,omitempty" validate:"required,email,max=40"`
	Tel       string       `gorm:"size:11;uniqueIndex:idx_tel" json:"tel,omitempty" validate:"required,len=11"`
	Password  string       `gorm:"size:32" json:"password,omitempty" validate:"required,min=10,max=20"`
	Role      Role         `gorm:"size:15" json:"role,omitempty"`
	Enable    sql.NullBool `json:"enable,omitempty"`
	CreatedAt time.Time    `json:"createAt,omitempty"`
}

Jump to

Keyboard shortcuts

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