models

package
v0.0.0-...-4b8816d Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	gorm.Model
	Title  string `json:"title"`
	Author string `json:"author"`
}

func NewBookFromJSON

func NewBookFromJSON(b []byte) (Book, error)

func (Book) ToJSON

func (b Book) ToJSON() ([]byte, error)

type Checkout

type Checkout struct {
	gorm.Model
	FirstName   string     `json:"first_name"`
	LastName    string     `json:"last_name"`
	DNI         string     `json:"dni"`
	PhoneNumber string     `json:"phone_number"`
	BorrowedAt  time.Time  `json:"borrowed_at"`
	ReturnedAt  *time.Time `json:"returned_at"`
	Deadline    time.Time  `json:"deadline"`

	Book   Book `json:"-"`
	BookID int  `json:"book_id"`
}

func NewCheckoutFromJSON

func NewCheckoutFromJSON(b []byte) (Checkout, error)

func (Checkout) ToJSON

func (c Checkout) ToJSON() ([]byte, error)

type JSON

type JSON interface {
	ToJSON() ([]byte, error)
}

type Review

type Review struct {
	gorm.Model
	Score  int    `json:"score"`
	Review string `json:"review"`

	Book   Book `json:"-"`
	BookID int  `json:"book_id"`
}

func NewReviewFromJSON

func NewReviewFromJSON(id int, b []byte) (Review, error)

func (Review) ToJSON

func (r Review) ToJSON() ([]byte, error)

func (Review) Validate

func (r Review) Validate() error

Jump to

Keyboard shortcuts

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