mirror of https://github.com/VinGarcia/ksql.git
Add more configurable constructors for all adapters
parent
b44c7e8500
commit
3eb5a72123
|
@ -11,6 +11,11 @@ import (
|
|||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
|
||||
// NewFromSQLDB builds a ksql.DB from a *sql.DB instance
|
||||
func NewFromSQLDB(db *sql.DB) (ksql.DB, error) {
|
||||
return ksql.NewWithAdapter(NewSQLAdapter(db), "mysql")
|
||||
}
|
||||
|
||||
// New instantiates a new KissSQL client using the "mysql" driver
|
||||
func New(
|
||||
_ context.Context,
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
_ "github.com/lib/pq"
|
||||
)
|
||||
|
||||
// NewFromPgxPool builds a ksql.DB from a *pgxpool.Pool instance.
|
||||
// NewFromPgxPool builds a ksql.DB from a *pgxpool.Pool instance
|
||||
func NewFromPgxPool(pool *pgxpool.Pool) (db ksql.DB, err error) {
|
||||
return ksql.NewWithAdapter(NewPGXAdapter(pool), "postgres")
|
||||
}
|
||||
|
|
|
@ -11,6 +11,11 @@ import (
|
|||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
// NewFromSQLDB builds a ksql.DB from a *sql.DB instance
|
||||
func NewFromSQLDB(db *sql.DB) (ksql.DB, error) {
|
||||
return ksql.NewWithAdapter(NewSQLAdapter(db), "sqlite3")
|
||||
}
|
||||
|
||||
// New instantiates a new KissSQL client using the "sqlite3" driver
|
||||
func New(
|
||||
_ context.Context,
|
||||
|
|
|
@ -11,6 +11,11 @@ import (
|
|||
_ "github.com/denisenkom/go-mssqldb"
|
||||
)
|
||||
|
||||
// NewFromSQLDB builds a ksql.DB from a *sql.DB instance
|
||||
func NewFromSQLDB(db *sql.DB) (ksql.DB, error) {
|
||||
return ksql.NewWithAdapter(NewSQLAdapter(db), "sqlserver")
|
||||
}
|
||||
|
||||
// New instantiates a new KissSQL client using the "sqlserver" driver
|
||||
func New(
|
||||
_ context.Context,
|
||||
|
|
Loading…
Reference in New Issue