Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderService ¶
type OrderService struct {
SalesService *sales.SalesService
PosService *pos.POSService
MerchantService *merchant.MerchantService
PaymentService *payment.PaymentService
WithdrawalService *withdrawal.WithdrawalService
BannerService *banner.BannerService
PromotionService *promotion.PromotionService
PaymentTermService *payment_term.PaymentTermService
SalesReturnService *sales_return.SalesReturnService
// contains filtered or unexported fields
}
func NewOrderService ¶
func NewOrderService(ctx *context.ERPContext) *OrderService
NewOrderService initializes a new OrderService instance.
It takes an ERPContext and initializes sub-services. It also runs a migration for the database.
If the migration fails, it will return nil.
func (*OrderService) DB ¶
func (s *OrderService) DB() *gorm.DB
DB returns the underlying database connection.
The method returns the GORM database connection that is used by the service for CRUD (Create, Read, Update, Delete) operations.
func (*OrderService) Migrate ¶
func (s *OrderService) Migrate() error
Migrate runs the database migrations for the order module.
It first checks if the SkipMigration flag is set in the context. If it is, the function returns immediately.
It then calls the Migrate functions of the Sales, POS, Merchant, Payment, Withdrawal, Banner, Promotion, and Payment Term services, passing the database connection from the context. If any of these calls returns an error, the function logs the error and returns it.