db

package
v0.0.0-...-b84815f Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect() (*sql.DB, error)

Connect returns connection to MySQL

Types

type CompanyDAC

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

CompanyDAC is a company table data access class

func NewCompanyDAC

func NewCompanyDAC(db *sql.DB) *CompanyDAC

NewCompanyDAC creates new company DAC

func (*CompanyDAC) CheckExist

func (dac *CompanyDAC) CheckExist(id int) bool

CheckExist checks are company with id exists

func (*CompanyDAC) CreateItem

func (dac *CompanyDAC) CreateItem(company *model.Company) (int, error)

CreateItem creates new company

func (*CompanyDAC) DeleteItem

func (dac *CompanyDAC) DeleteItem(id int) error

DeleteItem removes company

func (*CompanyDAC) GetItem

func (dac *CompanyDAC) GetItem(id int) (*model.Company, error)

GetItem returns company by id

func (*CompanyDAC) GetList

func (dac *CompanyDAC) GetList() ([]*model.Company, error)

GetList returns list of all companies

func (*CompanyDAC) UpdateItem

func (dac *CompanyDAC) UpdateItem(company *model.Company) error

UpdateItem updates company

type ContractDAC

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

ContractDAC is a company table data access class

func NewContractDAC

func NewContractDAC(db *sql.DB) *ContractDAC

NewContractDAC creates new company DAC

func (*ContractDAC) CheckExist

func (dac *ContractDAC) CheckExist(id int) bool

CheckExist checks are company with id exists

func (*ContractDAC) CreateItem

func (dac *ContractDAC) CreateItem(contract *model.Contract) (int, error)

CreateItem creates new contract

func (*ContractDAC) DeleteItem

func (dac *ContractDAC) DeleteItem(id int) error

DeleteItem removes contract

func (*ContractDAC) GetItem

func (dac *ContractDAC) GetItem(id int) (*model.Contract, error)

GetItem returns contract by id

func (*ContractDAC) GetList

func (dac *ContractDAC) GetList() ([]*model.Contract, error)

GetList returns list of all contracts

func (*ContractDAC) UpdateItem

func (dac *ContractDAC) UpdateItem(contract *model.Contract) error

UpdateItem updates contract

type PurchaseDAC

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

PurchaseDAC is a purchase table data access class

func NewPurchaseDAC

func NewPurchaseDAC(db *sql.DB) *PurchaseDAC

NewPurchaseDAC creates new company DAC

func (*PurchaseDAC) AddItem

func (dac *PurchaseDAC) AddItem(purchase *model.Purchase) (int, error)

AddItem creates new purchase document

func (*PurchaseDAC) GetContractHistory

func (dac *PurchaseDAC) GetContractHistory(id int) ([]*model.Purchase, error)

GetContractHistory returns purchase history of contract

func (*PurchaseDAC) GetContractSum

func (dac *PurchaseDAC) GetContractSum(id int) int

GetContractSum returns purchase sum of contract

Jump to

Keyboard shortcuts

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