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 (
	ErrBlockContactNotFound   = errors.New("contact in block not found")
	ErrBlockContactNotCreated = errors.New("contact in block not created")
	ErrBlockContactNotDeleted = errors.New("contact in block not deleted")
	ErrBlockContactNotUpdated = errors.New("contact in block not updated")
)

Functions

This section is empty.

Types

type BlockContact

type BlockContact struct {
	ID      int    `json:"id"`
	Contact string `json:"contact"`
	Mode    string `json:"mode"`
	OType   string `json:"o_type"`
	OpMode  string `json:"op_mode"`
}

type CRUDInteractor

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

func NewCRUDInteractor

func NewCRUDInteractor(repo Repository) *CRUDInteractor

func (*CRUDInteractor) Add

func (i *CRUDInteractor) Add(bcs ...*BlockContact) error

func (*CRUDInteractor) Delete

func (i *CRUDInteractor) Delete(blockID int, cs ...string) error

func (*CRUDInteractor) Get

func (i *CRUDInteractor) Get(blockID int, contact string) (*BlockContact, error)

func (*CRUDInteractor) GetRange

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

func (*CRUDInteractor) Update

func (i *CRUDInteractor) Update(prevContact string, bc *BlockContact) error

type DTO

type DTO struct {
	Mode   string `json:"mode,omitempty"`
	OType  string `json:"o_type,omitempty"`
	OpMode string `json:"op_mode,omitempty"`
}

type DTOItem

type DTOItem struct {
	Contact string `json:"contact,omitempty"`
	Mode    string `json:"mode,omitempty"`
	OType   string `json:"o_type,omitempty"`
	OpMode  string `json:"op_mode,omitempty"`
}

type Handler

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

func NewHandler

func NewHandler(uc Usecase) *Handler

func (*Handler) BlockContact

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

func (*Handler) BlockContacts

func (h *Handler) BlockContacts(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) 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(blockID int, contact string) (*BlockContact, error)

func (*Repo) FindRange

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

func (*Repo) Remove

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

func (*Repo) Store

func (r *Repo) Store(bcs ...*BlockContact) error

func (*Repo) Update

func (r *Repo) Update(prevContact string, bc *BlockContact) error

type Repository

type Repository interface {
	Find(blockID int, contact string) (*BlockContact, error)
	FindRange(blockID int, limit, offset int) ([]*BlockContact, error)
	Store(bcs ...*BlockContact) error
	Remove(blockID int, cs ...string) error
	Update(prevContact string, bc *BlockContact) error
}

type Usecase

type Usecase interface {
	Get(blockID int, contact string) (*BlockContact, error)
	GetRange(blockID int, limit, offset int) ([]*BlockContact, error)
	Add(bcs ...*BlockContact) error
	Delete(blockID int, cs ...string) error
	Update(prevContact string, bc *BlockContact) error
}

Jump to

Keyboard shortcuts

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