seller

package
v0.0.0-...-e85e4ab Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GETALL  = "SELECT * FROM sellers"
	GETBYID = "SELECT * FROM sellers WHERE id=?"
	INSERT  = "INSERT INTO sellers (cid, company_name, address, telephone, locality_id) VALUES (?,?,?,?,?)"
	UPDATE  = "UPDATE sellers SET cid=?, company_name=?, address=?, telephone=?, locality_id=? WHERE id=?"
	DELETE  = "DELETE FROM sellers WHERE id=?"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	GetOne(ctx context.Context, id int) (Seller, error)
	GetAll(ctx context.Context) ([]Seller, error)
	Create(ctx context.Context, cid int, companyName, address, telephone string, localityID int) (Seller, error)
	Update(ctx context.Context, cid int, companyName, address, telephone string, localityID int, seller Seller) (Seller, error)
	Delete(ctx context.Context, id int) error
}

func NewMariaDBRepository

func NewMariaDBRepository(db *sql.DB) Repository

type Seller

type Seller struct {
	Id          int    `json:"id"`
	CompanyId   int    `json:"cid"`
	CompanyName string `json:"company_name"`
	Address     string `json:"address"`
	Telephone   string `json:"telephone"`
	LocalityID  int    `json:"locality_id"`
}

type Service

type Service interface {
	GetOne(ctx context.Context, id int) (Seller, error)
	GetAll(ctx context.Context) ([]Seller, error)
	Create(ctx context.Context, cid int, companyName, address, telephone string, localityID int) (Seller, error)
	Update(ctx context.Context, id, cid int, companyName, address, telephone string, localityID int) (Seller, error)
	Delete(ctx context.Context, id int) error
}

func NewService

func NewService(r Repository, lr l.Repository) Service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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