Documentation
¶
Index ¶
- Constants
- func GetQueryFromFile(filename string) (string, error)
- type OptionFunc
- func WithConnectionString(connectionString string) OptionFunc
- func WithContext(ctx context.Context) OptionFunc
- func WithDriver(driver string) OptionFunc
- func WithHost(host string) OptionFunc
- func WithMemoryDB() OptionFunc
- func WithName(name string) OptionFunc
- func WithPassword(password string) OptionFunc
- func WithPoolSize(poolSize int) OptionFunc
- func WithPort(port int) OptionFunc
- func WithSQLTablesPrefix(sqlTablesPrefix string) OptionFunc
- func WithSqliteDB(name, path string) OptionFunc
- func WithUsername(username string) OptionFunc
- type Options
- type Provider
- type Status
Constants ¶
View Source
const ( // OracleDatabaseProviderName defines the name for Oracle database Provider OracleDatabaseProviderName = provider.OracleDatabaseProviderName // SQLiteDataProviderName defines the name for SQLite database Provider SQLiteDataProviderName = provider.SQLiteDataProviderName // MySQLDatabaseProviderName defines the name for MySQL database Provider MySQLDatabaseProviderName = provider.MySQLDatabaseProviderName // PostgresSQLDatabaseProviderName defines the name for PostgresSQL database Provider PostgresSQLDatabaseProviderName = provider.PostgresSQLDatabaseProviderName // MemoryDataProviderName defines the name for memory provider using SQLite in-memory database Provider MemoryDataProviderName = provider.MemoryDataProviderName )
Variables ¶
This section is empty.
Functions ¶
func GetQueryFromFile ¶
Types ¶
type OptionFunc ¶
type OptionFunc func(*Options)
func WithConnectionString ¶
func WithConnectionString(connectionString string) OptionFunc
WithConnectionString sets db connection string
func WithPoolSize ¶
func WithPoolSize(poolSize int) OptionFunc
func WithSQLTablesPrefix ¶
func WithSQLTablesPrefix(sqlTablesPrefix string) OptionFunc
WithSQLTablesPrefix sets db sql tables prefix
func WithSqliteDB ¶ added in v0.1.4
func WithSqliteDB(name, path string) OptionFunc
WithSqliteDB sets sqlite db path name
type Options ¶ added in v0.1.3
func NewOptions ¶
func NewOptions(optsFn ...OptionFunc) *Options
NewOptions creates a new options instance
type Provider ¶
type Provider interface { // Disconnect disconnects from the data provider Disconnect() error // GetConnection returns the connection to the data provider GetConnection() *sqlx.DB // CheckAvailability checks if the data provider is available CheckAvailability() error // ReconnectDatabase reconnects to the database ReconnectDatabase() error // InitializeDatabase initializes the database InitializeDatabase(schema string) error // MigrateDatabase migrates the database to the latest version MigrateDatabase() migration.Migration // RevertDatabase reverts the database to the specified version RevertDatabase(targetVersion int) error // ResetDatabase resets the database ResetDatabase() error // GetProviderStatus returns the status of the provider GetProviderStatus() Status SqlBuilder() *provider.SQLBuilder }
func Must ¶
Must panics if the error is not nil
Otherwise, it returns the provider instance with the corresponding implementation
func NewDataProvider ¶
NewDataProvider creates a new data provider instance
Click to show internal directories.
Click to hide internal directories.