models

package
v0.0.0-...-ddb411c Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DestroyBranch

func DestroyBranch(db *sqlx.DB, id int) (int64, error)

DestroyBranch delete branch by id

func DestroyCategory

func DestroyCategory(db *sqlx.DB, id int) (int64, error)

DestroyCategory delete category by id

func DestroyCustomer

func DestroyCustomer(db *sqlx.DB, id int) (int64, error)

DestroyCustomer delete customer by id

func DestroyInventory

func DestroyInventory(db *sqlx.DB, id int) (int64, error)

DestroyInventory delete inventory by id

func DestroyItem

func DestroyItem(db *sqlx.DB, id int) (int64, error)

DestroyItem delete item by id

func DestroyModifier

func DestroyModifier(db *sqlx.DB, id int) (int64, error)

DestroyModifier delete modifier by id

func DestroySale

func DestroySale(db *sqlx.DB, id int) (int64, error)

DestroySale delete sale by id

func DestroySaleItem

func DestroySaleItem(db *sqlx.DB, id int) (int64, error)

DestroySaleItem delete SaleItem by id

func DestroySupplier

func DestroySupplier(db *sqlx.DB, id int) (int64, error)

DestroySupplier delete supplier by id

func DestroyTransfer

func DestroyTransfer(db *sqlx.DB, id int) (int64, error)

DestroyTransfer delete transfer by id

func DestroyUser

func DestroyUser(db *sqlx.DB, id int) (int64, error)

DestroyUser delete user by id

func StoreBranch

func StoreBranch(db *sqlx.DB, branch *Branch) (int64, error)

StoreBranch create new branch

func StoreCategory

func StoreCategory(db *sqlx.DB, category *Category) (int64, error)

StoreCategory create new category

func StoreCustomer

func StoreCustomer(db *sqlx.DB, customer *Customer) (int, error)

StoreCustomer create new customer

func StoreInventories

func StoreInventories(db *sqlx.DB, binv *BatchInventory) (int64, error)

StoreInventories create new item

func StoreInventory

func StoreInventory(db *sqlx.DB, inventory *Inventory) (int64, error)

StoreInventory create new inventory

func StoreItem

func StoreItem(db *sqlx.DB, item *Item) (int64, error)

StoreItem create new item

func StoreModifier

func StoreModifier(db *sqlx.DB, modifier *Modifier) (int64, error)

StoreModifier create new modifier

func StoreSale

func StoreSale(db *sqlx.DB, sale *Sale) (int, error)

StoreSale create new sale

func StoreSaleItem

func StoreSaleItem(db *sqlx.DB, saleItem *SaleItem) (int64, error)

StoreSaleItem create new SaleItem

func StoreSupplier

func StoreSupplier(db *sqlx.DB, supplier *Supplier) (int64, error)

StoreSupplier create new supplier

func StoreTransfer

func StoreTransfer(db *sqlx.DB, branchID int) (int64, error)

StoreTransfer create new transfer

func StoreUser

func StoreUser(db *sqlx.DB, user *User) (int64, error)

StoreUser create new user

func UpdateSaleStatus

func UpdateSaleStatus(db *sqlx.DB, saleID int, status string) (int, error)

UpdateSaleStatus - update sale status

Types

type BatchInventory

type BatchInventory struct {
	BranchFrom int `json:"branch_from"`
	BranchTo   int `json:"branch_to"`
	Data       []BatchItem
}

type BatchItem

type BatchItem struct {
	ID    int    `json:"id"`
	Value string `json:"value"`
}

type Branch

type Branch struct {
	ID   int    `json:"id"`
	Code string `json:"code"`
	Name string `json:"name"`
}

Branch - Branch struct

func GetBranch

func GetBranch(db *sqlx.DB, id int) (Branch, error)

GetBranch get one branch

func GetBranches

func GetBranches(db *sqlx.DB) ([]Branch, error)

GetBranches get all branches

type Category

type Category struct {
	ID                  int    `json:"id" db:"id"`
	Code                string `json:"code" db:"code"`
	CategoryDescription string `json:"category_description" db:"category_description"`
}

func GetCategories

func GetCategories(db *sqlx.DB) ([]Category, error)

GetCategories get all categories

func GetCategory

func GetCategory(db *sqlx.DB, id int) (Category, error)

GetCategory get one category

