modules

package
v0.0.0-...-1b2c9a0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: LGPL-2.1 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auditable

type Auditable interface {
	SetCreatedUtcNow()
	SetUpdatedUtcNow()
}

type Copiable

type Copiable interface {
	CopyTo(destPtr any)
	CopyFrom(sourcePtr any) any
}

type DefaultConfig

type DefaultConfig []byte

type DomainModel

type DomainModel interface {
	PrimaryKey() ValueObject
	Clone() any
	Validate(forEdit bool) error
}

type DynamicModule

type DynamicModule interface {
	Deps() []string
	// LabelKey is the translation key.
	LabelKey() string
	Name() string
	Init() error
	IsInternal() bool
	RegisterModels() error
	Version() semver.SemVer
	// ModelPrefix returns the prefix this module's schemas are named with, without a
	// trailing separator - GenSql appends the "_" itself.
	ModelPrefix() string
}

type InCodeModule

type InCodeModule interface {
	Deps() []string
	// Deprecated: Use Name() instead.
	LabelKey() string
	Name() string
	Init() error
	IsInternal() bool
	Version() semver.SemVer
	// ModelPrefix returns the prefix this module's schemas are named with, without a
	// trailing separator - GenSql appends the "_" itself.
	ModelPrefix() string
}

type InCodeModuleAppStarted

type InCodeModuleAppStarted interface {
	OnAppStarted() error
}

type InCodeModuleAppStopping

type InCodeModuleAppStopping interface {
	OnAppStopping(ctx context.Context) error
}

InCodeModuleAppStopping is an optional hook, the counterpart to InCodeModuleAppStarted, invoked after the OS termination signal and before the HTTP server shuts down. A module that owns background goroutines implements it to stop accepting new work and drain what is already in flight.

It is best-effort. Every module shares one deadline carried by ctx, and a module that blocks past it is abandoned rather than allowed to hold up the shutdown of the rest. A module whose work must survive an abrupt stop has to be recoverable from persisted state; this hook shortens the window in which that recovery is needed, it does not remove it.

type InCodeModuleDependants

type InCodeModuleDependants interface {
	Dependants() []string
}

InCodeModuleDependants is the optional counterpart to Deps(): the modules that reference THIS module's resources, declared by this module rather than by them.

The two lists answer opposite questions and neither can be derived from the other. Deps() says what this module needs in order to start; Dependants() says who must be consulted before one of its resources is deleted. A dependency graph cannot answer the second question — inventory depending on essential says nothing about who depends on inventory — so the list is hard-coded and owned by the module whose resources are at stake.

The names are canonical module names, matching Name(). A name that is not loaded in this binary is skipped rather than rejected: the same module ships in binaries with different module sets, and a resource whose consumer is absent has no consumer to ask.

type JSON

type JSON map[string]any

type ModuleDependantRegistry

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

ModuleDependantRegistry answers "who references this module's resources", which a module asks before deleting one of them. It is built once at startup from every module implementing InCodeModuleDependants and is read-only afterwards.

Absent dependants are kept out of the answer rather than rejected. A module's dependant list is written once and ships in every binary, but the binaries load different module sets — coremart runs the vending machine, nikkierp does not — so naming a module that this binary did not load is a legitimate state, not a misconfiguration. Only the names that are actually loaded can answer a usage check, and only those are returned.

func NewModuleDependantRegistry

func NewModuleDependantRegistry(mods []InCodeModule) (*ModuleDependantRegistry, error)

NewModuleDependantRegistry collects the dependant lists and validates them against the loaded set. It rejects what is certainly wrong — a module naming itself, or naming the same dependant twice — and reports what is merely unusable here, so the caller can log it.

func (*ModuleDependantRegistry) AbsentDependants

func (this *ModuleDependantRegistry) AbsentDependants(moduleName string) []string

AbsentDependants returns the names moduleName declared that this binary did not load. It exists so startup can log them: the list is not an error, but a name that is absent because it was misspelled looks exactly like one that is absent by design, and the log is what makes the difference visible.

func (*ModuleDependantRegistry) GetModuleDependants

func (this *ModuleDependantRegistry) GetModuleDependants(moduleName string) []string

GetModuleDependants returns the loaded modules that may reference moduleName's resources. An unknown module and one with no dependants both answer empty, which is the same instruction to the caller: there is nobody to ask.

