Documentation ¶
Index ¶
- Variables
- type Image
- type ImageConfiguration
- type ImageLibrary
- func (lib *ImageLibrary) Close() (err error)
- func (lib *ImageLibrary) CreateImage(user User, imageStream io.Reader) (*Image, error)
- func (lib *ImageLibrary) CreateUser(user *User) error
- func (lib *ImageLibrary) DeleteImage(userid, imageid uint) error
- func (lib *ImageLibrary) GetImages(offset, limit int) ([]*Image, error)
- func (lib *ImageLibrary) GetImagesByUsername(username string) ([]*Image, error)
- func (lib *ImageLibrary) Open(directoryPath string) error
- func (lib *ImageLibrary) SaveUser(user *User) error
- func (lib *ImageLibrary) UserByUsername(username string) (*User, error)
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var DBFilename = ".library.db"
The Sqlite filename within the library directory
View Source
var DefaultImageConfiguration = ImageConfiguration{
ThumbMaxSize: 300,
LargeMaxSize: 1200,
JpegQuality: 95,
}
View Source
var WriteTestFilename = ".galleryWriteTest"
Functions ¶
This section is empty.
Types ¶
type Image ¶
type Image struct { ID uint `gorm:"primary_key"` UserID uint `sql:"index"` User User `json:"user"` Tags string `json:"tags"` LargeFilename string `json:"src"` LargeW int `json:"w"` LargeH int `json:"h"` ThumbFilename string `json:"msrc"` ThumbW int `json:"mw"` ThumbH int `json:"mh"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` }
func (*Image) DeleteFromDirectory ¶
func (*Image) SaveToDirectory ¶
type ImageConfiguration ¶
type ImageLibrary ¶
type ImageLibrary struct {
// contains filtered or unexported fields
}
func (*ImageLibrary) Close ¶
func (lib *ImageLibrary) Close() (err error)
func (*ImageLibrary) CreateImage ¶
func (*ImageLibrary) CreateUser ¶
func (lib *ImageLibrary) CreateUser(user *User) error
func (*ImageLibrary) DeleteImage ¶
func (lib *ImageLibrary) DeleteImage(userid, imageid uint) error
func (*ImageLibrary) GetImages ¶
func (lib *ImageLibrary) GetImages(offset, limit int) ([]*Image, error)
func (*ImageLibrary) GetImagesByUsername ¶
func (lib *ImageLibrary) GetImagesByUsername(username string) ([]*Image, error)
func (*ImageLibrary) Open ¶
func (lib *ImageLibrary) Open(directoryPath string) error
Opens the library denoted by the given directory. If the directory does not exist, it will be created.
func (*ImageLibrary) SaveUser ¶
func (lib *ImageLibrary) SaveUser(user *User) error
func (*ImageLibrary) UserByUsername ¶
func (lib *ImageLibrary) UserByUsername(username string) (*User, error)
type User ¶
type User struct { ID uint `gorm:"primary_key"` UserName string `sql:"type:varchar(50);unique_index"json:"userName"` NickName string `sql:"type:varchar(50)"json:"nickName"` Link string `sql:"type:varchar(500)"json:"link"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` }
Click to show internal directories.
Click to hide internal directories.