Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Connect variable Connect = sqlx.Connect )
View Source
var NewSession = func(opt config.Postgres) (ISession, error) { fmt.Println(opt) if opt.PostgresURL != "" { return Connect("pgx", opt.PostgresURL, ) } return Connect("pgx", fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s", opt.PostgresUsername, opt.PostgresPassword, opt.PostgresHost, opt.PostgresPort, opt.PostgresDatabase, opt.PostgresSSLMode), ) }
NewSession method
Functions ¶
This section is empty.
Types ¶
type ISession ¶
type ISession interface {
DriverName() string
MapperFunc(mf func(string) string)
Rebind(query string) string
Unsafe() *sqlx.DB
BindNamed(query string, arg interface{}) (string, []interface{}, error)
NamedQuery(query string, arg interface{}) (*sqlx.Rows, error)
NamedExec(query string, arg interface{}) (sql.Result, error)
Select(dest interface{}, query string, args ...interface{}) error
Get(dest interface{}, query string, args ...interface{}) error
MustBegin() *sqlx.Tx
Beginx() (*sqlx.Tx, error)
Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
QueryRowx(query string, args ...interface{}) *sqlx.Row
MustExec(query string, args ...interface{}) sql.Result
Preparex(query string) (*sqlx.Stmt, error)
PrepareNamed(query string) (*sqlx.NamedStmt, error)
PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error)
NamedQueryContext(ctx context.Context, query string, arg interface{}) (*sqlx.Rows, error)
NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)
SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
PreparexContext(ctx context.Context, query string) (*sqlx.Stmt, error)
QueryxContext(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error)
QueryRowxContext(ctx context.Context, query string, args ...interface{}) *sqlx.Row
MustBeginTx(ctx context.Context, opts *sql.TxOptions) *sqlx.Tx
MustExecContext(ctx context.Context, query string, args ...interface{}) sql.Result
BeginTxx(ctx context.Context, opts *sql.TxOptions) (*sqlx.Tx, error)
PingContext(ctx context.Context) error
Ping() error
Close() error
SetMaxIdleConns(n int)
SetMaxOpenConns(n int)
SetConnMaxLifetime(d time.Duration)
Stats() sql.DBStats
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
Prepare(query string) (*sql.Stmt, error)
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
Exec(query string, args ...interface{}) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
QueryRow(query string, args ...interface{}) *sql.Row
BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
Begin() (*sql.Tx, error)
Driver() driver.Driver
Conn(ctx context.Context) (*sql.Conn, error)
}
ISession interface
Click to show internal directories.
Click to hide internal directories.