book

package
v0.0.0-...-0db9ae2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package book contains shared book structures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewID

func NewID() string

NewID creates a random, url-safe, base64 string.

Types

type Book

type Book struct {
	Header
	Description   string
	DeweyDecClass string
	Pages         int
	Publisher     string
	PublishDate   time.Time
	AddedDate     time.Time
	EanIsbn13     string
	UpcIsbn10     string
	ImageBase64   string
}

Book contains common book fields

type Books

type Books []Book

func (Books) Sort

func (books Books) Sort()

type DateLayout

type DateLayout string
const (
	HyphenatedYYYYMMDD DateLayout = "2006-01-02"
	SlashMMDDYYYY      DateLayout = "01/02/2006"
)

type Filter

type Filter struct {
	Subject    string
	HeaderPart string
}

Filter is used to match books weth the exact subject (if set) or a whole word match to any of the header parts.

func (Filter) Matches

func (f Filter) Matches(b Book) bool
type Header struct {
	ID      string
	Title   string
	Author  string
	Subject string
}

Header contains tne basic identifier of a book

type StringBook

type StringBook struct {
	ID            string
	Title         string
	Author        string
	Subject       string
	Description   string
	DeweyDecClass string
	Pages         string
	Publisher     string
	PublishDate   string
	AddedDate     string
	EanIsbn13     string
	UpcIsbn10     string
	ImageBase64   string
}

func (StringBook) Book

func (sb StringBook) Book(dateLayout DateLayout) (*Book, error)

type Subject

type Subject struct {
	Name  string
	Count int
}

type Subjects

type Subjects []Subject

func (Subjects) Sort

func (subjects Subjects) Sort()

Jump to

Keyboard shortcuts

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