book

package
v0.0.0-...-66cfffe Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Schema, _ = graphql.NewSchema(
		graphql.SchemaConfig{
			Query:    queryType,
			Mutation: mutationType,
		},
	)
)

Functions

func DeleteBook

func DeleteBook(ctx context.Context, name string) error

TODO do not return error

func GetBookByName

func GetBookByName(ctx context.Context, name string) interface{}

func GetBooks

func GetBooks(ctx context.Context, limit int) interface{}

func HttpResponseError

func HttpResponseError(w http.ResponseWriter, r *http.Request, data interface{}, code int)

func HttpResponseSuccess

func HttpResponseSuccess(w http.ResponseWriter, r *http.Request, data interface{})

func InsertBook

func InsertBook(ctx context.Context, book Book) error

TODO do not return error TODO return book

func RegisterRoutes

func RegisterRoutes(router *chi.Mux) *chi.Mux

TODO try to remove return '*chi.Mux'

func UpdateBook

func UpdateBook(ctx context.Context, updBook Book) error

TODO do not return error TODO return toUpd

Types

type Book

type Book struct {
	Name        string
	Price       float64
	Description string
}

type SetResponse

type SetResponse struct {
	Status     string      `json:"status"`
	Data       interface{} `json:"data,omitempty"`
	AccessTime string      `json:"accessTime"`
}

Jump to

Keyboard shortcuts

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