SetMainAccount set the main account keypair for developer.
(db *gorp.DbMap, developerID int64, account utils.AccountAddress)
| 111 | |
| 112 | // SetMainAccount set the main account keypair for developer. |
| 113 | func 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. |
| 130 | func SetIfNoMainAccount(db *gorp.DbMap, developerID int64, account utils.AccountAddress) (err error) { |
no test coverage detected