func (*ModuleDependantRegistry) OwnersWithAbsentDependants

func (this *ModuleDependantRegistry) OwnersWithAbsentDependants() []string

OwnersWithAbsentDependants lists, in a stable order, the modules that declared a dependant this binary did not load.

type SoftDeletable

type SoftDeletable interface {
	SetDeletedUtcNow()
}

type ValueObject

type ValueObject interface {
	// Value() (any, error)
	Json() any
	String() string
}

Directories

Path Synopsis
Package accounting owns tax: master data, effective-dated configuration, determination rules and the calculation engine.
Package accounting owns tax: master data, effective-dated configuration, determination rules and the calculation engine.
app
Package app holds the Accounting application services: the layer that authorizes a request and then delegates to a domain service.
Package app holds the Accounting application services: the layer that authorizes a request and then delegates to a domain service.
domain/services
Package services holds the Accounting business rules that reach for stored configuration.
Package services holds the Accounting business rules that reach for stored configuration.
domain/services/tax
Package tax implements determination, calculation, rounding and reversal, applied in that order.
Package tax implements determination, calculation, rounding and reversal, applied in that order.
domain/settings
Package settings declares what an organization may configure about its own tax handling.
Package settings declares what an organization may configure about its own tax handling.
dynamicengines
Package dynamicengines declares the resource engines Accounting serves through the dynamic resource engine, and creates them during Init().
Package dynamicengines declares the resource engines Accounting serves through the dynamic resource engine, and creates them during Init().
infra/external
Package external binds Accounting's local ports to the services other modules publish.
Package external binds Accounting's local ports to the services other modules publish.
interfaces/currency
Package currency publishes which currency an organization keeps its books in.
Package currency publishes which currency an organization keeps its books in.
interfaces/tax
Package tax is the port other modules consume to have tax determined and calculated.
Package tax is the port other modules consume to have tax determined and calculated.
Package contacts holds the people and organizations the business deals with.
Package contacts holds the people and organizations the business deals with.
dynamicengines
Package dynamicengines declares the resource engines the Contacts module serves through the dynamic resource engine, and creates them during the module's Init().
Package dynamicengines declares the resource engines the Contacts module serves through the dynamic resource engine, and creates them during the module's Init().
interfaces/party
Package party declares the party capability that Contacts offers to other modules.
Package party declares the party capability that Contacts offers to other modules.
interfaces/vendor
Package vendor declares the vendor capability that Contacts offers to other modules.
Package vendor declares the vendor capability that Contacts offers to other modules.
job
tag
usagecheck
Package usagecheck asks the modules that reference a resource whether it is still in use, before the module owning it deletes it.
Package usagecheck asks the modules that reference a resource whether it is still in use, before the module owning it deletes it.
composable
Package composable is the successor of package engine.
Package composable is the successor of package engine.
app
domain/settings
Package settings holds Essential's settings schemas.
Package settings holds Essential's settings schemas.
dynamicengines
Package dynamicengines declares the resource onions the Essential module serves through the composable resource engine, and registers them into the dependency container during the module's Init().
Package dynamicengines declares the resource onions the Essential module serves through the composable resource engine, and registers them into the dependency container during the module's Init().
infra/external
Package external binds Essential's local ports to the services other modules publish.
Package external binds Essential's local ports to the services other modules publish.
interfaces/currency
Package currency declares the currency capability that Essential offers to other modules.
Package currency declares the currency capability that Essential offers to other modules.
interfaces/uom
Package uom declares the UoM capability that Essential offers to other modules.
Package uom declares the UoM capability that Essential offers to other modules.
interfaces/uomcat
Package uomcat declares the UoM Category resource's layers.
Package uomcat declares the UoM Category resource's layers.
app
iam
app
domain/settings
Package settings holds iam's settings schemas.
Package settings holds iam's settings schemas.
dynamicengines
Package dynamicengines declares the resource engines the IAM module serves through the dynamic resource engine, and creates them during the module's Init().
Package dynamicengines declares the resource engines the IAM module serves through the dynamic resource engine, and creates them during the module's Init().
app
Package app holds the Inventory operations that span more than one domain service.
Package app holds the Inventory operations that span more than one domain service.
domain/services
The only raw SQL in the Inventory module, a deliberate exception to the engine-first rule: reserving stock safely requires SELECT ...
The only raw SQL in the Inventory module, a deliberate exception to the engine-first rule: reserving stock safely requires SELECT ...
dynamicengines
Package dynamicengines declares the resource onions the Inventory module serves through the composable resource engine, and registers them into the dependency container during the module's Init().
Package dynamicengines declares the resource onions the Inventory module serves through the composable resource engine, and registers them into the dependency container during the module's Init().
infra/external
Package external binds Inventory's outbound ports to the services other modules and the core publish.
Package external binds Inventory's outbound ports to the services other modules and the core publish.
infra/external/message
Package message speaks the broker's protocol for Inventory's integration event port.
Package message speaks the broker's protocol for Inventory's integration event port.
interfaces/external
Package external declares the ports Inventory consumes from other modules.
Package external declares the ports Inventory consumes from other modules.
interfaces/message
Package message is the port for Inventory's outbound integration events.
Package message is the port for Inventory's outbound integration events.
interfaces/product
Package product is the Inventory module's cross-module port: the only Products capability other modules bind to.
Package product is the Inventory module's cross-module port: the only Products capability other modules bind to.
interfaces/stock
Package stock is the port onto what Stock knows about a location.
Package stock is the port onto what Stock knows about a location.
interfaces/warehouse
Package warehouse is the contract for Warehouse operations spanning more than one resource: writes that touch a warehouse and its locations together, plus the flow reads the Stock movement engine plans against.
Package warehouse is the contract for Warehouse operations spanning more than one resource: writes that touch a warehouse and its locations together, plus the flow reads the Stock movement engine plans against.
Package jobscheduler runs recurring jobs registered by other modules.
Package jobscheduler runs recurring jobs registered by other modules.
app
domain/services
Package services holds the scheduling engine and the rules it applies.
Package services holds the scheduling engine and the rules it applies.
infra/repository
This file contains the only raw SQL in the Job Scheduler, and it is a deliberate exception to the engine-first rule in docs/wiki/07 §6.7 rather than drift.
This file contains the only raw SQL in the Job Scheduler, and it is a deliberate exception to the engine-first rule in docs/wiki/07 §6.7 rather than drift.
app
domain/settings
Package settings holds Notification's settings schemas.
Package settings holds Notification's settings schemas.
dynamicengines
Package dynamicengines declares the resource onions the Notification module serves through the composable resource engine, and registers them into the dependency container during the module's Init().
Package dynamicengines declares the resource onions the Notification module serves through the composable resource engine, and registers them into the dependency container during the module's Init().
infra/external
Package external binds Notification to the infrastructure and to other modules.
Package external binds Notification to the infrastructure and to other modules.
infra/external/channels
Package channels holds the distribution channels themselves.
Package channels holds the distribution channels themselves.
interfaces/delivery
Package delivery declares the contracts for raising and reading notifications.
Package delivery declares the contracts for raising and reading notifications.
transport/cqrs
Package cqrs receives the commands other modules dispatch into Notification.
Package cqrs receives the commands other modules dispatch into Notification.
Package paymentinvoice takes payments through the payment gateways the business has contracts with, and issues the invoices that account for them.
Package paymentinvoice takes payments through the payment gateways the business has contracts with, and issues the invoices that account for them.
app
Package app holds the payment module's background work: notifying the ordering system that a payment settled, and the sweeps that recover orders no callback ever arrived for.
Package app holds the payment module's background work: notifying the ordering system that a payment settled, and the sweeps that recover orders no callback ever arrived for.
domain/services
Package services holds the rules of the Payment & Invoice module: what may be paid, what may be refunded, and what state an order is left in when a gateway answers.
Package services holds the rules of the Payment & Invoice module: what may be paid, what may be refunded, and what state an order is left in when a gateway answers.
dynamicengines
Package dynamicengines declares the resource engines the Payment & Invoice module serves through the dynamic resource engine, and creates them during the module's Init().
Package dynamicengines declares the resource engines the Payment & Invoice module serves through the dynamic resource engine, and creates them during the module's Init().
infra/external/event
Package event publishes this module's announcements on the internal Watermill bus.
Package event publishes this module's announcements on the internal Watermill bus.
infra/gateway
Package gateway builds the gateway registry this deployment will actually serve payments through, from configuration.
Package gateway builds the gateway registry this deployment will actually serve payments through, from configuration.
infra/gateway/momo
Package momo talks to MoMo, a Vietnamese e-wallet.
Package momo talks to MoMo, a Vietnamese e-wallet.
infra/gateway/mpos
Package mpos talks to mPOS (NextPay), which drives a physical card terminal.
Package mpos talks to mPOS (NextPay), which drives a physical card terminal.
infra/gateway/vietqr
Package vietqr talks to VietQR, which settles bank transfers made by scanning a QR code.
Package vietqr talks to VietQR, which settles bank transfers made by scanning a QR code.
interfaces/event
Package event is what this module announces to the rest of the build when an order reaches a verdict.
Package event is what this module announces to the rest of the build when an order reaches a verdict.
interfaces/gateway
Package gateway declares what a payment gateway must be able to do, and nothing about how any particular one does it.
Package gateway declares what a payment gateway must be able to do, and nothing about how any particular one does it.
interfaces/invoice
Package invoice is the Payment & Invoice module's port for raising a fiscal document on behalf of another module.
Package invoice is the Payment & Invoice module's port for raising a fiscal document on behalf of another module.
interfaces/order
Package order is the Payment & Invoice module's port for taking money and giving it back.
Package order is the Payment & Invoice module's port for taking money and giving it back.
interfaces/paymentmethod
Package paymentmethod is the port through which another module reads this one's payment method master data.
Package paymentmethod is the port through which another module reads this one's payment method master data.
transport/restful/v1
Package v1 serves the gateway callbacks.
Package v1 serves the gateway callbacks.
Package purchase covers the procurement cycle from request for quotation to confirmed purchase order.
Package purchase covers the procurement cycle from request for quotation to confirmed purchase order.
domain/services
Package services holds the rules of the Purchase module: the totals recomputation, the order and agreement lifecycles, and the audit trail that records them.
Package services holds the rules of the Purchase module: the totals recomputation, the order and agreement lifecycles, and the audit trail that records them.
domain/services/vendorpricing
Package vendorpricing decides which vendor price applies to a purchase.
Package vendorpricing decides which vendor price applies to a purchase.
dynamicengines
Package dynamicengines declares the resource engines the Purchase module serves, and creates them during Init().
Package dynamicengines declares the resource engines the Purchase module serves, and creates them during Init().
infra/external
Package external binds Purchase's local ports to the services other modules publish.
Package external binds Purchase's local ports to the services other modules publish.
interfaces/external
Package external declares Purchase's local ports onto the capabilities other modules offer, so that splitting a module into its own process changes only the binding in infra/external.
Package external declares Purchase's local ports onto the capabilities other modules offer, so that splitting a module into its own process changes only the binding in infra/external.
Package sales owns the commercial transaction: sales order and lines, pricing and promotion, billing, payment allocation, return and refund.
Package sales owns the commercial transaction: sales order and lines, pricing and promotion, billing, payment allocation, return and refund.
app
Package app holds the Sales application services.
Package app holds the Sales application services.
domain/services
Package services holds the Sales business rules.
Package services holds the Sales business rules.
domain/services/pricing
Package pricing is the sales pricing engine: a pure function from a basket to a priced result.
Package pricing is the sales pricing engine: a pure function from a basket to a priced result.
domain/settings
Package settings holds Sales' settings schemas.
Package settings holds Sales' settings schemas.
dynamicengines
Package dynamicengines declares the resource engines the Sales module serves, and creates them during Init().
Package dynamicengines declares the resource engines the Sales module serves, and creates them during Init().
event_handlers
Package eventhandlers acts on the events Sales subscribes to.
Package eventhandlers acts on the events Sales subscribes to.
infra/external
Package external binds Sales' local ports to the services other modules publish.
Package external binds Sales' local ports to the services other modules publish.
infra/external/invoicing
Package invoicing binds Sales' fiscal-document port to whoever issues the documents.
Package invoicing binds Sales' fiscal-document port to whoever issues the documents.
infra/external/message
Package message speaks the broker's protocol for Sales' integration event port.
Package message speaks the broker's protocol for Sales' integration event port.
infra/repository
Package repository holds the Sales repositories.
Package repository holds the Sales repositories.
interfaces/billing
Package billing declares the commands the scheduler dispatches into Sales.
Package billing declares the commands the scheduler dispatches into Sales.
interfaces/catalog
Package catalog declares the layers of the Sales catalogue resources: the fulfillment methods, channels and points a sale happens through, and the pricelists and combos it is priced by.
Package catalog declares the layers of the Sales catalogue resources: the fulfillment methods, channels and points a sale happens through, and the pricelists and combos it is priced by.
interfaces/channel
Package channel is Sales' outward-facing contract for sales channels and sales points.
Package channel is Sales' outward-facing contract for sales channels and sales points.
interfaces/event
Package event declares what Sales listens for on the internal event bus.
Package event declares what Sales listens for on the internal event bus.
interfaces/external
Package external declares Sales' local ports onto the capabilities other modules offer, so splitting a module into its own process changes only the binding in infra/external.
Package external declares Sales' local ports onto the capabilities other modules offer, so splitting a module into its own process changes only the binding in infra/external.
interfaces/external/invoicing
Package invoicing is Sales' port onto the issuing of legal fiscal documents.
Package invoicing is Sales' port onto the issuing of legal fiscal documents.
interfaces/fiscal
Package fiscal declares the layers of the resources that turn a sale into a legal document: the request for an invoice, the instruction that says how to bill, and the record of each issuance attempt.
Package fiscal declares the layers of the resources that turn a sale into a legal document: the request for an invoice, the instruction that says how to bill, and the record of each issuance attempt.
interfaces/fulfillment
Package fulfillment declares the layers of the resources that carry out a sale: the fulfillment a confirmed order owes, the attempts made against it, and the record of a target being moved.
Package fulfillment declares the layers of the resources that carry out a sale: the fulfillment a confirmed order owes, the attempts made against it, and the record of a target being moved.
interfaces/integration
Package integration declares the layers of the two records Sales keeps about itself: the manual discounts granted on an order, and the outbox of integration events other systems consume.
Package integration declares the layers of the two records Sales keeps about itself: the manual discounts granted on an order, and the outbox of integration events other systems consume.
interfaces/message
Package message is the port for Sales' outbound integration events.
Package message is the port for Sales' outbound integration events.
interfaces/order
Package order is Sales' port for raising and settling an order from another module in-process.
Package order is Sales' port for raising and settling an order from another module in-process.
interfaces/promotion
Package promotion declares the layers of the promotion and voucher resources: the programs a discount is defined by, the conditions and rewards that shape it, and the voucher codes and redemption ledger that track its use.
Package promotion declares the layers of the promotion and voucher resources: the programs a discount is defined by, the conditions and rewards that shape it, and the voucher codes and redemption ledger that track its use.
interfaces/quotation
Package quotation declares the layers of the quotation resources: the offer a customer is given before it becomes a sale, and the lines it quotes.
Package quotation declares the layers of the quotation resources: the offer a customer is given before it becomes a sale, and the lines it quotes.
interfaces/returns
Package returns declares the layers of the return and refund resources: the customer's request to send goods back, the lines it covers, and the money paid back against it.
Package returns declares the layers of the return and refund resources: the customer's request to send goods back, the lines it covers, and the money paid back against it.
transport/cqrs
Package cqrs receives the commands the scheduler dispatches into Sales.
Package cqrs receives the commands the scheduler dispatches into Sales.
transport/event
Package eventtransport subscribes Sales to the internal event bus and dispatches each event to the handler registered for its type.
Package eventtransport subscribes Sales to the internal event bus and dispatches each event to the handler registered for its type.
transport/restful/v1
Package v1 serves the Sales resources over HTTP.
Package v1 serves the Sales resources over HTTP.
Package settings gives every feature module one place to declare its configuration and have it stored, resolved and rendered, instead of each building its own settings table.
Package settings gives every feature module one place to declare its configuration and have it stored, resolved and rendered, instead of each building its own settings table.
app
dynamicengines
Package dynamicengines declares the resource engines the Settings module serves through the dynamic resource engine, and creates them during the module's Init().
Package dynamicengines declares the resource engines the Settings module serves through the dynamic resource engine, and creates them during the module's Init().
interfaces/settings
Package settings declares the capabilities the Settings module exposes to the rest of the application: schema registration, and the per-level read and write of setting values.
Package settings declares the capabilities the Settings module exposes to the rest of the application: schema registration, and the per-level read and write of setting values.

Jump to

Keyboard shortcuts

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