db

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

db

介绍

db

软件架构

软件架构说明

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
码云特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. 码云官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解码云上的优秀开源项目
  4. GVP 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
  5. 码云官方提供的使用手册 https://gitee.com/help
  6. 码云封面人物是一档用来展示码云会员风采的栏目 https://gitee.com/gitee-stars/

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sqlx.DB

DB 数据库连接

Functions

func Exec

func Exec(pattern string, arg interface{}) (result sql.Result, err error)

Exec 执行一次数据操作

func Query

func Query(pattern string, arg interface{}) (rows *sqlx.Rows, err error)

Query 执行一次多行查询

func QueryRow

func QueryRow(pattern string, arg interface{}) (row *sqlx.Row, err error)

QueryRow 执行一次单行查询

Types

type DSN

type DSN struct {
	Username string
	Password string
	Host     string
	Port     int
	Database string
}

DSN Data Source Name

func (*DSN) Conn

func (d *DSN) Conn() (err error)

Conn 连接数据库

type Tx

type Tx struct {
	*sqlx.Tx
}

Tx sqlt事务对象

func Begin

func Begin() (tx Tx, err error)

Begin 开始事务

func (Tx) Commit

func (tx Tx) Commit() (err error)

Commit 提交事务

func (Tx) Exec

func (tx Tx) Exec(pattern string, arg interface{}) (result sql.Result, err error)

Exec 在事务中执行一次数据操作

func (Tx) Query

func (tx Tx) Query(pattern string, arg interface{}) (rows *sqlx.Rows, err error)

Query 在事务中执行一次多行查询

func (Tx) QueryRow

func (tx Tx) QueryRow(pattern string, arg interface{}) (row *sqlx.Row, err error)

QueryRow 在事务中执行一次单行查询

func (Tx) Rollback

func (tx Tx) Rollback() (err error)

Rollback 回滚事务

Jump to

Keyboard shortcuts

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