Documentation
¶
Index ¶
- Constants
- func ActiveStatementAccountIdentityDigest(ctx context.Context, q statementIdentityRowsQueryer, statementAccountID string) (int, string, error)
- func ComputeBookDigest(ctx context.Context, q rowQueryer, bookID, endDate string) (string, error)
- func MapError(action string, err error) error
- func Migrate(ctx context.Context, path string) error
- func NewID() (string, error)
- func UTCNow() string
- func ValidateMigrationTarget(ctx context.Context, path string) error
- func VerifyAudit(ctx context.Context, db auditQueryer) (int64, error)
- type AuditEvent
- type AuditInput
- type BackupResult
- type DoctorResult
- type Mode
- type RestoreBookIdentity
- type RestoreEntityIdentity
- type RestoreExpectation
- type RestoreResult
- type RestoreValidation
- type Store
Constants ¶
const ( ApplicationID = 1112493899 CurrentSchemaVersion = 4 )
Variables ¶
This section is empty.
Functions ¶
func ActiveStatementAccountIdentityDigest ¶
func ActiveStatementAccountIdentityDigest(ctx context.Context, q statementIdentityRowsQueryer, statementAccountID string) (int, string, error)
ActiveStatementAccountIdentityDigest returns a canonical binding for the complete active identity set of one statement account. Every immutable mapping and evidence field is length-prefixed before hashing so field values cannot create ambiguous encodings.
func ComputeBookDigest ¶
func ValidateMigrationTarget ¶
ValidateMigrationTarget verifies, without opening the file for writes, that path is an initialized Books database eligible for forward migrations.
Types ¶
type AuditEvent ¶
type AuditEvent struct {
Sequence int64 `json:"sequence"`
EventID string `json:"event_id"`
OccurredAt string `json:"occurred_at"`
Actor string `json:"actor"`
AppVersion string `json:"app_version"`
Command string `json:"command"`
AggregateType string `json:"aggregate_type"`
AggregateID string `json:"aggregate_id"`
Payload json.RawMessage `json:"payload"`
PreviousHash string `json:"previous_hash"`
EventHash string `json:"event_hash"`
}
func AppendAudit ¶
func AppendAudit(ctx context.Context, tx *sql.Tx, input AuditInput) (AuditEvent, error)
type AuditInput ¶
type BackupResult ¶
type DoctorResult ¶
type DoctorResult struct {
IntegrityCheck string `json:"integrity_check"`
ForeignKeyViolations int `json:"foreign_key_violations"`
UnbalancedJournals int `json:"unbalanced_journals"`
InvalidPostedLines int `json:"invalid_posted_lines"`
ClosedDigestFailures int `json:"closed_digest_failures"`
ClosedControlFailures int `json:"closed_control_failures"`
InvalidReconciliations int `json:"invalid_reconciliations"`
InvalidSourceRevisions int `json:"invalid_source_revisions"`
InvalidSourceEvidence int `json:"invalid_source_evidence"`
InvalidMaterializations int `json:"invalid_source_materializations"`
InvalidSourceLinks int `json:"invalid_source_links"`
InvalidStatementLifecycles int `json:"invalid_statement_lifecycles"`
AuditEvents int64 `json:"audit_events"`
OK bool `json:"ok"`
}
type RestoreBookIdentity ¶
type RestoreBookIdentity struct {
Code string `json:"code"`
Name string `json:"name"`
Kind string `json:"kind"`
EntityCode string `json:"entity_code,omitempty"`
GroupCode string `json:"group_code,omitempty"`
Basis string `json:"basis"`
Currency string `json:"currency"`
Status string `json:"status"`
}
type RestoreEntityIdentity ¶
type RestoreExpectation ¶
RestoreExpectation binds a restore to registry identity that remains available even when the target database is missing or has been replaced. Empty fields preserve the advanced direct-database behavior, which binds an existing target to its own database UUID and permits adoption at a new path.
type RestoreResult ¶
type RestoreResult struct {
Source string `json:"source"`
Target string `json:"target"`
PreRestoreBackup string `json:"pre_restore_backup,omitempty"`
SourceSHA256 string `json:"source_sha256"`
SourceDatabaseUUID string `json:"source_database_uuid"`
PreviousTargetDatabaseUUID string `json:"previous_target_database_uuid,omitempty"`
SourceBaseCurrency string `json:"source_base_currency"`
SourceEntities []RestoreEntityIdentity `json:"source_entities"`
SourceBooks []RestoreBookIdentity `json:"source_books"`
}
func Restore ¶
func Restore(ctx context.Context, target, backup, actor string, expected RestoreExpectation) (result RestoreResult, returnErr error)
type RestoreValidation ¶
type RestoreValidation struct {
Source string `json:"source"`
Target string `json:"target"`
SourceSHA256 string `json:"source_sha256"`
SourceDatabaseUUID string `json:"source_database_uuid"`
PreviousTargetDatabaseUUID string `json:"previous_target_database_uuid,omitempty"`
SourceBaseCurrency string `json:"source_base_currency"`
SourceEntities []RestoreEntityIdentity `json:"source_entities"`
SourceBooks []RestoreBookIdentity `json:"source_books"`
}
func ValidateRestore ¶
func ValidateRestore(ctx context.Context, target, backup string, expected RestoreExpectation) (RestoreValidation, error)