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

Method CreateAccount

account.go:137–153  ·  view source on GitHub ↗

CreateAccount creates a new account in the database. It overrides the ledger and identity details, applies the account name, and fetches external account details. Parameters: - account model.Account: The Account model to be created. Returns: - model.Account: The created Account model. - error: An

(account model.Account)

Source from the content-addressed store, hash-verified

135// - model.Account: The created Account model.
136// - error: An error if the account could not be created.
137func (l *LedgerForge) CreateAccount(account model.Account) (model.Account, error) {
138 err := l.overrideLedgerAndIdentity(&account)
139 if err != nil {
140 return model.Account{}, err
141 }
142
143 err = l.applyAccountName(&account)
144 if err != nil {
145 return model.Account{}, err
146 }
147
148 err = applyExternalAccount(&account)
149 if err != nil {
150 return model.Account{}, err
151 }
152 return l.datasource.CreateAccount(account)
153}
154
155// GetAccount retrieves an account by its ID.
156// It fetches the account from the datasource and includes additional data as specified.

Callers 2

TestCreateAccountFunction · 0.95

Calls 4

applyAccountNameMethod · 0.95
applyExternalAccountFunction · 0.85
CreateAccountMethod · 0.65

Tested by 2

TestCreateAccountFunction · 0.76