contact

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStepContactNotFount   = errors.New("step contacts not found")
	ErrStepContactNotCreated = errors.New("step contacts not created")
	ErrStepContactNotDeleted = errors.New("step contacts not deleted")
	ErrStepContactNotUpdated = errors.New("step contacts not updated")
)

Functions

This section is empty.

Types

type CRUDInteractor

type CRUDInteractor interface {
	Get(stepID int, contact string) (*StepContact, error)
	GetRange(stepID, limit, offset int) ([]*StepContact, error)
	Add(stepContacts ...*StepContact) error
	Delete(stepID int, contact string) error
	Update(prevContact string, new *StepContact) error
}

func NewCRUDInteractor

func NewCRUDInteractor(repo Repository) CRUDInteractor

type DTO

type DTO struct {
	Seq      int           `json:"seq"`
	PinState string        `json:"pin_state,omitempty"`
	Delay    time.Duration `json:"delay"`
}

type DTOItem

type DTOItem struct {
	Contact  string        `json:"contact,omitempty"`
	Seq      int           `json:"seq"`
	PinState string        `json:"pin_state,omitempty"`
	Delay    time.Duration `json:"delay"`
}

type Handler

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

func NewHandlers

func NewHandlers(usecases CRUDInteractor) *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) StepContact

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

func (Handler) StepContacts

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

func (Handler) Update

func (h Handler) Update(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(stepID int, contact string) (*StepContact, error)

func (*Repo) FindRange

func (r *Repo) FindRange(stepID, limit, offset int) ([]*StepContact, error)

func (*Repo) Remove

func (r *Repo) Remove(stepID int, cs ...string) error

func (*Repo) Store

func (r *Repo) Store(scs ...*StepContact) error

func (*Repo) Update

func (r *Repo) Update(prevContact string, sc *StepContact) error

type Repository

type Repository interface {
	Find(stepID int, contact string) (*StepContact, error)
	FindRange(stepID, limit, offset int) ([]*StepContact, error)
	Store(new ...*StepContact) error
	Remove(stepID int, contacts ...string) error
	Update(prevContact string, new *StepContact) error
}

type StepContact

type StepContact struct {
	ID       int           `json:"step_id"`
	Contact  string        `json:"contact"`
	Seq      int           `json:"seq"`
	PinState string        `json:"pin_state"`
	Delay    time.Duration `json:"delay"`
}

Jump to

Keyboard shortcuts

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