Documentation
¶
Index ¶
- Constants
- func ArchivePathFound(archivePath string) bool
- func Clamp(value, min, max int64) int64
- func DeleteGallery(galleryUUID string) bool
- func DeleteSession(id string, userUUID string) error
- func DeleteUser(userUUID string) error
- func EnsureLatestVersion()
- func GetCategories() ([]string, error)
- func GetFavoriteGroups(userUUID string) ([]string, error)
- func GetOnlyLibraries() ([]model.Library, error)
- func GetSeries() ([]string, error)
- func GetSessions(userUUID string) ([]model.Session, error)
- func GetUser(name string) ([]model.User, error)
- func GetUsers() ([]model.User, error)
- func Initdb()
- func Login(username string, password string, role Role) (*string, *int32, error)
- func Logout(sessionUUID string, userUUID string) error
- func MetaPathFound(metaPath string, libraryPath string) bool
- func NeedsUpdate(archivePath string, updatedAt time.Time) (bool, string)
- func NewGallery(archivePath string, libraryID int32, title string, series string) error
- func NewGalleryPref(galleryUUID string, userUUID string) error
- func NewSession(userUUID string, expiresIn *int64, sessionName *string) (string, error)
- func NewTags(tags []model.Tag) ([]int32, error)
- func Register(username string, password string, role int64) error
- func SetFavoriteGroup(favoriteGroup string, galleryUUID string, userUUID string) error
- func SetThumbnail(uuid string, thumbnail string) error
- func StorePaths(givenLibraries []config.Library) error
- func UpdateGallery(gallery model.Gallery, tags []model.Tag, reference model.Reference, ...) error
- func UpdateProgress(progress int32, galleryUUID string, userUUID string) error
- func UpdateUser(userUUID string, userForm *UserForm) error
- func VerifySession(id string, userUUID string) bool
- type Categories
- type CombinedLibrary
- type CombinedMetadata
- type FavoriteGroups
- type Filters
- type MappedTags
- type Order
- type Role
- type SortBy
- type UserForm
Constants ¶
const ( Title SortBy = "title" TitleNative = "native" UpdatedAt = "updated" Progress = "progress" )
const ( Desc Order = "desc" Asc = "asc" Random = "random" )
const ( Admin Role = 100 Member = 20 Viewer = 10 NoRole = 0 )
Variables ¶
This section is empty.
Functions ¶
func ArchivePathFound ¶
ArchivePathFound returns true if the given archive path is already in the database.
func DeleteGallery ¶
DeleteGallery removes a gallery from the database (never actually deletes the archive file).
func DeleteSession ¶
DeleteSession removes a session based on the session ID and user UUID.
func DeleteUser ¶
DeleteUser removes user. Admins cannot be deleted, they have to demoted first.
func EnsureLatestVersion ¶
func EnsureLatestVersion()
EnsureLatestVersion ensures that the database is at the latest version by running all migrations.
func GetCategories ¶
GetCategories returns all public categories.
func GetFavoriteGroups ¶
GetFavoriteGroups returns user's favorite groups.
func GetOnlyLibraries ¶
func GetSessions ¶
GetSessions returns all sessions of a user.
func MetaPathFound ¶
MetaPathFound returns true if a gallery with the given meta path exists.
func NeedsUpdate ¶
NeedsUpdate returns true if the gallery needs to be updated. Currently, only the timestamp is checked.
func NewGallery ¶
NewGallery creates a new gallery
func NewGalleryPref ¶
NewGalleryPref creates initializes user preferences for a gallery.
func NewSession ¶
NewSession creates a new session for a user.
func SetFavoriteGroup ¶
SetFavoriteGroup sets a favorite group for a gallery.
func SetThumbnail ¶
SetThumbnail saves the filename of the thumbnail for the gallery.
func StorePaths ¶
func UpdateGallery ¶
func UpdateGallery(gallery model.Gallery, tags []model.Tag, reference model.Reference, internalScan bool) error
UpdateGallery updates a gallery. It also adds tags and references if any. If internalScan is true, the gallery is matched by its archive path, not UUID.
func UpdateProgress ¶
UpdateProgress sets the reading progress of a gallery for a user.
func UpdateUser ¶
UpdateUser can be used to update role, password or username of users.
func VerifySession ¶
VerifySession verifies a session by checking if it exists based on the session ID and user UUID.
Types ¶
type Categories ¶
type Categories struct {
Data []string `json:"Data"`
}
type CombinedLibrary ¶
func GetLibraries ¶
func GetLibraries() ([]CombinedLibrary, error)
type CombinedMetadata ¶
type CombinedMetadata struct {
model.Gallery
Tags []model.Tag
Reference struct {
ExhToken *string
ExhGid *int32
Urls *string
} `alias:"reference.*"`
GalleryPref *struct {
FavoriteGroup *string
Progress int32
UpdatedAt string
} `alias:"gallery_pref.*"`
Library model.Library `json:"-"`
}
func GetGalleries ¶
func GetGalleries(filters Filters, hidden bool, userUUID *string) ([]CombinedMetadata, error)
GetGalleries returns galleries based on the given filters.
func GetGallery ¶
func GetGallery(galleryUUID *string, userUUID *string) ([]CombinedMetadata, error)
GetGallery returns a gallery based on the given UUID. If no UUID is given, a random gallery is returned.
type FavoriteGroups ¶
type FavoriteGroups struct {
Data []string `json:"Data"`
}