gsx

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

gsx

介绍
安装

go get -u gitee.com/white-ravens/gsx

示例

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDelete

func NewDelete(db *sqlx.DB, table string, key, value string) (sql.Result, error)

Types

type Insert

type Insert struct {
	DB       *sqlx.DB
	Sentence string
	// contains filtered or unexported fields
}

Insert 插入实例类型

func NewInsert

func NewInsert(db *sqlx.DB, table string) *Insert

NewInsert 创建Insert实例 db: *sqlx.DB, table: 表名

func (*Insert) Add

func (i *Insert) Add(key string, value any) *Insert

Add 增加键值 key: 表中的字段名称, value: 条件值

func (*Insert) Do

func (i *Insert) Do() (sql.Result, error)

Do 执行sql语句

type SQLInfo

type SQLInfo struct {
	Address  string
	DbName   string
	UserName string
	Password string
}

func (*SQLInfo) Connect

func (s *SQLInfo) Connect() (DB *sqlx.DB, err error)

type Select

type Select struct {
	DB       *sqlx.DB
	Sentence string
	// contains filtered or unexported fields
}

Select 查询实例类型

func NewSelect

func NewSelect(db *sqlx.DB, table string) *Select

NewSelect 创建Select实例 db: *sqlx.DB, table: 表名

func (*Select) And

func (s *Select) And(key string, value any) *Select

And and条件 key: 表中的字段名称, value: 条件值

func (*Select) Do

func (s *Select) Do(dest any) error

Do 执行sql语句, dst应为指针

func (*Select) Or

func (s *Select) Or(key string, value any) *Select

Or or条件 key: 表中的字段名称, value: 条件值

type Update

type Update struct {
	DB       *sqlx.DB
	Sentence string
	// contains filtered or unexported fields
}

Update 更新实例类型

func NewUpdate

func NewUpdate(db *sqlx.DB, table string) *Update

NewUpdate 创建Update实例 db: *sqlx.DB, table: 表名

func (*Update) Do

func (u *Update) Do(key string, value any) (sql.Result, error)

Do 执行sql语句

func (*Update) Set

func (u *Update) Set(key string, value any) *Update

Set 更新 key: 表中的字段名称, vlaue: 将要更新的值

Jump to

Keyboard shortcuts

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