Discover Packages
github.com/macperez/books
models
package
Version:
v0.0.0-...-352e712
Opens a new window with list of versions in this module.
Published: Jul 2, 2020
License: GPL-3.0
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
GetDB returns the connection
func InsertAuthor(author Author )
InsertAuthor insert a new author in DB
InsertBook insert a new author in DB
type Author struct {
ID uint `gorm:"primary_key"`
Firstname string `json:"FirstName"`
Lastname string `json:"LastName"`
}
Author represents an author or creator of the book
GetAuthor return an Author given its id
GetAuthors return all the books existing in DB
TableName change the by-dafault name of the table
type Book struct {
Isbn string `gorm:"primary_key" json:"ISBN"`
Name string `json:"name"`
Author Author `gorm:"foreignkey:AuthorID" json:",omitempty"`
AuthorID uint `json:"-"`
}
Book entity
GetBook return an Author given its ISBN
GetBooks return all the books existing in DB
TableName change the by-dafault name of the table
Source Files
¶
Click to show internal directories.
Click to hide internal directories.