yenda 024f30f0b9 Put settings in a table with schema (#1746)
Move settings table schema from a key-value store to a one row table with many columns.

We now save the first row with initial data in saveAccountAndLogin and follow up saveSetting calls are only saving one setting at a time.

Co-authored-by: Adam Babik <a.babik@designfortress.com>
2019-12-27 10:58:25 +01:00

25 lines
545 B
Go

package accounts
import (
"context"
"github.com/status-im/status-go/multiaccounts/accounts"
)
func NewSettingsAPI(db *accounts.Database) *SettingsAPI {
return &SettingsAPI{db}
}
// SettingsAPI is class with methods available over RPC.
type SettingsAPI struct {
db *accounts.Database
}
func (api *SettingsAPI) SaveSetting(ctx context.Context, typ string, val interface{}) error {
return api.db.SaveSetting(typ, val)
}
func (api *SettingsAPI) GetSettings(ctx context.Context) (accounts.Settings, error) {
return api.db.GetSettings()
}