Documentation
¶
Index ¶
- type CrudSql
- type Postgres
- func (p *Postgres) Execute(sql string, args ...interface{}) int64
- func (p *Postgres) Find(sql string, args ...interface{}) pgx.Row
- func (p *Postgres) FindMany(sql string, args ...interface{}) (rows pgx.Rows, err error)
- func (p *Postgres) SetDebug(debug bool)
- func (p *Postgres) SetLogPath(logPath string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CrudSql ¶ added in v1.0.2
type CrudSql interface {
Add(sql string, args ...interface{}) int64 // 添加数据
Delete(table string, id int) bool // 根据ID删除数据
DeleteIds(table string, ids ...int) bool // 根据ID列表删除数据
Update(sql string, args ...interface{}) bool // 根据ID修改数据
Find(table string, columns []string, id int) *sql.Row // 根据ID查询数据
FindIds(table string, columns []string, ids []int) *sql.Rows // 根据ID列表查询数据
FindPages(table string, columns []string, page, size int) *sql.Rows // 根据分页查询数据
}
增删改查的SQL接口
type Postgres ¶ added in v1.0.2
type Postgres struct {
// contains filtered or unexported fields
}
PostgreSQL结构体
func New ¶ added in v1.0.2
New 创建新的Postgres对象 @param host 主机地址 @param port 端口号 @param user 用户名 @param password 密码 @param database 数据库名称 @param logPath 日志存放路径 @param debug 是否为debug模式
func (*Postgres) SetLogPath ¶ added in v1.0.2
设置日志文件路径
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
z01_create_table
command
|
|
|
z02_create_user
command
|
|
|
z03_delete_user
command
|
|
|
z04_update_user
command
|
|
|
z05_find_user
command
|
|
|
z05_find_user_many
command
|
Click to show internal directories.
Click to hide internal directories.