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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNullConvert string = `sql: Scan error on column index 0, name "max(seq)": converting NULL to int is unsupported`
)

Variables

View Source
var (
	ErrBlockStepNotFound   = errors.New("step in block not found")
	ErrBlockStepNotCreated = errors.New("step in block not created")
	ErrBlockStepNotDeleted = errors.New("step in block not deleted")
	ErrBlockStepNotUpdated = errors.New("step in block not updated")
)

Functions

This section is empty.

Types

type BlockStep

type BlockStep struct {
	BlockID int `json:"block_id"`
	Seq     int `json:"seq"`
	StepID  int `json:"step_id"`
}

type CRUDInteractor

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

func NewCRUDInteractor

func NewCRUDInteractor(repo Repository) *CRUDInteractor

func (*CRUDInteractor) Add

func (i *CRUDInteractor) Add(blockID, stepID int, seq *int) error

func (*CRUDInteractor) GetRange

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

func (*CRUDInteractor) Remove

func (i *CRUDInteractor) Remove(blockID int, stepsIDs ...int) error

func (*CRUDInteractor) Swap

func (i *CRUDInteractor) Swap(blockID, seq1, seq2 int) error

type DTOBlockStep

type DTOBlockStep struct {
	Seq     int    `json:"seq"`
	StepID  int    `json:"step_id"`
	Step    string `json:"step"`
	Comment string `json:"comment"`
}

type DTOSwapRequest

type DTOSwapRequest struct {
	Seq1 int `json:"seq_1"`
	Seq2 int `json:"seq_2"`
}

type Handler

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

func NewHandler

func NewHandler(uc Usecase) *Handler

func (*Handler) BlockSteps

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

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) Swap

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

type Repo

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

func NewSQLRepository

func NewSQLRepository(db sqlutil.SQLTxDatabase) *Repo

func (*Repo) Find

func (r *Repo) Find(blockID, seq int) (*BlockStep, error)

func (*Repo) FindRange

func (r *Repo) FindRange(blockID, limit, offset int) ([]*DTOBlockStep, error)

func (*Repo) Remove

func (r *Repo) Remove(blockID int, stepsIDs ...int) error

func (*Repo) Store

func (r *Repo) Store(blockID, stepID int, seq *int) error

func (*Repo) Swap

func (r *Repo) Swap(blockID, seq1, seq2 int) error

type Repository

type Repository interface {
	FindRange(blockID int, limit, offset int) ([]*DTOBlockStep, error)
	Store(blockID, stepID int, seq *int) error
	Remove(blockID int, stepsIDs ...int) error
	Swap(blockID, seq1, seq2 int) error
}

type Usecase

type Usecase interface {
	GetRange(blockID int, limit, offset int) ([]*DTOBlockStep, error)
	Add(blockID, stepID int, seq *int) error
	Remove(blockID int, stepsIDs ...int) error
	Swap(blockID, seq1, seq2 int) error
}

Jump to

Keyboard shortcuts

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