api

package
v0.0.0-...-398e186 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllBooksHandler

func AllBooksHandler(ctx iris.Context)

AllBooksHandler to be used as Handler for Book API

func CreateBook

func CreateBook(book Book) (string, bool)

CreateBook creates a new Book if it does not exist

func CreateBookHandler

func CreateBookHandler(ctx iris.Context)

CreateBookHandler to be used as Handler for Book API

func DeleteBook

func DeleteBook(isbn string)

DeleteBook removes a book from the map by ISBN key

func DeleteBookHandler

func DeleteBookHandler(ctx iris.Context)

DeleteBookHandler to be used as Handler for Book API

func EchoHandler

func EchoHandler(ctx iris.Context)

EchoHandler to be used as Handler for ECHO API

func GetBookHandler

func GetBookHandler(ctx iris.Context)

GetBookHandler to be used as Handler for Book API

func HelloHandler

func HelloHandler(ctx iris.Context)

HelloHandler to be used as Handler for Hello API

func UpdateBook

func UpdateBook(isbn string, book Book) bool

UpdateBook updates an existing book

func UpdateBookHandler

func UpdateBookHandler(ctx iris.Context)

UpdateBookHandler to be used as Handler for Book API

Types

type Book

type Book struct {
	Title       string `json:"title"`
	Author      string `json:"author"`
	ISBN        string `json:"isbn"`
	Description string `json:"description,omitempty"`
}

Book type with Name, Author and ISBN

func AllBooks

func AllBooks() []Book

AllBooks returns a slice of all books

func GetBook

func GetBook(isbn string) (Book, bool)

GetBook returns the book for a given ISBN

type Hello

type Hello struct {
	Message string
}

Hello response structure

Jump to

Keyboard shortcuts

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