bun

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2022 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bun

type Bun struct {
	*bun.DB
	// contains filtered or unexported fields
}

Bun represents a bun db connection and it's error handler

func (*Bun) ProcessError

func (conn *Bun) ProcessError(err error) db.Error

ProcessError replaces any known values with our own db.Error types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a DB interface compatible client for Bun

func New

func New(ctx context.Context) (*Client, error)

New creates a new bun database client

func (*Client) Close

func (c *Client) Close(ctx context.Context) db.Error

Close closes the bun db connection

func (*Client) CountAccounts

func (c *Client) CountAccounts(ctx context.Context) (int64, db.Error)

CountAccounts returns the number of federated social account.

func (*Client) CountAccountsForInstance

func (c *Client) CountAccountsForInstance(ctx context.Context, instanceID int64) (int64, db.Error)

CountAccountsForInstance returns the number of federated social account for an instance.

func (*Client) CountBlocks

func (c *Client) CountBlocks(ctx context.Context) (int64, db.Error)

CountBlocks returns the number of domain blocks.

func (*Client) CountInstances

func (c *Client) CountInstances(ctx context.Context) (int64, db.Error)

CountInstances returns the number of federated instances.

func (*Client) CountLogEntries added in v0.3.0

func (c *Client) CountLogEntries(ctx context.Context) (int64, db.Error)

CountLogEntries returns the number of log entries.

func (*Client) CreateAccount

func (c *Client) CreateAccount(ctx context.Context, account *models.Account) db.Error

CreateAccount stores the federated social account.

func (*Client) CreateBlockTX added in v0.3.0

func (c *Client) CreateBlockTX(ctx context.Context, txID db.TxID, blocks ...*models.Block) db.Error

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

func (c *Client) CreateInstance(ctx context.Context, instance *models.Instance) db.Error

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

func (c *Client) DeleteBlock(ctx context.Context, blocks ...*models.Block) db.Error

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

func (c *Client) DoMigration(ctx context.Context) db.Error

DoMigration runs schema migrations on the database

func (*Client) IncAccountLoginCount

func (c *Client) IncAccountLoginCount(ctx context.Context, account *models.Account) db.Error

IncAccountLoginCount updates the login count of a stored federated instance.

func (*Client) ReadAccount

func (c *Client) ReadAccount(ctx context.Context, id int64) (*models.Account, db.Error)

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) ReadBlock

func (c *Client) ReadBlock(ctx context.Context, id int64) (*models.Block, db.Error)

ReadBlock returns one domain block

func (*Client) ReadBlockByDomain

func (c *Client) ReadBlockByDomain(ctx context.Context, domain string) (*models.Block, db.Error)

ReadBlockByDomain returns one domain block

func (*Client) ReadBlocks

func (c *Client) ReadBlocks(ctx context.Context) ([]*models.Block, db.Error)

ReadBlocks returns all domain block

func (*Client) ReadBlocksPage

func (c *Client) ReadBlocksPage(ctx context.Context, index, count int) ([]*models.Block, db.Error)

ReadBlocksPage returns a page of domain blocks.

func (*Client) ReadConfig

func (c *Client) ReadConfig(ctx context.Context, id int64) (*models.Config, db.Error)

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 (c *Client) ReadConfigsForAccountForKeys(ctx context.Context, accountID int64, keys ...models.ConfigKey) ([]*models.Config, db.Error)

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

func (c *Client) ReadInstance(ctx context.Context, id int64) (*models.Instance, db.Error)

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

func (c *Client) ReadInstances(ctx context.Context, ids ...int64) ([]*models.Instance, db.Error)

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

func (c *Client) ReadInstancesWhereFollowing(ctx context.Context) ([]*models.Instance, db.Error)

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) TxCommit

func (c *Client) TxCommit(_ context.Context, id db.TxID) db.Error

func (*Client) TxNew

func (c *Client) TxNew(ctx context.Context) (db.TxID, db.Error)

func (*Client) TxRollback

func (c *Client) TxRollback(_ context.Context, id db.TxID) db.Error

func (*Client) UpdateAccount

func (c *Client) UpdateAccount(ctx context.Context, account *models.Account) db.Error

UpdateAccount updates the stored federated social account.

func (*Client) UpdateBlockTX added in v0.3.0

func (c *Client) UpdateBlockTX(ctx context.Context, txID db.TxID, blocks ...*models.Block) db.Error

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

func (c *Client) UpdateInstance(ctx context.Context, instance *models.Instance) db.Error

UpdateInstance updates the stored federated instance

func (*Client) UpdateInstanceTX added in v0.3.0

func (c *Client) UpdateInstanceTX(ctx context.Context, txID db.TxID, instance *models.Instance) db.Error

UpdateInstanceTX updates the stored federated instance in a transaction.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL