goutil

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 0 Imported by: 0

README

go-util

介绍

golang 开发工具库

本开源方案已上pkg.go.dev 可通过go mod 自动引入

"gitee.com/miajio/go-util"

lib.db库

封装基础的sql语句自动生成工具

sql语句内核目前版本主要可用的数据库为主流的sql形数据库

例如: oracle mysql mariadb mssql等

生成的sql语句均以预编译方式处理,外置执行sql方案建议使用sqlx(github.com/jmoiron/sqlx)

自动生成Insert SQL语句
import "gitee.com/miajio/go-util/lib/db"

auto := db.AutoSQL.Create("id", "db", db.None, DBModel{})

sql, params , err := auto.Insert("table_name", DBModel{
    param key value...
})

自动生成依据主键查询的Select SQL语句
import "gitee.com/miajio/go-util/lib/db"

auto := db.AutoSQL.Create("id", "db", db.None, DBModel{})

sql, params, err := auto.SelectByPrimaryKey("table_name", DBModel{
    primary key value ...
})
自动生成依据主键删除的Delete SQL语句
import "gitee.com/miajio/go-util/lib/db"

auto := db.AutoSQL.Create("id", "db", db.None, DBModel{})

sql, params, err := auto.DeleteByPrimaryKey("table_name", DBModel{
    primary key value ...
})
自动生成依据主键修改的Update SQL语句
import "gitee.com/miajio/go-util/lib/db"

auto := db.AutoSQL.Create("id", "db", db.None, DBModel{})

sql, params, err := auto.UpdateByPrimaryKey("table_name", DBModel{
    param key value...
})
lib.db库基础示例测试代码均使用*_*_test.go方式写在代码之中
lib.read库

read库主要作用于读取结构体标签及判定结构体数据状态的处理库

后续可能会依据此库增加其他数据的读取方案

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
lib
db
log

Jump to

Keyboard shortcuts

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