models

package
v0.0.0-...-b17e9b0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 2 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
	Name        string `gorm:""json:"name"`
	Author      string `json:"author"`
	Publication string `json:"publication"`
}

building the Book entity using struct and gorm.model

func DeleteBook

func DeleteBook(Id int64) Book

Implementing the DeleteBook method

func GetAllBooks

func GetAllBooks() []Book

Implementing GetAllBooks method returning a slice named books

func GetBookById

func GetBookById(Id int64) (*Book, *gorm.DB)

Implementing GetBookById function which returns both Book reference from Db and DB from gorm

func (*Book) CreateBook

func (b *Book) CreateBook() *Book

Implementing reciever function CreateBook of type Book that returns book by reference.

Jump to

Keyboard shortcuts

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