MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / SetMainAccount

Function SetMainAccount

cmd/cql-proxy/model/developer.go:113–127  ·  view source on GitHub ↗

SetMainAccount set the main account keypair for developer.

(db *gorp.DbMap, developerID int64, account utils.AccountAddress)

Source from the content-addressed store, hash-verified

111
112// SetMainAccount set the main account keypair for developer.
113func SetMainAccount(db *gorp.DbMap, developerID int64, account utils.AccountAddress) (err error) {
114 // query account for existence
115 ar, err := GetAccount(db, developerID, account)
116 if err != nil {
117 err = errors.Wrapf(err, "get user account info failed")
118 return
119 }
120
121 _, err = db.Exec(
122 `UPDATE "developer" SET "main_account" = ? WHERE "id" = ?`, ar.ID, developerID)
123 if err != nil {
124 err = errors.Wrapf(err, "set account as developer main account failed")
125 }
126 return
127}
128
129// SetIfNoMainAccount set the main account keypair for developer if no main account being set.
130func SetIfNoMainAccount(db *gorp.DbMap, developerID int64, account utils.AccountAddress) (err error) {

Callers 2

setMainAccountFunction · 0.92
SetIfNoMainAccountFunction · 0.85

Calls 2

GetAccountFunction · 0.85
ExecMethod · 0.65

Tested by

no test coverage detected