Documentation ¶
Index ¶
- Variables
- func AddBook(db *gorm.DB, book *Book) error
- func AddFile(db *gorm.DB, file *File) error
- func AutoMigrate(db *gorm.DB) (err error)
- func DeleteBook(db *gorm.DB, book *Book) error
- func DeleteFile(db *gorm.DB, bookID uint64, mime string) error
- func EntriesFromBooks(books *[]Book) []opds.Entry
- func GenerateFilePath(bookID uint64, mimeAlias string) string
- func GetBooks(db *gorm.DB) (*[]Book, error)
- func GetBooksWithCount(db *gorm.DB, count uint64) (*[]Book, error)
- func GetBooksWithNext(db *gorm.DB, next uint64) (*[]Book, error)
- func GetBooksWithNextCount(db *gorm.DB, next, count uint64) (*[]Book, error)
- func GetMimeAlias(mime string) (string, error)
- func GetMimeAliasByFilename(filename string) (string, error)
- func GetMimes() map[string]string
- func MimeByExt(ext string) (string, error)
- func MimeByFilename(filename string) (string, error)
- func UpdateBook(db *gorm.DB, book *Book) error
- type Book
- type File
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBookConflict = errors.New("book conflict") ErrBookNotFound = errors.New("book not found") ErrMimeNotFound = errors.New("mime not found") ErrFileConflict = errors.New("file conflict") ErrFileNotFound = errors.New("file not found") ErrInvalidExt = errors.New("invalid ext") )
View Source
var MimeAlias = map[string]string{
"application/x-mobi8-ebook": "azw3",
"application/epub+zip": "epub",
"application/fb2+zip": "fb2",
"application/x-mobipocket-ebook": "mobi",
"application/pdf": "pdf",
"text/plain": "txt",
}
Functions ¶
func AutoMigrate ¶
func EntriesFromBooks ¶
func GenerateFilePath ¶
func GetBooksWithNextCount ¶
func GetMimeAlias ¶
func GetMimeAliasByFilename ¶
func MimeByFilename ¶
Types ¶
type Book ¶
type Book struct { ID uint64 `json:"ID" gorm:"primary_key"` CreatedAt time.Time `json:"CreatedAt"` UpdatedAt time.Time `json:"UpdatedAt"` DeletedAt *time.Time `json:"-" sql:"index"` UUID string `json:"UUID" gorm:"not null"` ISBN string `json:"ISBN"` Title string `json:"Title"` Author string `json:"Author"` Description string `json:"Description"` CoverURL string `json:"CoverURL"` Publisher string `json:"Publisher"` PubDate string `json:"PubDate"` Files []File `json:"Files"` }
Click to show internal directories.
Click to hide internal directories.