Documentation
¶
Index ¶
- type Account
- type AccountData
- type Accounts
- type FileStorage
- func (storage *FileStorage) AccountAdded(account *Account)
- func (storage *FileStorage) AccountRemoved(account *Account)
- func (storage *FileStorage) AccountUpdated(account *Account)
- func (storage *FileStorage) ReadAll() (*Accounts, error)
- func (storage *FileStorage) WriteAll(accounts *Accounts) error
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
Email string `json:"email"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
DateCreated time.Time `json:"dateCreated"`
DateModified time.Time `json:"dateModified"`
Data AccountData `json:"data"`
}
Account represents a single site account.
func NewAccount ¶
NewAccount creates a new site account.
func (*Account) Copy ¶
Copy copies the data of the given account to this account; if copyData is true, the account data is copied as well.
func (*Account) GetSiteID ¶
func (acc *Account) GetSiteID() key.SiteIdentifier
GetSiteID returns the site ID (generated from the API key) for the given account.
type AccountData ¶
AccountData holds additional data for a site account.
type FileStorage ¶
type FileStorage struct {
Storage
// contains filtered or unexported fields
}
FileStorage implements a filePath-based storage.
func NewFileStorage ¶
func NewFileStorage(conf *config.Configuration, log *zerolog.Logger) (*FileStorage, error)
NewFileStorage creates a new filePath storage.
func (*FileStorage) AccountAdded ¶
func (storage *FileStorage) AccountAdded(account *Account)
AccountAdded is called when an account has been added.
func (*FileStorage) AccountRemoved ¶
func (storage *FileStorage) AccountRemoved(account *Account)
AccountRemoved is called when an account has been removed.
func (*FileStorage) AccountUpdated ¶
func (storage *FileStorage) AccountUpdated(account *Account)
AccountUpdated is called when an account has been updated.
func (*FileStorage) ReadAll ¶
func (storage *FileStorage) ReadAll() (*Accounts, error)
ReadAll reads all stored accounts into the given data object.
func (*FileStorage) WriteAll ¶
func (storage *FileStorage) WriteAll(accounts *Accounts) error
WriteAll writes all stored accounts from the given data object.
type Storage ¶
type Storage interface {
// ReadAll reads all stored accounts into the given data object.
ReadAll() (*Accounts, error)
// WriteAll writes all stored accounts from the given data object.
WriteAll(accounts *Accounts) error
// AccountAdded is called when an account has been added.
AccountAdded(account *Account)
// AccountUpdated is called when an account has been updated.
AccountUpdated(account *Account)
// AccountRemoved is called when an account has been removed.
AccountRemoved(account *Account)
}
Storage defines the interface for accounts storages.