grafana/pkg/models/account.go
2014-12-16 09:06:49 +01:00

43 lines
1.1 KiB
Go

package models
import (
"errors"
"time"
)
var (
SaveAccount func(account *Account) error
GetAccountByLogin func(emailOrName string) (*Account, error)
GetAccount func(accountId int64) (*Account, error)
GetOtherAccountsFor func(accountId int64) ([]*OtherAccount, error)
GetCollaboratorsForAccount func(accountId int64) ([]*CollaboratorInfo, error)
AddCollaborator func(collaborator *Collaborator) error
)
// Typed errors
var (
ErrAccountNotFound = errors.New("Account not found")
)
type OtherAccount struct {
Id int64
Email string
Role string
}
type Account struct {
Id int64
Login string `xorm:"UNIQUE NOT NULL"`
Email string `xorm:"UNIQUE NOT NULL"`
Name string `xorm:"UNIQUE NOT NULL"`
FullName string
Password string
IsAdmin bool
Salt string `xorm:"VARCHAR(10)"`
Company string
NextDashboardId int
UsingAccountId int64
Created time.Time `xorm:"CREATED"`
Updated time.Time `xorm:"UPDATED"`
}