Documentation ¶
Index ¶
- type Bun
- type Client
- func (c *Client) Close(ctx context.Context) db.Error
- func (c *Client) CountAccounts(ctx context.Context) (int64, db.Error)
- func (c *Client) CountAccountsForInstance(ctx context.Context, instanceID int64) (int64, db.Error)
- func (c *Client) CountBlocks(ctx context.Context) (int64, db.Error)
- func (c *Client) CountInstances(ctx context.Context) (int64, db.Error)
- func (c *Client) CountLogEntries(ctx context.Context) (int64, db.Error)
- func (c *Client) CreateAccount(ctx context.Context, account *models.Account) db.Error
- func (c *Client) CreateBlockTX(ctx context.Context, txID db.TxID, blocks ...*models.Block) db.Error
- func (c *Client) CreateConfigTX(ctx context.Context, txID db.TxID, configs ...*models.Config) db.Error
- func (c *Client) CreateInstance(ctx context.Context, instance *models.Instance) db.Error
- func (c *Client) CreateLogEntryTX(ctx context.Context, txID db.TxID, logEntries ...*models.LogEntry) db.Error
- func (c *Client) DeleteBlock(ctx context.Context, blocks ...*models.Block) db.Error
- func (c *Client) DeleteConfigTX(ctx context.Context, txID db.TxID, configs ...*models.Config) db.Error
- func (c *Client) DoMigration(ctx context.Context) db.Error
- func (c *Client) IncAccountLoginCount(ctx context.Context, account *models.Account) db.Error
- func (c *Client) ReadAccount(ctx context.Context, id int64) (*models.Account, db.Error)
- func (c *Client) ReadAccountByUsername(ctx context.Context, instanceID int64, username string) (*models.Account, db.Error)
- func (c *Client) ReadAccountsPage(ctx context.Context, index, count int) ([]*models.Account, db.Error)
- func (c *Client) ReadBlock(ctx context.Context, id int64) (*models.Block, db.Error)
- func (c *Client) ReadBlockByDomain(ctx context.Context, domain string) (*models.Block, db.Error)
- func (c *Client) ReadBlocks(ctx context.Context) ([]*models.Block, db.Error)
- func (c *Client) ReadBlocksPage(ctx context.Context, index, count int) ([]*models.Block, db.Error)
- func (c *Client) ReadConfig(ctx context.Context, id int64) (*models.Config, db.Error)
- func (c *Client) ReadConfigByKey(ctx context.Context, key models.ConfigKey) (*models.Config, db.Error)
- func (c *Client) ReadConfigsForAccountForKeys(ctx context.Context, accountID int64, keys ...models.ConfigKey) ([]*models.Config, db.Error)
- func (c *Client) ReadConfigsForKeysSystem(ctx context.Context, keys ...models.ConfigKey) ([]*models.Config, db.Error)
- func (c *Client) ReadConfigsForKeysUser(ctx context.Context, keys ...models.ConfigKey) ([]*models.Config, db.Error)
- func (c *Client) ReadInstance(ctx context.Context, id int64) (*models.Instance, db.Error)
- func (c *Client) ReadInstanceByActorIRI(ctx context.Context, actorIRI string) (*models.Instance, db.Error)
- func (c *Client) ReadInstanceByDomain(ctx context.Context, domain string) (*models.Instance, db.Error)
- func (c *Client) ReadInstanceByServerHostname(ctx context.Context, serverHostname string) (*models.Instance, db.Error)
- func (c *Client) ReadInstances(ctx context.Context, ids ...int64) ([]*models.Instance, db.Error)
- func (c *Client) ReadInstancesPage(ctx context.Context, index, count int) ([]*models.Instance, db.Error)
- func (c *Client) ReadInstancesWhereFollowing(ctx context.Context) ([]*models.Instance, db.Error)
- func (c *Client) ReadInstancesWithBlockID(ctx context.Context, blockID int64) ([]*models.Instance, db.Error)
- func (c *Client) ReadInstancesWithDomainSuffix(ctx context.Context, domainSuffix string) ([]*models.Instance, db.Error)
- func (c *Client) ReadLogEntriesPage(ctx context.Context, index, count int, asc bool) ([]*models.LogEntry, db.Error)
- func (c *Client) TxCommit(_ context.Context, id db.TxID) db.Error
- func (c *Client) TxNew(ctx context.Context) (db.TxID, db.Error)
- func (c *Client) TxRollback(_ context.Context, id db.TxID) db.Error
- func (c *Client) UpdateAccount(ctx context.Context, account *models.Account) db.Error
- func (c *Client) UpdateBlockTX(ctx context.Context, txID db.TxID, blocks ...*models.Block) db.Error
- func (c *Client) UpdateConfigTX(ctx context.Context, txID db.TxID, configs ...*models.Config) db.Error
- func (c *Client) UpdateInstance(ctx context.Context, instance *models.Instance) db.Error
- func (c *Client) UpdateInstanceTX(ctx context.Context, txID db.TxID, instance *models.Instance) db.Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a DB interface compatible client for Bun
func (*Client) CountAccounts ¶
CountAccounts returns the number of federated social account.
func (*Client) CountAccountsForInstance ¶
CountAccountsForInstance returns the number of federated social account for an instance.
func (*Client) CountBlocks ¶
CountBlocks returns the number of domain blocks.
func (*Client) CountInstances ¶
CountInstances returns the number of federated instances.
func (*Client) CountLogEntries ¶ added in v0.3.0
CountLogEntries returns the number of log entries.
func (*Client) CreateAccount ¶
CreateAccount stores the federated social account.
func (*Client) CreateBlockTX ¶ added in v0.3.0
CreateBlockTX stores the domain block in a transaction.
func (*Client) CreateConfigTX ¶
func (c *Client) CreateConfigTX(ctx context.Context, txID db.TxID, configs ...*models.Config) db.Error
CreateConfigTX stores the configs using a transaction.
func (*Client) CreateInstance ¶
CreateInstance stores the federated instance
func (*Client) CreateLogEntryTX ¶ added in v0.3.0
func (c *Client) CreateLogEntryTX(ctx context.Context, txID db.TxID, logEntries ...*models.LogEntry) db.Error
CreateLogEntryTX stores the log entry.
func (*Client) DeleteBlock ¶
DeleteBlock deletes the stored domain block
func (*Client) DeleteConfigTX ¶
func (c *Client) DeleteConfigTX(ctx context.Context, txID db.TxID, configs ...*models.Config) db.Error
DeleteConfigTX deletes configs using a transaction.
func (*Client) DoMigration ¶
DoMigration runs schema migrations on the database
func (*Client) IncAccountLoginCount ¶
IncAccountLoginCount updates the login count of a stored federated instance.
func (*Client) ReadAccount ¶
ReadAccount returns one federated social account.
func (*Client) ReadAccountByUsername ¶
func (c *Client) ReadAccountByUsername(ctx context.Context, instanceID int64, username string) (*models.Account, db.Error)
ReadAccountByUsername returns one federated social account.
func (*Client) ReadAccountsPage ¶
func (c *Client) ReadAccountsPage(ctx context.Context, index, count int) ([]*models.Account, db.Error)
ReadAccountsPage returns a page of federated social accounts.
func (*Client) ReadBlockByDomain ¶
ReadBlockByDomain returns one domain block
func (*Client) ReadBlocks ¶
ReadBlocks returns all domain block
func (*Client) ReadBlocksPage ¶
ReadBlocksPage returns a page of domain blocks.
func (*Client) ReadConfig ¶
ReadConfig returns one config.
func (*Client) ReadConfigByKey ¶ added in v0.5.0
func (c *Client) ReadConfigByKey(ctx context.Context, key models.ConfigKey) (*models.Config, db.Error)
ReadConfigByKey returns one config.
func (*Client) ReadConfigsForAccountForKeys ¶ added in v0.2.0
func (*Client) ReadConfigsForKeysSystem ¶ added in v0.2.0
func (c *Client) ReadConfigsForKeysSystem(ctx context.Context, keys ...models.ConfigKey) ([]*models.Config, db.Error)
ReadConfigsForKeysSystem returns one config.
func (*Client) ReadConfigsForKeysUser ¶ added in v0.2.0
func (c *Client) ReadConfigsForKeysUser(ctx context.Context, keys ...models.ConfigKey) ([]*models.Config, db.Error)
ReadConfigsForKeysUser returns one config.
func (*Client) ReadInstance ¶
ReadInstance returns one federated social instance
func (*Client) ReadInstanceByActorIRI ¶
func (c *Client) ReadInstanceByActorIRI(ctx context.Context, actorIRI string) (*models.Instance, db.Error)
ReadInstanceByActorIRI returns one federated social instance
func (*Client) ReadInstanceByDomain ¶
func (c *Client) ReadInstanceByDomain(ctx context.Context, domain string) (*models.Instance, db.Error)
ReadInstanceByDomain returns one federated social instance
func (*Client) ReadInstanceByServerHostname ¶
func (c *Client) ReadInstanceByServerHostname(ctx context.Context, serverHostname string) (*models.Instance, db.Error)
ReadInstanceByServerHostname returns one federated social instance
func (*Client) ReadInstances ¶ added in v0.4.2
ReadInstances returns a page of domain blocks.
func (*Client) ReadInstancesPage ¶
func (c *Client) ReadInstancesPage(ctx context.Context, index, count int) ([]*models.Instance, db.Error)
ReadInstancesPage returns a page of domain blocks.
func (*Client) ReadInstancesWhereFollowing ¶
ReadInstancesWhereFollowing returns all federated social instances which are following this relay
func (*Client) ReadInstancesWithBlockID ¶
func (c *Client) ReadInstancesWithBlockID(ctx context.Context, blockID int64) ([]*models.Instance, db.Error)
ReadInstancesWithBlockID returns all instances with domain suffix
func (*Client) ReadInstancesWithDomainSuffix ¶
func (c *Client) ReadInstancesWithDomainSuffix(ctx context.Context, domainSuffix string) ([]*models.Instance, db.Error)
ReadInstancesWithDomainSuffix returns all instances with domain suffix
func (*Client) ReadLogEntriesPage ¶ added in v0.3.0
func (c *Client) ReadLogEntriesPage(ctx context.Context, index, count int, asc bool) ([]*models.LogEntry, db.Error)
ReadLogEntriesPage returns a page of log entries.
func (*Client) UpdateAccount ¶
UpdateAccount updates the stored federated social account.
func (*Client) UpdateBlockTX ¶ added in v0.3.0
UpdateBlockTX updates the stored domain block in a transaction
func (*Client) UpdateConfigTX ¶
func (c *Client) UpdateConfigTX(ctx context.Context, txID db.TxID, configs ...*models.Config) db.Error
UpdateConfigTX updates configs using a transaction.
func (*Client) UpdateInstance ¶
UpdateInstance updates the stored federated instance