factories

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BundleReaderFactory added in v0.6.0

func BundleReaderFactory(db database.Database) (repo storage.BundleReader)

BundleReaderFactory is a factory function that creates and returns a BundleReader based on the type of database engine being used.

func BundleWriterFactory added in v0.6.0

func BundleWriterFactory(db database.Database) (repo storage.BundleWriter)

BundleWriterFactory is a factory function that creates and returns a BundleWriter based on the type of database engine being used.

func DataReaderFactory added in v0.5.0

func DataReaderFactory(db database.Database) (repo storage.DataReader)

DataReaderFactory creates and returns a DataReader based on the database engine type.

func DataWriterFactory added in v0.5.0

func DataWriterFactory(db database.Database) (repo storage.DataWriter)

DataWriterFactory creates and returns a DataWriter based on the database engine type.

func DatabaseFactory

func DatabaseFactory(conf config.Database) (db database.Database, err error)

DatabaseFactory is a factory function that creates a database instance according to the given configuration. It supports different types of databases, such as PostgreSQL and in-memory databases.

conf: the configuration object containing the necessary information to create a database connection.

It should have the following properties:
- Engine: the type of the database, e.g., POSTGRES or MEMORY
- URI: the connection string for the database (only required for some database engines, e.g., POSTGRES)
- MaxOpenConnections: the maximum number of open connections to the database
- MaxIdleConnections: the maximum number of idle connections in the connection pool
- MaxConnectionIdleTime: the maximum amount of time a connection can be idle before being closed
- MaxConnectionLifetime: the maximum amount of time a connection can be reused before being closed
- WatchBufferSize: specifies the buffer size for database watch operations, impacting how many changes can be queued
- MaxDataPerWrite: sets the maximum amount of data per write operation to the database
- MaxRetries: defines the maximum number of retries for database operations in case of failure

Returns a database.Database instance if the database connection is successfully created, or an error if the creation fails or the specified database engine is unsupported.

func SchemaReaderFactory

func SchemaReaderFactory(db database.Database) (repo storage.SchemaReader)

SchemaReaderFactory creates and returns a SchemaReader based on the database engine type.

func SchemaWriterFactory

func SchemaWriterFactory(db database.Database) (repo storage.SchemaWriter)

SchemaWriterFactory creates and returns a SchemaWriter based on the database engine type.

func TenantReaderFactory added in v0.3.0

func TenantReaderFactory(db database.Database) (repo storage.TenantReader)

TenantReaderFactory creates and returns a TenantReader based on the database engine type.

func TenantWriterFactory added in v0.3.0

func TenantWriterFactory(db database.Database) (repo storage.TenantWriter)

TenantWriterFactory creates and returns a TenantWriter based on the database engine type.

func WatcherFactory added in v0.4.4

func WatcherFactory(db database.Database) (repo storage.Watcher)

WatcherFactory creates and returns a Watcher based on the database engine type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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