MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / RecordReconciliation

Method RecordReconciliation

database/reconciliation.go:40–57  ·  view source on GitHub ↗

RecordReconciliation saves a reconciliation record to the database. Parameters: - ctx: Context for managing request and tracing. - rec: The reconciliation data to be stored. Returns: - An error if the reconciliation record fails to save, otherwise nil.

(ctx context.Context, rec *model.Reconciliation)

Source from the content-addressed store, hash-verified

38// Returns:
39// - An error if the reconciliation record fails to save, otherwise nil.
40func (d Datasource) RecordReconciliation(ctx context.Context, rec *model.Reconciliation) error {
41 ctx, span := otel.Tracer("reconciliation.database").Start(ctx, "Saving reconciliation to db")
42 defer span.End()
43
44 _, err := d.Conn.ExecContext(ctx,
45 `INSERT INTO ledgerforge.reconciliations(
46 reconciliation_id, upload_id, status, matched_transactions,
47 unmatched_transactions, started_at, completed_at
48 ) VALUES ($1, $2, $3, $4, $5, $6, $7)`,
49 rec.ReconciliationID, rec.UploadID, rec.Status, rec.MatchedTransactions,
50 rec.UnmatchedTransactions, rec.StartedAt, rec.CompletedAt,
51 )
52 if err != nil {
53 return apierror.NewAPIError(apierror.ErrInternalServer, "Failed to record reconciliation", err)
54 }
55
56 return nil
57}
58
59// GetReconciliation fetches a reconciliation record from the database based on its ID.
60// Parameters:

Callers 2

Calls 2

NewAPIErrorFunction · 0.92
StartMethod · 0.45

Tested by 2