type Customer

type Customer struct {
	ID              int    `json:"id" db:"id"`
	CustomerName    string `json:"customer_name" db:"customer_name"`
	CustomerNumber  string `json:"customer_number" db:"customer_number"`
	CustomerEmail   string `json:"customer_email" db:"customer_email"`
	CustomerAddress string `json:"customer_address" db:"customer_address"`
}

func GetCustomer

func GetCustomer(db *sqlx.DB, id int) (Customer, error)

GetCustomer get one customer

func GetCustomers

func GetCustomers(db *sqlx.DB) ([]Customer, error)

GetCustomers get all customers

type Inventory

type Inventory struct {
	ID            int     `json:"id" db:"id"`
	InventoryType string  `json:"inventory_type" db:"inventory_type"`
	QtyIN         int64   `json:"qty_in" db:"qty_in"`
	QtyOUT        int     `json:"qty_out" db:"qty_out"`
	UnitCost      float64 `json:"unit_cost" db:"unit_cost"`
	SRP           float64 `json:"srp" db:"srp"`
	ItemID        int64   `json:"item_id" db:"item_id"`
	BranchID      int64   `json:"branch_id" db:"branch_id"`
	TransferID    int64   `json:"transfer_id" db:"transfer_id"`
}

func GetInventory

func GetInventory(db *sqlx.DB, id int) (Inventory, error)

GetInventory get one inventory

type InventoryDTO

type InventoryDTO struct {
	ID int `json:"inv_id" db:"inv_id"`
	Inventory
	Item
}

func GetInventories

func GetInventories(db *sqlx.DB) ([]InventoryDTO, error)

GetInventories get all inventories

type Item

type Item struct {
	ID                  int     `json:"id" db:"id"`
	Item                string  `json:"item" db:"item"`
	Description         string  `json:"description" db:"description"`
	CategoryDescription string  `json:"category_description" db:"category_description"`
	Brand               string  `json:"brand" db:"brand"`
	Barcode             string  `json:"barcode" db:"barcode"`
	CategoryID          int     `json:"category_id" db:"category_id"`
	UOM                 string  `json:"uom" db:"uom"`
	DefaultUnitCost     string  `json:"default_unit_cost" db:"default_unit_cost"`
	DefaultSRP          string  `json:"default_srp" db:"default_srp"`
	MarkupPercent       float64 `json:"markup_percent" db:"markup_percent"`
	MarkupAmount        float64 `json:"markup_amount" db:"markup_amount"`
	StockNotifyLimit    int     `json:"stock_notify_limit" db:"stock_notify_limit"`
	StockLimit          int     `json:"stock_limit" db:"stock_limit"`
}

func GetItem

func GetItem(db *sqlx.DB, id int) (Item, error)

GetItem get one item

type ItemDTO

type ItemDTO struct {
	ID int `json:"item_id,omitempty" db:"item_id"`
	Item
	Category
}

func GetItems

func GetItems(db *sqlx.DB) ([]ItemDTO, error)

GetItems get all items

type Modifier

type Modifier struct {
	ID            int    `json:"id"`
	ModifierTitle string `json:"modifier_title" db:"modifier_title"`
	ModifierItems string `json:"modifier_items" db:"modifier_items"`
}

func GetModifier

func GetModifier(db *sqlx.DB, id int) (Modifier, error)

GetModifier get one modifier

func GetModifiers

func GetModifiers(db *sqlx.DB) ([]Modifier, error)

GetModifiers get all modifiers

type Sale

type Sale struct {
	ID                   int    `json:"id"`
	SaleDateTime         string `json:"sale_datetime" db:"sale_datetime"`
	SaleDispenseLocation string `json:"sale_dispense_location" db:"sale_dispense_location"`
	SaleDispenseDateTime string `json:"sale_dispense_datetime" db:"sale_dispense_datetime"`
	SaleNo               string `json:"sale_no" db:"sale_no"`
	SaleDetails          string `json:"sale_details" db:"sale_details"`
	SaleStatus           string `json:"sale_status" db:"sale_status"`
	CustomerID           string `json:"customer_id" db:"customer_id"`
}

func GetSale

func GetSale(db *sqlx.DB, id int) (Sale, error)

GetSale get one sale

type SaleItem

