Implements: IReferenceable, IConfigurable, IOpenable
Description
The SqliteConnection class allows you to create SQLite connections using the default driver.
Important points
By defining a connection and sharing it through multiple persistence components you can reduce the number of used database connections.
Configuration parameters
- connection(s):
- discovery_key: (optional) key to retrieve the connection from IDiscovery
- database: database file path
- uri: resource URI with file:// protocol
References
- *:logger:*:*:1.0 - (optional) ILogger components to pass log messages
- *:discovery:*:*:1.0 - (optional) IDiscovery services
- *:credential-store:*:*:1.0 (optional) credential stores to resolve credentials
Fields
Constructors
Creates a new instance of the connection component.
public
constructor()
Instance methods
close
Closes the component and frees used resources.
public
close(correlationId: string): Promise<void>
- correlationId: string - (optional) transaction id used to trace execution through the call chain.
configure
Configures the component by passing its configuration parameters.
public
configure(config: ConfigParams): void
- config: ConfigParams - configuration parameters to be set.
getConnection
Gets the connection.
public
getConnection(): any
- returns: any - connection to a SQLite database
getDatabaseName
Gets the database name.
public
getDatabaseName(): string
- returns: string - database name
isOpen
Checks if the component is open.
public
isOpen(): boolean
- returns: boolean - true if the component is open and false otherwise.
open
Opens the component.
public
open(correlationId: string): Promise<void>
- correlationId: string - (optional) transaction id used to trace execution through the call chain.
setReferences
Sets references to dependent components.
public
setReferences(references: IReferences): void
- references: IReferences - references to locate the component’s dependencies.