server

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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