CoreMsSQL

package
v5.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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

func (t *Client) Exec(query string, args ...any) (sql.Result, error)

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

func (t *Client) Get(dest interface{}, query string, args ...interface{}) error

Get using this DB. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.

func (*Client) Init

func (t *Client) Init(dataSource, database, user, password string, port int) (err error)

func (*Client) MustBegin

func (t *Client) MustBegin() *sqlx.Tx

MustBegin starts a transaction, and panics on error. Returns an *sqlx.Tx instead of an *sql.Tx.

func (*Client) NamedExec

func (t *Client) NamedExec(query string, arg interface{}) (sql.Result, error)

NamedExec using this DB. Any named placeholder parameters are replaced with fields from arg.

func (*Client) Ping

func (t *Client) Ping() error

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

func (t *Client) PrepareNamed(query string) (*sqlx.NamedStmt, error)

PrepareNamed returns an sqlx.NamedStmt

func (*Client) Select

func (t *Client) Select(dest interface{}, query string, args ...interface{}) error

Select using this DB. Any placeholder parameters are replaced with supplied args.

Jump to

Keyboard shortcuts

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