finance

package
v1.0.68 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FinanceService

type FinanceService struct {
	AccountService     *account.AccountService
	TransactionService *transaction.TransactionService
	BankService        *bank.BankService
	JournalService     *journal.JournalService
	ReportService      *report.FinanceReportService
	TaxService         *tax.TaxService
	AssetService       *asset.AssetService
	// contains filtered or unexported fields
}

func NewFinanceService

func NewFinanceService(ctx *context.ERPContext) *FinanceService

NewFinanceService creates a new instance of FinanceService.

The service is created by providing a pointer to a gorm.DB instance and a pointer to an ERPContext instance. The ERP context is used for authentication and authorization purposes, while the database instance is used for CRUD (Create, Read, Update, Delete) operations.

The service will call the Migrate() method after creation to migrate the database. If the migration fails, the service will panic.

func (*FinanceService) DB

func (s *FinanceService) DB() *gorm.DB

DB returns the underlying GORM database connection used by the FinanceService.

This method provides access to the database instance associated with the current ERP context, enabling CRUD operations within the service.

func (*FinanceService) Migrate

func (s *FinanceService) Migrate() error

Migrate migrates the database schema for the FinanceService.

If the SkipMigration flag is true in the context, this method will not perform any migration and will return nil. Otherwise, it will attempt to auto-migrate the database to include the AccountModel, TransactionModel, JournalModel, TaxModel, and AssetModel schemas. If the migration process encounters an error, it will return that error. Otherwise, it will return nil upon successful migration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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