server

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewController

func NewController(logger *log.Logger) *server

func NewControllerWithBooks

func NewControllerWithBooks(logger *log.Logger, data []*Book) *server

Types

type Address

type Address struct {
	Street      string `json:"street"`
	City        string `json:"city"`
	State       string `json:"state"`
	PostalCode  string `json:"postal_code"`
	CountryCode string `json:"country_code"`
}

type Author

type Author struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Book

type Book struct {
	ID          string     `json:"id"`
	Title       string     `json:"title"`
	PublishedOn string     `json:"published_on"`
	Author      *Author    `json:"author"`
	Publisher   *Publisher `json:"publisher"`
	Pages       int        `json:"pages"`
}

func (*Book) CategoryByLength

func (b *Book) CategoryByLength() string

type CreateBookRequest

type CreateBookRequest struct {
	Title       string `json:"title"`
	AuthorID    string `json:"author_id"`
	PublisherID string `json:"publisher_id"`
	PublishedOn string `json:"published_on"`
	Pages       int    `json:"pages"`
}

type ListBooksResponse

type ListBooksResponse struct {
	Books []*Book `json:"books"`
}

type Publisher

type Publisher struct {
	ID      string   `json:"id"`
	Name    string   `json:"name"`
	Address *Address `json:"address"`
}

type ReplaceBookRequest

type ReplaceBookRequest struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	AuthorID    string `json:"author_id"`
	PublisherID string `json:"publisher_id"`
	PublishedOn string `json:"published_on"`
	Pages       int    `json:"pages"`
}

type ReplaceBooksRequest

type ReplaceBooksRequest []*ReplaceBookRequest

Jump to

Keyboard shortcuts

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