sqlx

package
v0.0.0-...-58dc058 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Dialect  string
	Server   string
	Port     int
	User     string
	Database string
	Password string
}

Config 数据库配置

type Conn

type Conn struct {
	*sqlx.DB
}

Conn 链接对象

var Connection Conn

Connection db connection

func Build

func Build(config Config) Conn

Build 数据库连接

func (Conn) Get

func (db Conn) Get(dest interface{}, query string, args ...interface{}) error

Get 重载 get 方法 记录日志

func (Conn) QueryRowx

func (db Conn) QueryRowx(query string, args ...interface{}) *sqlx.Row

QueryRowx 重载 QueryRowx

func (Conn) Queryx

func (db Conn) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)

Queryx 重载 Queryx

func (Conn) Select

func (db Conn) Select(dest interface{}, query string, args ...interface{}) error

Select 重载 select

type PreparedDialect

type PreparedDialect struct {
	// contains filtered or unexported fields
}

PreparedDialect 包装DialectWrappper 这样在调用ToSQL() 方法的时候,返回的args 需要保留下来,作为参数使用

func PostgresBuilder

func PostgresBuilder() PreparedDialect

PostgresBuilder postgres builder

func (PreparedDialect) Delete

func (pd PreparedDialect) Delete(table interface{}) *goqu.DeleteDataset

Delete 包装原始Delete方法,增加Prepared(true)

func (PreparedDialect) From

func (pd PreparedDialect) From(table ...interface{}) *goqu.SelectDataset

From 转发给原始Dialect,包装Prepared(true)

func (PreparedDialect) Insert

func (pd PreparedDialect) Insert(table interface{}) *goqu.InsertDataset

Insert 包装原始Insert方法,增加Prepared(true)

func (PreparedDialect) RawDialect

func (pd PreparedDialect) RawDialect() goqu.DialectWrapper

RawDialect 原始的Dialect

func (PreparedDialect) Select

func (pd PreparedDialect) Select(cols ...interface{}) *goqu.SelectDataset

Select 封装原始Select方法,包装Prepared(true)

func (PreparedDialect) Update

func (pd PreparedDialect) Update(table interface{}) *goqu.UpdateDataset

Update 包装原始Update方法,增加Prepared(true)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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