employee

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

Documentation

Index

Constants

View Source
const (
	SqlGetAll = "SELECT * FROM employees"

	SqlGetById = "SELECT * FROM employees WHERE id=?"

	SqlCreate = "INSERT INTO employees (`card_number_id`, `first_name`, `last_name`, `warehouse_id`) VALUES (?, ?, ?, ?)"

	SqlUpdateFirstName = "UPDATE employees SET first_name=? WHERE id=?"

	SqlUpdate = "UPDATE employees SET first_name=?, last_name=?, warehouse_id=? WHERE id=?"

	SqlDelete = "DELETE FROM employees WHERE id=?"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Employee

type Employee struct {
	ID          int    `json:"id"`
	CardNumber  int    `json:"card_number_id"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	WareHouseID int    `json:"warehouse_id"`
}

type EmployeeInboundOrders

type EmployeeInboundOrders struct {
	ID                 int    `json:"id"`
	CardNumber         int    `json:"card_number_id"`
	FirstName          string `json:"first_name"`
	LastName           string `json:"last_name"`
	WareHouseID        int    `json:"warehouse_id"`
	InboundOrdersCount int    `json:"inbound_orders_count"`
}

type EmployeeOrderCount

type EmployeeOrderCount struct {
	ID          int    `json:"id"`
	CardNumber  int    `json:"card_number_id"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	WareHouseID int    `json:"warehouse_id"`
	Count       int    `json:"inbound_orders_count"`
}

type Repository

type Repository interface {
	Create(cardNum int, firstName string, lastName string, warehouseId int) (Employee, error)
	GetAll() ([]Employee, error)
	Delete(id int) error
	GetById(id int) (Employee, error)
	Update(id int, firstName string, lastName string, warehouseId int) (Employee, error)
}

func NewRepository

func NewRepository(db *sql.DB) Repository

type Services

type Services interface {
	Create(cardNum int, firstName string, lastName string, warehouseId int) (Employee, error)
	GetAll() ([]Employee, error)
	Delete(id int) error
	GetById(id int) (Employee, error)
	Update(emp Employee, id int) (Employee, error)
	GetCount(id, counter int) (EmployeeOrderCount, error)
}

func NewService

func NewService(r Repository) Services

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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