dusk

package module
v0.0.0-...-d9ef67d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 13 Imported by: 0

README

dusk

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDoesNotExist     = errors.New("the item does not exist")
	ErrNoRows           = errors.New("no items found")
	ErrUniqueConstraint = errors.New("the item already exists")
	ErrIsbnExists       = errors.New("isbn already exists")
	ErrNoChange         = errors.New("no change executed")
)

Functions

This section is empty.

Types

type Author

type Author struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

func (Author) Equal

func (a Author) Equal(other Author) bool

func (Author) Slugify

func (a Author) Slugify() string

func (Author) Valid

func (a Author) Valid() validator.ErrMap

type Book

type Book struct {
	Id       int64       `json:"id" db:"id"`
	Title    string      `json:"title" db:"title"`
	Subtitle null.String `json:"subtitle,omitempty" db:"subtitle"`

	// many to many (one-way)
	Author []string `json:"author"`
	Tag    []string `json:"tag,omitempty"`

	// one to many
	Isbn10 []string `json:"isbn,omitempty"`
	Isbn13 []string `json:"isbn13,omitempty"`

	NumOfPages int        `json:"num_of_pages" db:"numOfPages"`
	Progress   int        `json:"progress" db:"progress"`
	Rating     int        `json:"rating" db:"rating"`
	Status     ReadStatus `json:"status" db:"status"`

	Publisher     null.String `json:"publisher" db:"publisher"`
	DatePublished null.Time   `json:"date_published" db:"datePublished"`

	Series      null.String `json:"series,omitempty" db:"series"`
	Description null.String `json:"description,omitempty" db:"description"`
	Notes       null.String `json:"notes,omitempty" db:"notes"`

	// files
	// one to many
	Formats []string    `json:"formats,omitempty"`
	Cover   null.String `json:"cover,omitempty" db:"cover"`

	DateStarted   null.Time `json:"date_started" db:"dateStarted"`
	DateCompleted null.Time `json:"date_completed" db:"dateCompleted"`
	DateAdded     null.Time `json:"date_added" db:"dateAdded"`
}

func NewBook

func NewBook(
	title, subtitle string,
	author, tag, formats, isbn, isbn13 []string,
	numOfPages, progress, rating int,
	status ReadStatus,
	publisher, series, description, notes, cover string,
	datePublished, dateAdded, dateStarted, dateCompleted time.Time,
) *Book

func (*Book) Equal

func (b *Book) Equal(a *Book) bool

func (Book) SafeTitle

func (b Book) SafeTitle() string

func (Book) Slugify

func (b Book) Slugify() string

func (Book) UrlEncode

func (b Book) UrlEncode() string

func (Book) Valid

func (b Book) Valid() validator.ErrMap

type Books

type Books []*Book

type ReadStatus

type ReadStatus int
const (
	Unread ReadStatus = iota
	Reading
	Read
)

type Series

type Series struct {
	Id   int64  `json:"id"`
	Name string `json:"name" db:"name"`
}

func (Series) Slugify

func (a Series) Slugify() string

func (Series) Valid

func (t Series) Valid() validator.ErrMap

type Store

type Store interface {
	GetBook(id int64) (*Book, error)
	GetAllBooks(filters *filters.Book) (*page.Page[Book], error)
	CreateBook(b *Book) (*Book, error)
	UpdateBook(id int64, b *Book) (*Book, error)
	DeleteBook(id int64) error

	GetAuthor(id int64) (*Author, error)
	GetAuthorsFromBook(id int64) ([]Author, error)
	GetAllAuthors(filters *filters.Search) (*page.Page[Author], error)
	GetAllBooksFromAuthor(id int64, filters *filters.Book) (*page.Page[Book], error)
	CreateAuthor(a *Author) (*Author, error)
	UpdateAuthor(id int64, a *Author) (*Author, error)
	DeleteAuthor(id int64) error

	GetTag(id int64) (*Tag, error)
	GetTagsFromBook(id int64) ([]Tag, error)
	GetAllTags(filters *filters.Search) (*page.Page[Tag], error)
	GetAllBooksFromTag(id int64, filters *filters.Book) (*page.Page[Book], error)
	CreateTag(t *Tag) (*Tag, error)
	UpdateTag(id int64, t *Tag) (*Tag, error)
	DeleteTag(id int64) error
}

type Tag

type Tag struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

func (Tag) Parent

func (t Tag) Parent() string

func (Tag) Slugify

func (a Tag) Slugify() string

func (Tag) Valid

func (t Tag) Valid() validator.ErrMap

Directories

Path Synopsis
ui
partials
templ: version: v0.2.778
templ: version: v0.2.778
partials/icons
templ: version: v0.2.778
templ: version: v0.2.778
shared
templ: version: v0.2.778
templ: version: v0.2.778
views
templ: version: v0.2.778
templ: version: v0.2.778

Jump to

Keyboard shortcuts

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