datasource

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatasourceID

func GetDatasourceID(ctx context.Context) int64

func GetDatasourceLastUpdatedTime added in v0.17.0

func GetDatasourceLastUpdatedTime(ctx context.Context) string

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) GetAsyncDB added in v0.11.1

func (s *AWSDatasource) GetAsyncDB(
	id int64,
	options sqlds.Options,
	settingsLoader models.Loader,
	apiLoader api.Loader,
	driverLoader asyncDriver.Loader,
) (awsds.AsyncDB, error)

GetAsyncDB returns a sqlds.AsyncDB. It will use the loader functions to initialize the required settings, API and driver and finally create a DB.

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

Init stores the data source configuration. It's needed for the GetDB and GetAPI functions

Jump to

Keyboard shortcuts

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