Documentation ¶
Index ¶
- type Account
- type Authority
- type Book
- func (b *Book) Create(rep repository.Repository) (*Book, error)
- func (b *Book) Delete(rep repository.Repository) (*Book, error)
- func (b *Book) FindAll(rep repository.Repository) (*[]Book, error)
- func (b *Book) FindAllByPage(rep repository.Repository, page int, size int) (*Page, error)
- func (b *Book) FindByID(rep repository.Repository, id uint) (*Book, error)
- func (b *Book) FindByTitle(rep repository.Repository, title string, page int, size int) (*Page, error)
- func (b *Book) Save(rep repository.Repository) (*Book, error)
- func (Book) TableName() string
- func (b *Book) ToString() (string, error)
- func (b *Book) Update(rep repository.Repository) (*Book, error)
- type Category
- func (c *Category) Create(rep repository.Repository) (*Category, error)
- func (c *Category) FindAll(rep repository.Repository) (*[]Category, error)
- func (c *Category) FindByID(rep repository.Repository, id uint) (*Category, error)
- func (Category) TableName() string
- func (c *Category) ToString() (string, error)
- type Format
- type Page
- type RecordAccount
- type RecordBook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID uint `gorm:"primary_key" json:"id"` Name string `json:"name"` Password string `json:"-"` AuthorityID uint `json:"authority_id"` Authority *Authority `json:"authority"` }
Account defines struct of account data.
func NewAccount ¶
NewAccount is constructor.
func NewAccountWithPlainPassword ¶
NewAccountWithPlainPassword is constructor. And it is encoded plain text password by using bcrypt.
func (*Account) Create ¶
func (a *Account) Create(rep repository.Repository) (*Account, error)
Create persists this account data.
func (*Account) FindByName ¶
func (a *Account) FindByName(rep repository.Repository, name string) (*Account, error)
FindByName returns accounts full matched given account name.
type Authority ¶
Authority defines struct of authority data.
func (*Authority) Create ¶
func (a *Authority) Create(rep repository.Repository) (*Authority, error)
Create persists this authority data.
type Book ¶
type Book struct { ID uint `gorm:"primary_key" json:"id"` Title string `json:"title"` Isbn string `json:"isbn"` CategoryID uint `json:"categoryId"` Category *Category `json:"category"` FormatID uint `json:"formatId"` Format *Format `json:"format"` }
Book defines struct of book data.
func (*Book) Create ¶
func (b *Book) Create(rep repository.Repository) (*Book, error)
Create persists this book data.
func (*Book) Delete ¶
func (b *Book) Delete(rep repository.Repository) (*Book, error)
Delete deletes this book data.
func (*Book) FindAll ¶
func (b *Book) FindAll(rep repository.Repository) (*[]Book, error)
FindAll returns all books of the book table.
func (*Book) FindAllByPage ¶
func (b *Book) FindAllByPage(rep repository.Repository, page int, size int) (*Page, error)
FindAllByPage returns the page object of all books.
func (*Book) FindByID ¶
func (b *Book) FindByID(rep repository.Repository, id uint) (*Book, error)
FindByID returns a book full matched given book's ID.
func (*Book) FindByTitle ¶
func (b *Book) FindByTitle(rep repository.Repository, title string, page int, size int) (*Page, error)
FindByTitle returns the page object of books partially matched given book title.
func (*Book) Save ¶
func (b *Book) Save(rep repository.Repository) (*Book, error)
Save persists this book data.
func (*Book) Update ¶
func (b *Book) Update(rep repository.Repository) (*Book, error)
Update updates this book data.
type Category ¶
type Category struct { ID uint `gorm:"primary_key" json:"id"` Name string `validate:"required" json:"name"` }
Category defines struct of category data.
func (*Category) Create ¶
func (c *Category) Create(rep repository.Repository) (*Category, error)
Create persists this category data.
func (*Category) FindAll ¶
func (c *Category) FindAll(rep repository.Repository) (*[]Category, error)
FindAll returns all categories of the category table.
func (*Category) FindByID ¶
func (c *Category) FindByID(rep repository.Repository, id uint) (*Category, error)
FindByID returns a category full matched given category's ID.
type Format ¶
type Format struct { ID uint `gorm:"primary_key" json:"id"` Name string `validate:"required" json:"name"` }
Format defines struct of format data.
func (*Format) Create ¶
func (f *Format) Create(rep repository.Repository) (*Format, error)
Create persists this category data.
func (*Format) FindAll ¶
func (f *Format) FindAll(rep repository.Repository) (*[]Format, error)
FindAll returns all formats of the format table.
func (*Format) FindByID ¶
func (f *Format) FindByID(rep repository.Repository, id uint) (*Format, error)
FindByID returns a format full matched given format's ID.
type Page ¶
type Page struct { Content *[]Book `json:"content"` Last bool `json:"last"` TotalElements int `json:"totalElements"` TotalPages int `json:"totalPages"` Size int `json:"size"` Page int `json:"page"` NumberOfElements int `json:"numberOfElements"` }
Page defines struct of pagination data.