Documentation ¶
Index ¶
- func GetDatasourceID(ctx context.Context) int64
- type AWSDatasource
- func (s *AWSDatasource) GetAPI(id int64, options sqlds.Options, settingsLoader models.Loader, ...) (api.AWSAPI, error)
- func (s *AWSDatasource) GetDB(id int64, options sqlds.Options, settingsLoader models.Loader, ...) (*sql.DB, error)
- func (s *AWSDatasource) Init(config backend.DataSourceInstanceSettings)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDatasourceID ¶
Types ¶
type AWSDatasource ¶
type AWSDatasource struct {
// contains filtered or unexported fields
}
AWSDatasource stores a cache of several instances. Each Map will depend on the datasource ID (and connection options):
- config: Base configuration. It will be used as base to populate datasource settings. It does not depend on connection options (only one per datasource)
- api: API instace with the common methods to contact the data source API.
- driver: Abstraction on top the upstream sql.Driver. Defined to handle multiple connections.
- db: Upstream database (sql.DB).
- sessionCache: AWS cache. This is not a Map since it does not depend on the datasource.
func New ¶
func New() *AWSDatasource
func (*AWSDatasource) GetAPI ¶
func (s *AWSDatasource) GetAPI( id int64, options sqlds.Options, settingsLoader models.Loader, apiLoader api.Loader, ) (api.AWSAPI, error)
GetAPI returns an API interface. When called multiple times with the same id and options, it will return a cached version of the API. The first time, it will use the loader functions to initialize the required settings and API.
func (*AWSDatasource) GetDB ¶
func (s *AWSDatasource) GetDB( id int64, options sqlds.Options, settingsLoader models.Loader, apiLoader api.Loader, driverLoader driver.Loader, ) (*sql.DB, error)
GetDB returns a *sql.DB. It will use the loader functions to initialize the required settings, API and driver and finally create a DB.
func (*AWSDatasource) Init ¶
func (s *AWSDatasource) Init(config backend.DataSourceInstanceSettings)
Init stores the data source configuration. It's needed for the GetDB and GetAPI functions
Click to show internal directories.
Click to hide internal directories.