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

Method CreateLedger

ledger.go:60–67  ·  view source on GitHub ↗

CreateLedger creates a new ledger. It calls postLedgerActions after a successful creation. Parameters: - ledger: A Ledger model representing the ledger to be created. Returns: - model.Ledger: The created Ledger model. - error: An error if the ledger could not be created.

(ledger model.Ledger)

Source from the content-addressed store, hash-verified

58// - model.Ledger: The created Ledger model.
59// - error: An error if the ledger could not be created.
60func (l *LedgerForge) CreateLedger(ledger model.Ledger) (model.Ledger, error) {
61 ledger, err := l.datasource.CreateLedger(ledger)
62 if err != nil {
63 return model.Ledger{}, err
64 }
65 l.postLedgerActions(context.Background(), &ledger)
66 return ledger, nil
67}
68
69// GetAllLedgers retrieves all ledgers from the datasource.
70// It returns a slice of Ledger models and an error if the operation fails.

Callers 1

TestCreateLedgerFunction · 0.95

Calls 2

postLedgerActionsMethod · 0.95
CreateLedgerMethod · 0.65

Tested by 1

TestCreateLedgerFunction · 0.76