Documentation ¶
Index ¶
- type Database
- func (db *Database) CommitTrx() error
- func (db *Database) CreateIndexes() error
- func (db *Database) CreateOrder(orderId int, customerId int, warehouseId int, districtId int, oCarrierId int, ...) error
- func (db *Database) DeleteNewOrder(orderId int, warehouseId int, districtId int) error
- func (db *Database) DoTrxRetries(fn func(ctx context.Context) error, retries int) error
- func (db *Database) GetCustomer(customerId int, warehouseId int, districtId int) (*models.Customer, error)
- func (db *Database) GetCustomerById(customerId int, warehouseId int, districtId int) (*models.Customer, error)
- func (db *Database) GetCustomerByName(name string, warehouseId int, districtId int) (*models.Customer, error)
- func (db *Database) GetCustomerIdOrder(orderId int, warehouseId int, districtId int) (int, error)
- func (db *Database) GetDistrict(warehouseId int, districtId int) (*models.District, error)
- func (db *Database) GetItems(itemIds []int) (*[]models.Item, error)
- func (db *Database) GetLastOrder(customerId int, warehouseId int, districtId int) (*models.Order, error)
- func (db *Database) GetNewOrder(warehouseId int, districtId int) (*models.NewOrder, error)
- func (db *Database) GetNextOrderId(warehouseId int, districtId int) (int, error)
- func (db *Database) GetOrderLines(orderId int, warehouseId int, districtId int) (*[]models.OrderLine, error)
- func (db *Database) GetStockCount(orderIdLt int, orderIdGt int, threshold int, warehouseId int, districtId int) (int64, error)
- func (db *Database) GetStockInfo(districtId int, iIds []int, iWids []int, allLocal int) (*[]models.Stock, error)
- func (db *Database) GetWarehouse(warehouseId int) (*models.Warehouse, error)
- func (db *Database) IncrementDistrictOrderId(warehouseId int, districtId int) error
- func (db *Database) InsertBatch(collectionName string, d []interface{}) error
- func (db *Database) InsertHistory(warehouseId int, districtId int, date time.Time, amount float64, data string) error
- func (db *Database) InsertOne(collectionName string, d interface{}) error
- func (db *Database) RollbackTrx() error
- func (db *Database) StartTrx() error
- func (db *Database) UpdateCredit(customerId int, warehouseId int, districtId int, balance float64, data string) error
- func (db *Database) UpdateCustomer(customerId int, warehouseId int, districtId int, sumOlTotal float64) error
- func (db *Database) UpdateDistrictBalance(warehouseId int, districtId int, amount float64) error
- func (db *Database) UpdateOrders(orderId int, warehouseId int, districtId int, oCarrierId int, ...) error
- func (db *Database) UpdateStock(stockId int, warehouseId int, quantity int, ytd int, ordercnt int, ...) error
- func (db *Database) UpdateWarehouseBalance(warehouseId int, amount float64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { Client *mongo.Client C *mongo.Database Aggregate bool // contains filtered or unexported fields }
func NewMongoDb ¶ added in v0.0.2
func (*Database) CreateIndexes ¶
func (*Database) CreateOrder ¶ added in v0.0.2
func (*Database) DeleteNewOrder ¶ added in v0.0.2
func (*Database) DoTrxRetries ¶
func (*Database) GetCustomer ¶ added in v0.0.2
func (*Database) GetCustomerById ¶ added in v0.0.2
func (*Database) GetCustomerByName ¶ added in v0.0.2
func (*Database) GetCustomerIdOrder ¶ added in v0.0.2
GetCId
func (*Database) GetDistrict ¶ added in v0.0.2
func (*Database) GetLastOrder ¶ added in v0.0.2
func (*Database) GetNewOrder ¶ added in v0.0.2
It also deletes new order, as MongoDB can do that findAndModify is set to 0
func (*Database) GetNextOrderId ¶ added in v0.0.2
func (*Database) GetOrderLines ¶ added in v0.0.2
func (*Database) GetStockCount ¶ added in v0.0.2
func (*Database) GetStockInfo ¶ added in v0.0.2
func (*Database) GetWarehouse ¶ added in v0.0.2
func (*Database) IncrementDistrictOrderId ¶ added in v0.0.2
Get District using warehouseId and districtId and return pointer to models.District or error instead.
func (*Database) InsertBatch ¶
func (*Database) InsertHistory ¶ added in v0.0.2
func (*Database) RollbackTrx ¶ added in v0.0.2
func (*Database) UpdateCredit ¶ added in v0.0.2
func (*Database) UpdateCustomer ¶ added in v0.0.2
func (*Database) UpdateDistrictBalance ¶ added in v0.0.2
func (*Database) UpdateOrders ¶ added in v0.0.2
func (*Database) UpdateStock ¶ added in v0.0.2
Click to show internal directories.
Click to hide internal directories.