domain

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Location returns this backend's location (the directory name).
	Location() string

	// Create the backend resources
	Create() error

	Save(Serializable) error
}

type Collection

type Collection struct {
	Entries  []*Entry `json:"entries"`
	Category string   `json:"category"`
	Filter   string   `json:"filter"`
	Username string   `json:"username"`
}

func NewCollection

func NewCollection(entries []*Entry, Category, Filter, Username string) *Collection

func (*Collection) CSV

func (c *Collection) CSV() []*Entry

func (*Collection) JSON

func (c *Collection) JSON() interface{}

func (*Collection) Slug

func (c *Collection) Slug() string

type Entry

type Entry struct {
	ID            string   `json:"id"`
	Title         string   `json:"title"`
	OriginalTitle string   `json:"original_title,omitempty"`
	Year          int      `json:"year,omitempty"`
	Authors       []string `json:"authors"`
	Rating        int      `json:"rating,omitempty"`
	DoneDate      string   `json:"done_date,omitempty"`
	Comment       string   `json:"comment,omitempty"`
	Favorite      bool     `json:"favorite"`
	Genres        []string `json:"genres,omitempty"`
}

Entry represents an entry in a collection or list : a movie, series, books, etc...

type Formatter

type Formatter interface {
	// Format the entries and save them to the backend
	Format(entries Serializable, writer io.Writer) error
	// Ext returns the file extension
	Ext() string
}

type List

type List struct {
	Entries     []*Entry `json:"entries"`
	Title       string   `json:"title"`
	Description string   `json:"description,omitempty"`
}

func NewList

func NewList(entries []*Entry, Title, Description string) *List

func (*List) CSV

func (l *List) CSV() []*Entry

func (*List) JSON

func (l *List) JSON() interface{}

func (*List) Slug

func (l *List) Slug() string

type Serializable

type Serializable interface {
	Slug() string
	CSV() []*Entry
	JSON() interface{}
}

Jump to

Keyboard shortcuts

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