book

package
v0.0.0-...-b8344f8 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RateOne = Rating(iota + 1)
	RateTwo
	RateThree
)

Rating values

View Source
const (
	StatusCheckedIn  = Status("CheckedIn")
	StatusCheckedOut = Status("CheckedOut")
)

Status values

Variables

View Source
var (
	ErrTitleIsRequired   = errors.New("Title is required")
	ErrAuthorIsRequired  = errors.New("Author is required")
	ErrPubDateIsRequired = errors.New("PubDate is required")
	ErrRatingInvalid     = errors.New("Rating value is not supported")
	ErrStatusInvalid     = errors.New("Status value is not supported")
)

Validation Errors

Functions

This section is empty.

Types

type Book

type Book struct {
	ID      string
	Title   string
	Author  string
	PubDate time.Time
	Rating  Rating
	Status  Status
}

Book entity

func NewBook

func NewBook(
	title, author string,
	pubdate time.Time,
	rating Rating,
	status Status,
) Book

NewBook creates a new Book

func (Book) Validate

func (b Book) Validate() error

Validate the Book object

type Rating

type Rating int

Rating is a book rating from 1 to 3

func (Rating) Int

func (r Rating) Int() int

Int returns the int type

func (Rating) String

func (r Rating) String() string

type Status

type Status string

Status is the status of the book, checked in or out

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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