book

package
v0.0.0-...-eb172e9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDB = errors.New("Database is error")
View Source
var ErrNotFound = errors.New("Book is not found")

Functions

This section is empty.

Types

type Book

type Book struct {
	ID     uint   `json:"id" gorm:"primary_key"`
	Title  string `json:"title"`
	Author string `json:"author"`
}

type Handler

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

func NewHandler

func NewHandler(r *gin.RouterGroup, bookUseCase UseCase) *Handler

func (*Handler) GenerateRoute

func (h *Handler) GenerateRoute()

func (*Handler) Get

func (h *Handler) Get(c *gin.Context)

func (*Handler) GetByID

func (h *Handler) GetByID(c *gin.Context)

type Repository

type Repository interface {
	Get(ctx context.Context) ([]Book, error)
	GetByID(ctx context.Context, id string) (*Book, error)
}

func NewRepository

func NewRepository(conn *gorm.DB) Repository

type UseCase

type UseCase interface {
	Get(ctx context.Context) ([]Book, error)
	GetByID(ctx context.Context, id string) (*Book, error)
}

func NewUseCase

func NewUseCase(repo Repository) UseCase

Jump to

Keyboard shortcuts

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