step

package
v0.0.0-...-b76d47b Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStepNotFound   = errors.New("step not found")
	ErrStepNotCreated = errors.New("step not created")
	ErrStepNotDeleted = errors.New("step not deleted")
	ErrStepNotUpdated = errors.New("step not updated")
	ErrStepNameEmpty  = errors.New("empty step name not allowed")
	ErrMessageEmpty   = errors.New("message is required")
)

Functions

This section is empty.

Types

type CRUDInteractor

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

func NewUsecases

func NewUsecases(repo Repository) *CRUDInteractor

func (CRUDInteractor) Add

func (i CRUDInteractor) Add(newStep *Step) (int64, error)

func (CRUDInteractor) Delete

func (i CRUDInteractor) Delete(id int) error

func (CRUDInteractor) Get

func (i CRUDInteractor) Get(id int) (*Step, error)

func (CRUDInteractor) GetRange

func (i CRUDInteractor) GetRange(limit, offset int) ([]*Step, error)

func (CRUDInteractor) Update

func (i CRUDInteractor) Update(newStep *Step) error

type DTO

type DTO struct {
	Name        string `json:"name"`
	Comment     string `json:"comment,omitempty"`
	WithMessage bool   `json:"with_message"`
	Message     string `json:"message,omitempty"`
}

func (*DTO) Bind

func (s *DTO) Bind(*http.Request) error

func (*DTO) Validate

func (s *DTO) Validate() error

type DTOItem

type DTOItem struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Comment string `json:"comment"`
}

type Handler

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

func NewHandler

func NewHandler(interactor Interactor) *Handler

func (*Handler) Create

func (h *Handler) Create(w http.ResponseWriter, r *http.Request)

func (*Handler) Delete

func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)

func (*Handler) Step

func (h *Handler) Step(w http.ResponseWriter, r *http.Request)

func (*Handler) Steps

func (h *Handler) Steps(w http.ResponseWriter, r *http.Request)

func (*Handler) Update

func (h *Handler) Update(w http.ResponseWriter, r *http.Request)

type Interactor

type Interactor interface {
	Get(id int) (*Step, error)
	GetRange(limit, offset int) ([]*Step, error)
	Add(newStep *Step) (int64, error)
	Delete(id int) error
	Update(newStep *Step) error
}

type Repository

type Repository interface {
	Find(id int) (*Step, error)
	FindRange(limit, offset int) ([]*Step, error)
	Store(newStep *Step) (int64, error)
	Remove(id int) error
	Update(newStep *Step) error
}

func NewSQLRepository

func NewSQLRepository(db sqlutil.SQLDatabase) Repository

type Step

type Step struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Comment     string `json:"comment"`
	WithMessage bool   `json:"with_message"`
	Message     string `json:"message"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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