store.go 793 B

1234567891011121314151617181920212223242526272829
  1. package stores
  2. import (
  3. "errors"
  4. "github.com/torkelo/grafana-pro/pkg/models"
  5. )
  6. type Store interface {
  7. GetDashboard(slug string, accountId int) (*models.Dashboard, error)
  8. SaveDashboard(dash *models.Dashboard) error
  9. DeleteDashboard(slug string, accountId int) error
  10. Query(query string, acccountId int) ([]*models.SearchResult, error)
  11. CreateAccount(acccount *models.Account) error
  12. UpdateAccount(acccount *models.Account) error
  13. GetAccountByLogin(emailOrName string) (*models.Account, error)
  14. GetAccount(accountId int) (*models.Account, error)
  15. GetOtherAccountsFor(accountId int) ([]*models.OtherAccount, error)
  16. Close()
  17. }
  18. // Typed errors
  19. var (
  20. ErrAccountNotFound = errors.New("Account not found")
  21. )
  22. func New() Store {
  23. return NewRethinkStore(&RethinkCfg{DatabaseName: "grafana"})
  24. }