Documentation
¶
Index ¶
- Constants
- Variables
- func CaptureAllSizeCovers(b Book, imageDir string)
- func CaptureCoverImages(db *gorm.DB, books []Book, imageDir string) error
- func CreateBooksDatabase(databaseName string) *gorm.DB
- func ExtractSurname(fullName string) string
- func GetBookByOlId(olid string) (gol.Book, error)
- func TransferJsonBooksToDatabase(jsonFileName string, db *gorm.DB) error
- type Author
- type Book
- func (b Book) AlternateAuthorFullNames() []string
- func (b Book) BookPageLink(args ...string) template.HTML
- func (b Book) BookPageURL(args ...string) string
- func (b Book) Create(db *gorm.DB) (uint, error)
- func (b Book) DisplayRating() string
- func (b Book) FormatPubDate() string
- func (b Book) FormatRating() string
- func (b Book) FormatTitle() string
- func (b Book) HasCoverImageId() bool
- func (b Book) HasOpenLibraryId() bool
- func (b Book) MakeCoverImageFilename(imageDir string, size string) string
- func (b Book) MakeCoverImageUrl(size string) string
- func (b Book) MakeLinkedLargeCoverImageTag(args ...string) template.HTML
- func (b Book) MakeLinkedMediumCoverImageTag(args ...string) template.HTML
- func (b Book) MakeLinkedSmallCoverImageTag(args ...string) template.HTML
- func (b Book) ReviewHTML() template.HTML
- func (b Book) ReviewPreviewHTML() template.HTML
- func (b Book) ReviewPreviewIsTruncated() bool
- func (b Book) SiteFileName() string
- func (b Book) UpdateFromOpenLibrary(db *gorm.DB, olSearchResult BookSearchResult) (Book, error)
- type BookSearchResult
- type BooksByAuthor
- type OpenLibraryBookAuthor
- type OpenLibraryBookIsbn
- type Rating
Constants ¶
View Source
const ImageDir string = "images/cover_images"
View Source
const LargeCover = "L"
View Source
const MediumCover = "M"
View Source
const Missing int64 = -999998
View Source
const SmallCover = "S"
View Source
const Verbose bool = false
Variables ¶
Functions ¶
func CaptureAllSizeCovers ¶
func CreateBooksDatabase ¶
func ExtractSurname ¶
This might need to get more sophisticated
Types ¶
type Author ¶
type Book ¶
type Book struct {
gorm.Model
PubDate int64
DateAdded time.Time
AuthorFullName string
AuthorSurname string
MainTitle string
SubTitle string
Review string
Rating string
AmazonLink string
CoverImageUrl string
OpenLibraryUrl string
IsfdbUrl string
OpenLibraryBookIsbns []OpenLibraryBookIsbn
OlCoverId int64 // Used as the base ID for the image (add suffix -M, -S, -L for sizing.)
OpenLibraryBookAuthors []OpenLibraryBookAuthor
OlCoverEditionId string // Used to pull up an entry based on a cover
Authors []Author `gorm:"many2many:book_authors;"`
}
func (Book) AlternateAuthorFullNames ¶
func (Book) BookPageURL ¶
func (Book) DisplayRating ¶
func (Book) FormatPubDate ¶
func (Book) FormatRating ¶
func (Book) FormatTitle ¶
func (Book) HasCoverImageId ¶
func (Book) HasOpenLibraryId ¶
func (Book) MakeCoverImageFilename ¶
func (Book) MakeCoverImageUrl ¶
func (Book) MakeLinkedLargeCoverImageTag ¶
func (Book) MakeLinkedMediumCoverImageTag ¶
func (Book) MakeLinkedSmallCoverImageTag ¶
func (Book) ReviewHTML ¶
func (Book) ReviewPreviewHTML ¶
func (Book) ReviewPreviewIsTruncated ¶
func (Book) SiteFileName ¶
func (Book) UpdateFromOpenLibrary ¶
type BookSearchResult ¶
type BookSearchResult struct {
Number int
FirstYearPublished int
Title string
Authors []string
Languages []string
CoverEditionKey string
CoverImageId string
AuthorIds []string // Can be more than one author
// contains filtered or unexported fields
}
func SearchBook ¶
func SearchBook(title string, author string) []BookSearchResult
func (BookSearchResult) GetBookCoverUrl ¶
func (s BookSearchResult) GetBookCoverUrl(size string) string
func (BookSearchResult) HasCoverImageId ¶
func (s BookSearchResult) HasCoverImageId() bool
func (BookSearchResult) HasEnglishLanguage ¶
func (s BookSearchResult) HasEnglishLanguage() bool
func (BookSearchResult) Print ¶
func (s BookSearchResult) Print() string
type BooksByAuthor ¶
func AllBooksFromJson ¶
func AllBooksFromJson(bookFile string) BooksByAuthor
type OpenLibraryBookAuthor ¶
type Rating ¶
type Rating struct {
// contains filtered or unexported fields
}
func StringToRating ¶
Click to show internal directories.
Click to hide internal directories.