validation

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountSvc

type AccountSvc interface {
	GetAccountByID(ctx context.Context, id int32) (*database.Account, error)
	GetAllAccounts(ctx context.Context) ([]*database.Account, error)
}

type ApplicableAccountSvc

type ApplicableAccountSvc interface {
	GetApplicableAccounts(
		_ context.Context,
		accounts []*database.Account,
	) map[v1.TransactionType]*applicable_accounts.PossibleAccount
}

type Request

type Request struct {
	Txs                    []*database.Transaction
	Accounts               map[int32]*database.Account
	SkipAccountsValidation bool
}

type Service

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

func NewValidationService

func NewValidationService(cfg *ServiceConfig) *Service

func (*Service) Validate

func (s *Service) Validate(
	ctx context.Context,
	dbTx *gorm.DB,
	req *Request,
) error

func (*Service) ValidateTransactionAccounts

func (s *Service) ValidateTransactionAccounts(
	_ context.Context,
	possible map[gomoneypbv1.TransactionType]*applicable_accounts.PossibleAccount,
	tx *database.Transaction,
) error

func (*Service) ValidateTransactionData

func (s *Service) ValidateTransactionData(
	ctx context.Context,
	dbTx *gorm.DB,
	tx *database.Transaction,
) error

type ServiceConfig

type ServiceConfig struct {
	ApplicableAccountSvc ApplicableAccountSvc
}

Jump to

Keyboard shortcuts

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