models

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 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 Album

type Album struct {
	orm.Model
	Name        string `json:"name"`
	Subtitle    string `json:"subtitle"`
	Description string `json:"description"`
	CoverId     uint64 `json:"cover_id"`

	Cover *Photo `json:"cover" gorm:"foreignKey:CoverId"`
}

type AlbumHasPhoto

type AlbumHasPhoto struct {
	orm.Model
	AlbumId uint64 `json:"album_id" gorm:"uniqueIndex:uniq_album_photo"`
	PhotoId uint64 `json:"photo_id" gorm:"uniqueIndex:uniq_album_photo"`
}

type Photo

type Photo struct {
	orm.Model
	Md5          string `json:"md5" gorm:"unique"` // md5
	OriginalName string `json:"original_name"`     // 源文件名
	Filename     string `json:"filename"`          // 保存后的文件名
	Url          string `json:"url" gorm:"-"`      // 文件完整可访问的URL
	Ext          string `json:"ext"`               // 后缀
	Size         int64  `json:"size"`              // 大小
	Width        int    `json:"width"`
	Height       int    `json:"height"`
	Thumbnail    string `json:"thumbnail"`              // 缩略图路径
	ThumbnailUrl string `json:"thumbnail_url" gorm:"-"` // 缩略图完整可访问的URL
}

func (*Photo) AfterFind

func (p *Photo) AfterFind(tx *gorm.DB) error

type Setting

type Setting struct {
	orm.Model
	Key   string
	Value string
}

type User

type User struct {
	orm.Model
	Username string `gorm:"column:username;unique" json:"username"`
	Password string `gorm:"column:password" json:"-"`

	AlbumCount int64 `json:"album_count" gorm:"-"`
	PhotoCount int64 `json:"photo_count" gorm:"-"`
}

Jump to

Keyboard shortcuts

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