Documentation ¶
Index ¶
- func New(_ context.Context, d db.DB, m metrics.Collector) (db.DB, error)
- type CacheMem
- func (c *CacheMem) Close(ctx context.Context) db.Error
- func (c *CacheMem) CountApplicationTokens(ctx context.Context) (int64, db.Error)
- func (c *CacheMem) CountFediAccounts(ctx context.Context) (int64, db.Error)
- func (c *CacheMem) CountFediAccountsForInstance(ctx context.Context, instanceID int64) (int64, db.Error)
- func (c *CacheMem) CountFediInstances(ctx context.Context) (int64, db.Error)
- func (c *CacheMem) CountOauthClients(ctx context.Context) (int64, db.Error)
- func (c *CacheMem) Create(ctx context.Context, i interface{}) db.Error
- func (c *CacheMem) CreateApplicationToken(ctx context.Context, applicationToken *models.ApplicationToken) db.Error
- func (c *CacheMem) CreateFediAccount(ctx context.Context, account *models.FediAccount) db.Error
- func (c *CacheMem) CreateFediInstance(ctx context.Context, instance *models.FediInstance) db.Error
- func (c *CacheMem) CreateOauthClient(ctx context.Context, client *models.OauthClient) (err db.Error)
- func (c *CacheMem) DoMigration(ctx context.Context) db.Error
- func (c *CacheMem) IncFediAccountLoginCount(ctx context.Context, account *models.FediAccount) db.Error
- func (c *CacheMem) LoadTestData(ctx context.Context) db.Error
- func (c *CacheMem) ReadApplicationToken(ctx context.Context, id int64) (*models.ApplicationToken, db.Error)
- func (c *CacheMem) ReadApplicationTokenByToken(ctx context.Context, token string) (*models.ApplicationToken, db.Error)
- func (c *CacheMem) ReadApplicationTokensPage(ctx context.Context, index, count int) ([]*models.ApplicationToken, db.Error)
- func (c *CacheMem) ReadByID(ctx context.Context, id int64, i interface{}) db.Error
- func (c *CacheMem) ReadFediAccount(ctx context.Context, id int64) (*models.FediAccount, db.Error)
- func (c *CacheMem) ReadFediAccountByUsername(ctx context.Context, instanceID int64, username string) (*models.FediAccount, db.Error)
- func (c *CacheMem) ReadFediAccountsPage(ctx context.Context, index, count int) (instances []*models.FediAccount, err db.Error)
- func (c *CacheMem) ReadFediInstance(ctx context.Context, id int64) (*models.FediInstance, db.Error)
- func (c *CacheMem) ReadFediInstanceByDomain(ctx context.Context, domain string) (*models.FediInstance, db.Error)
- func (c *CacheMem) ReadFediInstancesPage(ctx context.Context, index, count int) ([]*models.FediInstance, db.Error)
- func (c *CacheMem) ReadOauthClient(ctx context.Context, id int64) (*models.OauthClient, db.Error)
- func (c *CacheMem) ReadOauthClientsPage(ctx context.Context, index, count int) (clients []*models.OauthClient, err db.Error)
- func (c *CacheMem) ResetCache(ctx context.Context) db.Error
- func (c *CacheMem) Update(ctx context.Context, i interface{}) db.Error
- func (c *CacheMem) UpdateApplicationToken(ctx context.Context, applicationToken *models.ApplicationToken) db.Error
- func (c *CacheMem) UpdateFediAccount(ctx context.Context, account *models.FediAccount) db.Error
- func (c *CacheMem) UpdateFediInstance(ctx context.Context, instance *models.FediInstance) db.Error
- func (c *CacheMem) UpdateOauthClient(ctx context.Context, client *models.OauthClient) (err db.Error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheMem ¶
type CacheMem struct {
// contains filtered or unexported fields
}
CacheMem is an in memory caching middleware for our db interface.
func (*CacheMem) CountApplicationTokens ¶
CountApplicationTokens returns the number of application token.
func (*CacheMem) CountFediAccounts ¶
CountFediAccounts returns the number of federated social account.
func (*CacheMem) CountFediAccountsForInstance ¶
func (c *CacheMem) CountFediAccountsForInstance(ctx context.Context, instanceID int64) (int64, db.Error)
CountFediAccountsForInstance returns the number of federated social account for an instance.
func (*CacheMem) CountFediInstances ¶
CountFediInstances returns the number of federated instances.
func (*CacheMem) CountOauthClients ¶
CountOauthClients returns the number of oauth clients.
func (*CacheMem) CreateApplicationToken ¶
func (c *CacheMem) CreateApplicationToken(ctx context.Context, applicationToken *models.ApplicationToken) db.Error
CreateApplicationToken stores the application token.
func (*CacheMem) CreateFediAccount ¶
CreateFediAccount stores the federated instance and caches it.
func (*CacheMem) CreateFediInstance ¶
CreateFediInstance stores the federated instance and caches it.
func (*CacheMem) CreateOauthClient ¶
func (c *CacheMem) CreateOauthClient(ctx context.Context, client *models.OauthClient) (err db.Error)
CreateOauthClient stores the oauth client.
func (*CacheMem) DoMigration ¶
DoMigration is a pass through.
func (*CacheMem) IncFediAccountLoginCount ¶
func (c *CacheMem) IncFediAccountLoginCount(ctx context.Context, account *models.FediAccount) db.Error
IncFediAccountLoginCount updates the login count of a stored federated instance.
func (*CacheMem) LoadTestData ¶
LoadTestData is a pass through.
func (*CacheMem) ReadApplicationToken ¶
func (c *CacheMem) ReadApplicationToken(ctx context.Context, id int64) (*models.ApplicationToken, db.Error)
ReadApplicationToken returns one application token.
func (*CacheMem) ReadApplicationTokenByToken ¶
func (c *CacheMem) ReadApplicationTokenByToken(ctx context.Context, token string) (*models.ApplicationToken, db.Error)
ReadApplicationTokenByToken returns one application token.
func (*CacheMem) ReadApplicationTokensPage ¶
func (c *CacheMem) ReadApplicationTokensPage(ctx context.Context, index, count int) ([]*models.ApplicationToken, db.Error)
ReadApplicationTokensPage returns a page of application tokens.
func (*CacheMem) ReadFediAccount ¶
ReadFediAccount returns one federated social account.
func (*CacheMem) ReadFediAccountByUsername ¶
func (c *CacheMem) ReadFediAccountByUsername(ctx context.Context, instanceID int64, username string) (*models.FediAccount, db.Error)
ReadFediAccountByUsername returns one federated social account.
func (*CacheMem) ReadFediAccountsPage ¶
func (c *CacheMem) ReadFediAccountsPage(ctx context.Context, index, count int) (instances []*models.FediAccount, err db.Error)
ReadFediAccountsPage returns a page of federated social accounts.
func (*CacheMem) ReadFediInstance ¶
ReadFediInstance returns one federated social instance.
func (*CacheMem) ReadFediInstanceByDomain ¶
func (c *CacheMem) ReadFediInstanceByDomain(ctx context.Context, domain string) (*models.FediInstance, db.Error)
ReadFediInstanceByDomain returns one federated social instance.
func (*CacheMem) ReadFediInstancesPage ¶
func (c *CacheMem) ReadFediInstancesPage(ctx context.Context, index, count int) ([]*models.FediInstance, db.Error)
ReadFediInstancesPage returns a page of federated social instances.
func (*CacheMem) ReadOauthClient ¶
ReadOauthClient returns one oauth client.
func (*CacheMem) ReadOauthClientsPage ¶
func (c *CacheMem) ReadOauthClientsPage(ctx context.Context, index, count int) (clients []*models.OauthClient, err db.Error)
ReadOauthClientsPage returns a page of oauth clients.
func (*CacheMem) ResetCache ¶
ResetCache clears all the caches.
func (*CacheMem) UpdateApplicationToken ¶
func (c *CacheMem) UpdateApplicationToken(ctx context.Context, applicationToken *models.ApplicationToken) db.Error
UpdateApplicationToken updates the stored application token.
func (*CacheMem) UpdateFediAccount ¶
UpdateFediAccount updates the stored federated instance and caches it.
func (*CacheMem) UpdateFediInstance ¶
UpdateFediInstance updates the stored federated instance and caches it.
func (*CacheMem) UpdateOauthClient ¶
func (c *CacheMem) UpdateOauthClient(ctx context.Context, client *models.OauthClient) (err db.Error)
UpdateOauthClient updates the stored oauth client.