Documentation ¶
Index ¶
- type SqliteConnection
- func (c *SqliteConnection) Close(correlationId string) error
- func (c *SqliteConnection) Configure(config *cconf.ConfigParams)
- func (c *SqliteConnection) GetConnection() *sql.DB
- func (c *SqliteConnection) GetDatabaseName() string
- func (c *SqliteConnection) IsOpen() bool
- func (c *SqliteConnection) Open(correlationId string) error
- func (c *SqliteConnection) SetReferences(references cref.IReferences)
- type SqliteConnectionResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SqliteConnection ¶ added in v1.2.0
type SqliteConnection struct { // The logger. Logger *clog.CompositeLogger // The connection resolver. ConnectionResolver *SqliteConnectionResolver // The configuration options. Options *cconf.ConfigParams // The SQLite connection pool object. Connection *sql.DB // The SQLite database name. DatabaseName string // contains filtered or unexported fields }
*
- SQLite connection using plain driver. *
- By defining a connection and sharing it through multiple persistence components
- you can reduce number of used database connections. *
- ### Configuration parameters ### *
- - connection(s):
- - discovery_key: (optional) a key to retrieve the connection from [[IDiscovery]]
- - database: path to database file
- - uri: resource URI or connection string with all parameters in it
- ### 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 *
func NewSqliteConnection ¶ added in v1.2.0
func NewSqliteConnection() *SqliteConnection
NewSqliteConnection creates a new instance of the connection component.
func (*SqliteConnection) Close ¶ added in v1.2.0
func (c *SqliteConnection) Close(correlationId string) error
Closes component and frees used resources.
- correlationId (optional) transaction id to trace execution through call chain.
Return error or nil no errors occured
func (*SqliteConnection) Configure ¶ added in v1.2.0
func (c *SqliteConnection) Configure(config *cconf.ConfigParams)
Configures component by passing configuration parameters.
- config configuration parameters to be set.
func (*SqliteConnection) GetConnection ¶ added in v1.2.0
func (c *SqliteConnection) GetConnection() *sql.DB
func (*SqliteConnection) GetDatabaseName ¶ added in v1.2.0
func (c *SqliteConnection) GetDatabaseName() string
func (*SqliteConnection) IsOpen ¶ added in v1.2.0
func (c *SqliteConnection) IsOpen() bool
Checks if the component is opened. Returns true if the component has been opened and false otherwise.
func (*SqliteConnection) Open ¶ added in v1.2.0
func (c *SqliteConnection) Open(correlationId string) error
Opens the component.
- correlationId (optional) transaction id to trace execution through call chain.
- Return error or nil no errors occured.
func (*SqliteConnection) SetReferences ¶ added in v1.2.0
func (c *SqliteConnection) SetReferences(references cref.IReferences)
Sets references to dependent components.
- references references to locate the component dependencies.
type SqliteConnectionResolver ¶
type SqliteConnectionResolver struct { //The connections resolver. ConnectionResolver ccon.ConnectionResolver //The credentials resolver. CredentialResolver cauth.CredentialResolver }
SqliteConnectionResolver a helper struct that resolves Sqlite connection and credential parameters, validates them and generates a connection URI. It is able to process multiple connections to Sqlite cluster nodes.
Configuration parameters ¶
- connection(s):
- discovery_key: (optional) a key to retrieve the connection from IDiscovery
- host: host name or IP address
- port: port number (default: 27017)
- database: database name
- uri: resource URI or connection string with all parameters in it
- credential(s):
store_key: (optional) a key to retrieve the credentials from ICredentialStore
username: user name
password: user password
References
- *:discovery:*:*:1.0 (optional) IDiscovery services - *:credential-store:*:*:1.0 (optional) Credential stores to resolve credentials
func NewSqliteConnectionResolver ¶
func NewSqliteConnectionResolver() *SqliteConnectionResolver
NewSqliteConnectionResolver creates new connection resolver Retruns *SqliteConnectionResolver
func (*SqliteConnectionResolver) Configure ¶
func (c *SqliteConnectionResolver) Configure(config *cconf.ConfigParams)
Configure is configures component by passing configuration parameters. Parameters:
- config *cconf.ConfigParams configuration parameters to be set.
func (*SqliteConnectionResolver) Resolve ¶
func (c *SqliteConnectionResolver) Resolve(correlationId string) (config map[string]interface{}, err error)
Resolves SQLite connection URI from connection and credential parameters. - correlationId (optional) transaction id to trace execution through call chain.
Return resolved config or error.
func (*SqliteConnectionResolver) SetReferences ¶
func (c *SqliteConnectionResolver) SetReferences(references crefer.IReferences)
SetReferences is sets references to dependent components. Parameters:
- references crefer.IReferences references to locate the component dependencies.