book

package
v0.0.0-...-cec8117 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

schema

Functions

func GetBookByID

func GetBookByID(ctx context.Context, id string) (result interface{})

func GetBookByName

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

func GetBookList

func GetBookList(ctx context.Context, limit int) (result 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

func RegisterRoutes

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

func RestApiGetBook

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

func RestApiGetBookAllBooks

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

Rest API

func UpdateBook

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

Types

type Book

type Book struct {
	ID          string
	Name        string
	Price       float64
	Description string
}

func DeleteBook

func DeleteBook(ctx context.Context, id string) (Book, error)

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