model

package
v0.0.0-...-aec8730 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	ID        uint      `gorm:"primarykey;autoincrement"`
	Name      string    `json:"name"`
	Books     *[]Book   `json:"books" gorm:"-"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*Author) Delete

func (a *Author) Delete(db *gorm.DB, id int) error

func (*Author) GetAll

func (a *Author) GetAll(db *gorm.DB) (*[]Author, error)

func (*Author) GetByID

func (a *Author) GetByID(db *gorm.DB, id uint) error

func (*Author) Save

func (a *Author) Save(db *gorm.DB) error

func (*Author) Update

func (a *Author) Update(db *gorm.DB, id int) error

type Book

type Book struct {
	ID          uint      `gorm:"primarykey;autoincrement"`
	ISBN        string    `json:"isbn"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	AuthorID    uint      `json:"author_id"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

func (*Book) Delete

func (b *Book) Delete(db *gorm.DB, id int) error

func (*Book) GetAll

func (b *Book) GetAll(db *gorm.DB) (*[]Book, error)

func (*Book) GetByAuthorID

func (b *Book) GetByAuthorID(db *gorm.DB, authorID int) (*[]Book, error)

func (*Book) GetByID

func (b *Book) GetByID(db *gorm.DB, id uint) error

func (*Book) GetByISBN

func (b *Book) GetByISBN(db *gorm.DB, isbn string) error

func (*Book) Save

func (b *Book) Save(db *gorm.DB) error

func (*Book) Update

func (b *Book) Update(db *gorm.DB, id int) error

Jump to

Keyboard shortcuts

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