feat(store): add SetWhitelistEnabled
This commit is contained in:
@@ -86,3 +86,18 @@ func (s *Store) ListWhitelist(account string, dir Direction) ([]string, error) {
|
||||
}
|
||||
return out, rows.Err()
|
||||
}
|
||||
|
||||
// SetWhitelistEnabled toggles one account's per-direction whitelist-enabled
|
||||
// flag, leaving the address list and all other fields untouched.
|
||||
func (s *Store) SetWhitelistEnabled(account string, dir Direction, enabled bool) error {
|
||||
col := "whitelist_in_enabled"
|
||||
if dir == DirOut {
|
||||
col = "whitelist_out_enabled"
|
||||
}
|
||||
id, err := s.accountID(account)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = s.db.Exec(fmt.Sprintf("UPDATE accounts SET %s=? WHERE id=?", col), b2i(enabled), id)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user