Documentation
¶
Overview ¶
Package core wires all application dependencies together. It is the primary extension point for the pro version — supply AppOption functions to inject custom implementations of any data.*Repoer interface.
@title okpos API @version 0.1.0 @description Business management API for small and medium businesses. @host localhost:8080 @BasePath /api/v1
Index ¶
- type AppOption
- func WithAccountingRepo(repo data.AccountingRepoer) AppOption
- func WithBranchRepo(repo data.BranchRepoer) AppOption
- func WithCashDrawerMethods(methods []model.PaymentMethod) AppOption
- func WithCompanyRepo(repo data.CompanyRepoer) AppOption
- func WithCustomerRepo(repo data.CustomerRepoer) AppOption
- func WithDiscountRepo(repo data.DiscountRepoer) AppOption
- func WithEnqueuer(e data.Enqueuer) AppOption
- func WithExpenseRepo(repo data.ExpenseRepoer) AppOption
- func WithFileRepo(repo data.FileRepoer) AppOption
- func WithFileStorage(storage data.FileStorage) AppOption
- func WithInventoryRepo(repo data.InventoryRepoer) AppOption
- func WithJobRunner(r jobRunner) AppOption
- func WithOrderRepo(repo data.OrderRepoer) AppOption
- func WithPaymentMethods(methods []model.PaymentMethod) AppOption
- func WithProductRepo(repo data.ProductRepoer) AppOption
- func WithRegistry(r *plugin.Registry) AppOption
- func WithReportsRepo(repo data.ReportsQuerier) AppOption
- func WithSessionRepo(repo data.SessionRepoer) AppOption
- func WithStationRepo(repo data.POSStationRepoer) AppOption
- func WithSupplierPaymentRepo(repo data.SupplierPaymentRepoer) AppOption
- func WithSupplierRepo(repo data.SupplierRepoer) AppOption
- func WithUserRepo(repo data.UserRepoer) AppOption
- type OkPOSApp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppOption ¶
type AppOption func(*OkPOSApp)
AppOption is a functional option for NewApp.
func WithAccountingRepo ¶
func WithAccountingRepo(repo data.AccountingRepoer) AppOption
WithAccountingRepo injects an AccountingRepoer implementation.
func WithBranchRepo ¶
func WithBranchRepo(repo data.BranchRepoer) AppOption
WithBranchRepo injects a BranchRepoer implementation.
func WithCashDrawerMethods ¶
func WithCashDrawerMethods(methods []model.PaymentMethod) AppOption
WithCashDrawerMethods sets which payment methods count toward the physical cash drawer for session reconciliation. Defaults to model.DefaultCashDrawerMethods if not provided.
func WithCompanyRepo ¶
func WithCompanyRepo(repo data.CompanyRepoer) AppOption
WithCompanyRepo injects a CompanyRepoer implementation.
func WithCustomerRepo ¶
func WithCustomerRepo(repo data.CustomerRepoer) AppOption
WithCustomerRepo injects a CustomerRepoer implementation.
func WithDiscountRepo ¶
func WithDiscountRepo(repo data.DiscountRepoer) AppOption
WithDiscountRepo injects a DiscountRepoer implementation.
func WithEnqueuer ¶
WithEnqueuer injects a custom Enqueuer implementation. The OSS default is nil (no background jobs). Pass repo.NewGoqiteEnqueuer(db) for the SQLite-backed implementation. Pro injects a River/PostgreSQL adapter.
func WithExpenseRepo ¶
func WithExpenseRepo(repo data.ExpenseRepoer) AppOption
WithExpenseRepo injects an ExpenseRepoer implementation.
func WithFileRepo ¶
func WithFileRepo(repo data.FileRepoer) AppOption
WithFileRepo injects a FileRepoer implementation.
func WithFileStorage ¶
func WithFileStorage(storage data.FileStorage) AppOption
WithFileStorage injects a FileStorage implementation. The OSS default (see cmd/server.go) is repo.NewLocalFSStorage; pass repo.NewS3Storage for an S3-compatible backend.
func WithInventoryRepo ¶
func WithInventoryRepo(repo data.InventoryRepoer) AppOption
WithInventoryRepo injects an InventoryRepoer implementation.
func WithJobRunner ¶
func WithJobRunner(r jobRunner) AppOption
WithJobRunner injects the background job runner. Use repo.NewGoqiteEnqueuer + worker.NewRunner to build one, then pass both here. The runner is started as a goroutine when Start() is called.
func WithOrderRepo ¶
func WithOrderRepo(repo data.OrderRepoer) AppOption
WithOrderRepo injects an OrderRepoer implementation.
func WithPaymentMethods ¶
func WithPaymentMethods(methods []model.PaymentMethod) AppOption
WithPaymentMethods sets the allowed payment methods for checkout. Defaults to model.DefaultPaymentMethods if not provided.
func WithProductRepo ¶
func WithProductRepo(repo data.ProductRepoer) AppOption
WithProductRepo injects a ProductRepoer implementation.
func WithRegistry ¶
WithRegistry injects the plugin event registry. Build with plugin.NewRegistry + plugin.Load, then pass here.
func WithReportsRepo ¶
func WithReportsRepo(repo data.ReportsQuerier) AppOption
WithReportsRepo injects a ReportsQuerier implementation.
func WithSessionRepo ¶
func WithSessionRepo(repo data.SessionRepoer) AppOption
WithSessionRepo injects a SessionRepoer implementation.
func WithStationRepo ¶
func WithStationRepo(repo data.POSStationRepoer) AppOption
WithStationRepo injects a POSStationRepoer implementation.
func WithSupplierPaymentRepo ¶
func WithSupplierPaymentRepo(repo data.SupplierPaymentRepoer) AppOption
WithSupplierPaymentRepo injects a SupplierPaymentRepoer implementation.
func WithSupplierRepo ¶
func WithSupplierRepo(repo data.SupplierRepoer) AppOption
WithSupplierRepo injects a SupplierRepoer implementation.
func WithUserRepo ¶
func WithUserRepo(repo data.UserRepoer) AppOption
WithUserRepo injects a UserRepoer implementation. The default (if not provided) is a nil repo — the serve command must supply one.
type OkPOSApp ¶
type OkPOSApp struct {
// contains filtered or unexported fields
}
OkPOSApp holds the fully-wired application.
func NewApp ¶
NewApp wires dependencies, registers middleware, validator, and routes. Pass AppOption functions to inject repo implementations.