Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( GatheringInvoiceSequenceNumber = Definition{ Prefix: "GATHER", SuffixTemplate: "{{.CustomerPrefix}}-{{.Currency}}-{{.NextSequenceNumber}}", Scope: "invoices/gathering", CommitMode: CommitModeIndependent, } DraftInvoiceSequenceNumber = Definition{ Prefix: "DRAFT", SuffixTemplate: "{{.CustomerPrefix}}-{{.NextSequenceNumber}}", Scope: "invoices/draft", CommitMode: CommitModeIndependent, } )
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface {
entutils.TxCreator
NextSequenceNumber(ctx context.Context, input NextSequenceNumberInput) (alpacadecimal.Decimal, error)
}
type CommitMode ¶
type CommitMode string
CommitMode controls when a sequence allocation is committed. WithCaller allows the number to be reused if the caller rolls back; Independent retains the allocation despite caller rollback, which can create gaps.
const ( CommitModeWithCaller CommitMode = "with_caller" CommitModeIndependent CommitMode = "independent" )
func (CommitMode) Validate ¶
func (m CommitMode) Validate() error
type Definition ¶
type Definition struct {
Prefix string
SuffixTemplate string
Scope string
CommitMode CommitMode
}
func (Definition) PrefixMatches ¶
func (d Definition) PrefixMatches(s string) bool
func (Definition) Validate ¶
func (d Definition) Validate() error
type GenerationInput ¶
func (GenerationInput) Validate ¶
func (i GenerationInput) Validate() error
type NextSequenceNumberInput ¶
func (NextSequenceNumberInput) Validate ¶
func (n NextSequenceNumberInput) Validate() error
type Service ¶
type Service interface {
GenerateInvoiceSequenceNumber(ctx context.Context, in GenerationInput, def Definition) (string, error)
}
Click to show internal directories.
Click to hide internal directories.