ce8b5026c1
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 20s
CI / ui (pull_request) Has been skipped
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m45s
Stand up the payments data foundation: a self-contained `payments` Postgres schema for the in-game currency, wallets, benefits, catalog, orders and the append-only operations ledger, behind a domain package — nothing wired to real money yet. - Migration 00010: the `payments` schema and a NOLOGIN confinement role (ALL on payments.*, nothing on backend); the ledger with a BEFORE UPDATE/DELETE append-only trigger and a partial idempotency index; the materialised balances/benefits; the catalog (atoms seeded) + products + per-method prices; the typed single-row config; orders and payment_events. There is no cross-schema foreign key — account_id is a plain uuid kept consistent in code, which keeps the domain extractable. Expand-contract and reversible. - Money is a bigint in the currency's minor units carried by a `Money` value type (exact, math/big): no float ever touches an amount, and a whole-unit currency cannot hold a fraction. - Extend jetgen to generate the payments schema; construct the service in the composition root behind a narrow interface with a boot reachability check. - Tests: integration (role confinement via SET ROLE, the append-only trigger, CHECK constraints, the idempotency index, and a forward+backward migration), Money unit tests, and an import-boundary test keeping the payments jet code private to the domain. - Docs: PLAN.md, docs/PAYMENTS.md (+ _ru mirror) updated to the built model.
94 lines
3.3 KiB
Go
94 lines
3.3 KiB
Go
//
|
|
// Code generated by go-jet DO NOT EDIT.
|
|
//
|
|
// WARNING: Changes to this file may cause incorrect behavior
|
|
// and will be lost if the code is regenerated
|
|
//
|
|
|
|
package table
|
|
|
|
import (
|
|
"github.com/go-jet/jet/v2/postgres"
|
|
)
|
|
|
|
var Config = newConfigTable("payments", "config", "")
|
|
|
|
type configTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
OnlyRow postgres.ColumnBool
|
|
RewardedPayoutChips postgres.ColumnInteger
|
|
CooldownGlobalSeconds postgres.ColumnInteger
|
|
CooldownVsAiSeconds postgres.ColumnInteger
|
|
CooldownHintSeconds postgres.ColumnInteger
|
|
OrderTTLSeconds postgres.ColumnInteger
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
DefaultColumns postgres.ColumnList
|
|
}
|
|
|
|
type ConfigTable struct {
|
|
configTable
|
|
|
|
EXCLUDED configTable
|
|
}
|
|
|
|
// AS creates new ConfigTable with assigned alias
|
|
func (a ConfigTable) AS(alias string) *ConfigTable {
|
|
return newConfigTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new ConfigTable with assigned schema name
|
|
func (a ConfigTable) FromSchema(schemaName string) *ConfigTable {
|
|
return newConfigTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new ConfigTable with assigned table prefix
|
|
func (a ConfigTable) WithPrefix(prefix string) *ConfigTable {
|
|
return newConfigTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new ConfigTable with assigned table suffix
|
|
func (a ConfigTable) WithSuffix(suffix string) *ConfigTable {
|
|
return newConfigTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newConfigTable(schemaName, tableName, alias string) *ConfigTable {
|
|
return &ConfigTable{
|
|
configTable: newConfigTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newConfigTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newConfigTableImpl(schemaName, tableName, alias string) configTable {
|
|
var (
|
|
OnlyRowColumn = postgres.BoolColumn("only_row")
|
|
RewardedPayoutChipsColumn = postgres.IntegerColumn("rewarded_payout_chips")
|
|
CooldownGlobalSecondsColumn = postgres.IntegerColumn("cooldown_global_seconds")
|
|
CooldownVsAiSecondsColumn = postgres.IntegerColumn("cooldown_vs_ai_seconds")
|
|
CooldownHintSecondsColumn = postgres.IntegerColumn("cooldown_hint_seconds")
|
|
OrderTTLSecondsColumn = postgres.IntegerColumn("order_ttl_seconds")
|
|
allColumns = postgres.ColumnList{OnlyRowColumn, RewardedPayoutChipsColumn, CooldownGlobalSecondsColumn, CooldownVsAiSecondsColumn, CooldownHintSecondsColumn, OrderTTLSecondsColumn}
|
|
mutableColumns = postgres.ColumnList{RewardedPayoutChipsColumn, CooldownGlobalSecondsColumn, CooldownVsAiSecondsColumn, CooldownHintSecondsColumn, OrderTTLSecondsColumn}
|
|
defaultColumns = postgres.ColumnList{OnlyRowColumn, RewardedPayoutChipsColumn, CooldownGlobalSecondsColumn, CooldownVsAiSecondsColumn, CooldownHintSecondsColumn, OrderTTLSecondsColumn}
|
|
)
|
|
|
|
return configTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
OnlyRow: OnlyRowColumn,
|
|
RewardedPayoutChips: RewardedPayoutChipsColumn,
|
|
CooldownGlobalSeconds: CooldownGlobalSecondsColumn,
|
|
CooldownVsAiSeconds: CooldownVsAiSecondsColumn,
|
|
CooldownHintSeconds: CooldownHintSecondsColumn,
|
|
OrderTTLSeconds: OrderTTLSecondsColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
DefaultColumns: defaultColumns,
|
|
}
|
|
}
|