Documentation ¶
Index ¶
- type Client
- func (t *Client) Exec(query string, args ...any) (sql.Result, error)
- func (t *Client) Get(dest interface{}, query string, args ...interface{}) error
- func (t *Client) Init(dataSource, database, user, password string, port int) (err error)
- func (t *Client) MustBegin() *sqlx.Tx
- func (t *Client) NamedExec(query string, arg interface{}) (sql.Result, error)
- func (t *Client) Ping() error
- func (t *Client) PrepareNamed(query string) (*sqlx.NamedStmt, error)
- func (t *Client) Select(dest interface{}, query string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { //DB 数据库对象 DB *sqlx.DB //OpenEncrypt &encrypt=disable,官方握手BUG个别sqlserver下会造成TLS链接失败,启动后可规避该问题 OpenEncrypt bool }
func (*Client) Exec ¶
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.
Exec uses context.Background internally; to specify the context, use ExecContext.
func (*Client) Get ¶
Get using this DB. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.
func (*Client) MustBegin ¶
MustBegin starts a transaction, and panics on error. Returns an *sqlx.Tx instead of an *sql.Tx.
func (*Client) NamedExec ¶
NamedExec using this DB. Any named placeholder parameters are replaced with fields from arg.
func (*Client) Ping ¶
Ping verifies a connection to the database is still alive, establishing a connection if necessary.
Ping uses context.Background internally; to specify the context, use PingContext.
func (*Client) PrepareNamed ¶
PrepareNamed returns an sqlx.NamedStmt