words

package
v0.0.0-...-24031bd Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCreateWordHandler

func NewCreateWordHandler(repo Repository) http.Handler

func NewGetAllWordsHandler

func NewGetAllWordsHandler(repo Repository) http.Handler

Types

type CreateWordHandler

type CreateWordHandler struct {
	Repository Repository
}

func (CreateWordHandler) Handle

func (h CreateWordHandler) Handle(w http.ResponseWriter, req *http.Request) (interface{}, error)

type Entry

type Entry struct {
	Id      int    `db:"id" json:"id"`
	Word    string `db:"word" json:"word"`
	Meaning string `db:"meaning" json:"meaning"`
}

func (Entry) IsValid

func (e Entry) IsValid() bool

type GetAllWordsHandler

type GetAllWordsHandler struct {
	Repository Repository
}

func (GetAllWordsHandler) Handle

func (h GetAllWordsHandler) Handle(_ http.ResponseWriter, _ *http.Request) (interface{}, error)

type PgRepository

type PgRepository struct {
	Db infrastructure.DB
}

func (PgRepository) GetAll

func (repo PgRepository) GetAll() ([]Entry, error)

func (PgRepository) Save

func (repo PgRepository) Save(entry Entry) error

type Repository

type Repository interface {
	Save(entry Entry) error
	GetAll() (entries []Entry, err error)
}

func NewRepository

func NewRepository(config infrastructure.DbConfig) Repository

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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