books

package
v0.0.0-...-baf0b24 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(w http.ResponseWriter, r *http.Request)

Create use the create the book

func CreateProcess

func CreateProcess(w http.ResponseWriter, r *http.Request)

CreateProcess API end point for creation

func DeleteBook

func DeleteBook(r *http.Request) error

DeleteBook remove a particular book

func DeleteProcess

func DeleteProcess(w http.ResponseWriter, r *http.Request)

DeleteProcess API entry to so delete a book

func Index

func Index(w http.ResponseWriter, r *http.Request)

Index gets all the data one time

func Show

func Show(w http.ResponseWriter, r *http.Request)

Show generally shows one particular book but needs a parameter in get

func ShowJSON

func ShowJSON(w http.ResponseWriter, r *http.Request)

ShowJSON gets all the data one time and shows the in JSON format

func Update

func Update(w http.ResponseWriter, r *http.Request)

Update shows the last book that was updated

func UpdateProcess

func UpdateProcess(w http.ResponseWriter, r *http.Request)

UpdateProcess API endpoint for editing the book entry

Types

type Book

type Book struct {
	// ID     bson.ObjectId `json:"id" bson:"_id"`
	Isbn   string  `json:"isbn" bson:"isbn"`
	Title  string  `json:"title" bson:"title"`
	Author string  `json:"author" bson:"author"`
	Price  float32 `json:"price" bson:"price"`
}

Book data

func AllBooks

func AllBooks() ([]Book, error)

AllBooks get all books

func OneBook

func OneBook(r *http.Request) (Book, error)

OneBook get a selected book based on request fields

func PutBook

func PutBook(r *http.Request) (Book, error)

PutBook used to insert a particual book

func UpdateBook

func UpdateBook(r *http.Request) (Book, error)

UpdateBook used to update a specific book

Jump to

Keyboard shortcuts

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