todo

package
v0.0.0-...-37f0314 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetResponse

type GetResponse struct {
	Items []Item `json:"items"`
}

func GetItems

func GetItems(ctx context.Context, pool *pgxpool.Pool) (*GetResponse, error)

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(pool *pgxpool.Pool) *Handler

func (*Handler) GET

func (h *Handler) GET(ctx echo.Context) error

func (*Handler) POST

func (h *Handler) POST(ctx echo.Context) error

func (*Handler) PUT

func (h *Handler) PUT(ctx echo.Context) error

type Item

type Item struct {
	ID        int64     `json:"id"`
	Title     string    `json:"title"`
	UpdatedAt time.Time `json:"updated_at"`
}

func NewItem

func NewItem(item repository.Item) Item

func NewItems

func NewItems(items []repository.Item) []Item

type PostParams

type PostParams struct {
	Title string `json:"title"`
}

func (PostParams) Validate

func (p PostParams) Validate() error

type PostResponse

type PostResponse struct {
	Item Item `json:"item"`
}

func CreateItem

func CreateItem(ctx context.Context, pool *pgxpool.Pool, p PostParams) (*PostResponse, error)

type PutParams

type PutParams struct {
	ID    int64  `param:"id"`
	Title string `json:"title"`
}

func (PutParams) Validate

func (p PutParams) Validate() error

type PutResponse

type PutResponse struct {
	Item Item `json:"item"`
}

func UpdateItem

func UpdateItem(ctx context.Context, pool *pgxpool.Pool, p PutParams) (*PutResponse, error)

Jump to

Keyboard shortcuts

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