books

package
v1.3.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Book

type Book struct {
	Author string             `bson:"author,omitempty" json:"author,omitempty"`
	ID     primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Pages  int                `bson:"pages,omitempty" json:"pages,omitempty"`
	Title  string             `bson:"title,omitempty" json:"title,omitempty"`
}

func Create

func Create(ctx context.Context, cReq *CreateReq) (*Book, error)

func Delete

func Delete(ctx context.Context, dReq *DeleteReq) (*Book, error)

func Get

func Get(ctx context.Context, gReq *GetReq) (*Book, error)

func Update

func Update(ctx context.Context, uReq *UpdateReq) (*Book, error)

type CreateReq

type CreateReq struct {
	Author string `json:"author,omitempty"`
	Title  string `json:"title,omitempty"`
	Pages  int    `json:"pages"`
}

func (*CreateReq) Valid

func (cReq *CreateReq) Valid() error

Valid is a naive implementation of a validator for the Book CreateReq In production you should use something like https://github.com/go-playground/validator to perform validation in-line with unmarshalling for a more cohesive experience

type DeleteReq

type DeleteReq struct {
	ID primitive.ObjectID `lambda:"path.id" json:"id,omitempty"`
}

func (*DeleteReq) Valid

func (dReq *DeleteReq) Valid() error

Valid is a naive implementation of a validator for the Book DeleteReq In production you should use something like https://github.com/go-playground/validator to perform validation in-line with unmarshalling for a more cohesive experience

type GetReq

type GetReq struct {
	ID primitive.ObjectID `lambda:"path.id" json:"id,omitempty"`
}

func (*GetReq) Valid

func (gReq *GetReq) Valid() error

Valid is a naive implementation of a validator for the Book GetReq In production you should use something like https://github.com/go-playground/validator to perform validation in-line with unmarshalling for a more cohesive experience

type UpdateReq

type UpdateReq struct {
	Author string             `json:"author,omitempty"`
	ID     primitive.ObjectID `lambda:"path.id" json:"id,omitempty"`
	Pages  int                `json:"pages"`
	Title  string             `json:"title,omitempty"`
}

func (*UpdateReq) Valid

func (uReq *UpdateReq) Valid() error

Valid is a naive implementation of a validator for the Book UpdateReq In production you should use something like https://github.com/go-playground/validator to perform validation in-line with unmarshalling for a more cohesive experience

Jump to

Keyboard shortcuts

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