factories

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

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 RelationshipReaderFactory

func RelationshipReaderFactory(db database.Database, logger logger.Interface) (repo storage.RelationshipReader)

RelationshipReaderFactory is a factory function that returns a relationship reader instance according to the given database interface. It supports different types of databases, such as PostgreSQL and in-memory databases.

db: the database.Database instance for which the relationship reader should be created logger: the logger.Interface instance to be used by the relationship reader for logging purposes

Returns a storage.RelationshipReader instance that performs read operations on the relationships stored in the given database. If the database engine type is not recognized, it defaults to an in-memory database.

func RelationshipWriterFactory

func RelationshipWriterFactory(db database.Database, logger logger.Interface) (repo storage.RelationshipWriter)

RelationshipWriterFactory is a factory function that returns a relationship writer instance according to the given database interface. It supports different types of databases, such as PostgreSQL and in-memory databases.

db: the database.Database instance for which the relationship writer should be created logger: the logger.Interface instance to be used by the relationship writer for logging purposes

Returns a storage.RelationshipWriter instance that performs write operations on the relationships stored in the given database. If the database engine type is not recognized, it defaults to an in-memory database.

func SchemaReaderFactory

func SchemaReaderFactory(db database.Database, logger logger.Interface) (repo storage.SchemaReader)

SchemaReaderFactory is a factory function that returns a schema reader instance according to the given database interface. It supports different types of databases, such as PostgreSQL and in-memory databases.

db: the database.Database instance for which the schema reader should be created logger: the logger.Interface instance to be used by the schema reader for logging purposes

Returns a storage.SchemaReader instance that performs read operations on the schema stored in the given database. If the database engine type is not recognized, it defaults to an in-memory database.

func SchemaWriterFactory

func SchemaWriterFactory(db database.Database, logger logger.Interface) (repo storage.SchemaWriter)

SchemaWriterFactory is a factory function that returns a schema writer instance according to the given database interface. It supports different types of databases, such as PostgreSQL and in-memory databases.

db: the database.Database instance for which the schema writer should be created logger: the logger.Interface instance to be used by the schema writer for logging purposes

Returns a storage.SchemaWriter instance that performs write operations on the schema stored in the given database. If the database engine type is not recognized, it defaults to an in-memory database.

func TenantReaderFactory added in v0.3.0

func TenantReaderFactory(db database.Database, logger logger.Interface) (repo storage.TenantReader)

TenantReaderFactory is a factory function that returns a tenant reader instance according to the given database interface. It supports different types of databases, such as PostgreSQL and in-memory databases.

db: the database.Database instance for which the tenant reader should be created logger: the logger.Interface instance to be used by the tenant reader for logging purposes

Returns a storage.TenantReader instance that performs read operations on the tenants stored in the given database. If the database engine type is not recognized, it defaults to an in-memory database.

func TenantWriterFactory added in v0.3.0

func TenantWriterFactory(db database.Database, logger logger.Interface) (repo storage.TenantWriter)

TenantWriterFactory is a factory function that returns a tenant writer instance according to the given database interface. It supports different types of databases, such as PostgreSQL and in-memory databases.

db: the database.Database instance for which the tenant writer should be created logger: the logger.Interface instance to be used by the tenant writer for logging purposes

Returns a storage.TenantWriter instance that performs write operations on the tenants stored in the given database. If the database engine type is not recognized, it defaults to an in-memory database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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