type SaleItem struct {
	ID     int     `json:"id"`
	SRP    float32 `json:"srp" db:"srp"`
	Qty    int     `json:"qty" db:"qty"`
	Status string  `json:"status" db:"status"`
	Item   string  `json:"item" db:"item"`
	ItemID string  `json:"item_id" db:"item_id"`
	SaleID string  `json:"sale_id" db:"sale_id"`
}

SaleItem - function SaleItem

func GetSaleItem

func GetSaleItem(db *sqlx.DB, id int) (SaleItem, error)

GetSaleItem get one SaleItem

func GetSaleItems

func GetSaleItems(db *sqlx.DB) ([]SaleItem, error)

GetSaleItems get all SaleItems

func GetSaleItemsBySaleID

func GetSaleItemsBySaleID(db *sqlx.DB, id int) ([]SaleItem, error)

GetSaleItemsBySaleID - function GetSaleItemsBySaleID

type SaleWithItems

type SaleWithItems struct {
	ID                   int    `json:"id"`
	SaleDateTime         string `json:"sale_datetime" db:"sale_datetime"`
	SaleDispenseLocation string `json:"sale_dispense_location" db:"sale_dispense_location"`
	SaleDispenseDateTime string `json:"sale_dispense_datetime" db:"sale_dispense_datetime"`
	SaleNo               string `json:"sale_no" db:"sale_no"`
	SaleDetails          string `json:"sale_details" db:"sale_details"`
	SaleStatus           string `json:"sale_status" db:"sale_status"`
	Customer             Customer
	SaleItems            []SaleItem
}

func GetSales

func GetSales(db *sqlx.DB) ([]SaleWithItems, error)

GetSales get all sales

type Supplier

type Supplier struct {
	ID              int    `json:"id" db:"id"`
	SupplierCode    string `json:"supplier_code" db:"supplier_code"`
	SupplierDesc    string `json:"supplier_description" db:"supplier_description"`
	SupplierPerson  string `json:"supplier_contact_person" db:"supplier_contact_person"`
	SupplierContact string `json:"supplier_contact" db:"supplier_contact"`
	SupplierEmail   string `json:"supplier_email" db:"supplier_email"`
}

Supplier struct Supplier

func GetSupplier

func GetSupplier(db *sqlx.DB, id int) (Supplier, error)

GetSupplier get one supplier

func GetSuppliers

func GetSuppliers(db *sqlx.DB) ([]Supplier, error)

GetSuppliers get all suppliers

type Transfer

type Transfer struct {
	ID               int    `json:"id"`
	TransferSTN      string `json:"transfer_stn"`
	TransferDatetime string `json:"transfer_datetime"`
	BranchID         int    `json:"branch_id"`
}

func GetTransfer

func GetTransfer(db *sqlx.DB, id int) (Transfer, error)

GetTransfer get one transfer

func GetTransfers

func GetTransfers(db *sqlx.DB) ([]Transfer, error)

GetTransfers get all transfers

type User

type User struct {
	ID       int    `json:"id" db:"id"`
	Email    string `json:"email" db:"email"`
	Username string `json:"username" db:"username"`
	Name     string `json:"name" db:"name"`
	Password string `json:"password" db:"password"`
	Role     string `json:"role" db:"role"`
	BranchID int    `json:"branch_id" db:"branch_id"`
}

func GetUser

func GetUser(db *sqlx.DB, id int) (User, error)

GetUser get one user

func GetUsersByBranch

func GetUsersByBranch(db *sqlx.DB, branchID int) ([]User, error)

GetUsersByBranch get all users by branch

func ValidateCredentials

func ValidateCredentials(db *sqlx.DB, username string, password string) (User, error)

ValidateCredentials authenticates credentials

type UserDTO

type UserDTO struct {
	ID         int    `json:"id" db:"id"`
	Email      string `json:"email" db:"email"`
	Username   string `json:"username" db:"username"`
	Name       string `json:"name" db:"name"`
	Role       string `json:"role" db:"role"`
	BranchCode string `json:"branch_code" db:"branch_code"`
	BranchName string `json:"branch_name" db:"branch_name"`
	BranchID   int    `json:"branch_id" db:"branch_id"`
}

func GetUsers

func GetUsers(db *sqlx.DB) ([]UserDTO, error)

GetUsers get all users

Jump to

Keyboard shortcuts

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