mysqlgorm

package module
v0.0.0-...-9850c2a Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(entity interface{}) (int64, error)

添加记录,返回影响行数及错误信息

func Count

func Count(sql string, params ...interface{}) (int, error)

调用数据查询数量

func FindOneMap

func FindOneMap(text string, params ...interface{}) (map[string]interface{}, int, error)

调用数据查询一条记录 返回规则: 发生错误时: {数据为nil,错误码值,错误信息} 正确时: {数据,数据数量,nil}

func FindToMap

func FindToMap(text string, params ...interface{}) ([]map[string]interface{}, int, error)

调用数据查询 返回规则: 发生错误时: {数据为nil,错误码值,错误信息} 正确时: {数据,数据数量,nil}

func GetDbName

func GetDbName(name string) string

取数据库名称

func GetVariable

func GetVariable(name string) string

取数据库全局变量

func InitDB

func InitDB()

初始化数据库加载配置

func Query

func Query(sql string, dest interface{}, where ...interface{}) (interface{}, error)

调用数据查询

func RawRows

func RawRows(sql string, params ...interface{}) (*sql.Rows, error)

调用数据查询

func ReplaceVariable

func ReplaceVariable(sqlstr string) string

替换字符串中的所有全局变量

func ScanRows2mapI

func ScanRows2mapI(rows *sql.Rows) []map[string]interface{}

将查询结果转换成map数组,常用于原生sql查询

Types

type AesUtil

type AesUtil struct{}

func (AesUtil) AesDecrypt

func (au AesUtil) AesDecrypt(data []byte, key string) ([]byte, error)

AesDecrypt 解密

func (AesUtil) AesEncrypt

func (au AesUtil) AesEncrypt(data []byte, key string) ([]byte, error)

AesEncrypt 加密

func (AesUtil) Decrypt

func (au AesUtil) Decrypt(data string, key string) string

DecryptByAes Aes 解密16进制

func (AesUtil) DecryptBase64

func (au AesUtil) DecryptBase64(data string, key string) string

DecryptByAes Aes 解密

func (AesUtil) Encrypt

func (au AesUtil) Encrypt(data string, key string) string

EncryptByAes Aes加密 后 返回16进制

func (AesUtil) EncryptBase64

func (au AesUtil) EncryptBase64(data string, key string) string

EncryptByAes Aes加密 后 base64 再加转字符串

type GormDB

type GormDB = *gg.DB

func Exec

func Exec(sql string, params ...interface{}) (tx GormDB)

调用数据更新

func Find

func Find(sql string, params ...interface{}) (tx GormDB)

调用数据查询

func GetDB

func GetDB() GormDB

取gorm操作对象

func Raw

func Raw(sql string, params ...interface{}) (tx GormDB)

调用数据查询

Jump to

Keyboard shortcuts

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