gom

package module
v3.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 16 Imported by: 1

README

gom

gom - An Easy ORM library for Golang

golang Go Report Card GitHub GoDoc

基本介绍&特性

gom是一个基于golang语言的关系型数据库ORM框架(CRUD工具库,支持事务)

目前最新版本为v3.0.0,于2024年1月6日发布。详见下方的迭代注记

*当前支持的数据库类型为 mysql及其衍生品 mariadbPostgres

数据库类型支持自定义扩展(参考factory/mysql/mysql.go)

gom是goroutine安全的(自认为的安全)

快速入门

使用go mod的情况下:


require github.com/kmlixh/gom/v2 v3.0.0

或者

go get github.com/kmlixh/gom/v3@v3.0.0
一个简单的CRUD示例
package main

import (
	"github.com/google/uuid"
	"github.com/kmlixh/gom/v2"
	_ "github.com/kmlixh/gom/v2/factory/mysql"
	"time"
)

var dsn = "remote:remote123@tcp(10.0.1.5)/test?charset=utf8&loc=Asia%2FShanghai&parseTime=true"

type User struct {
	Id       int64     `json:"id" gom:"id"`
	Pwd      string    `json:"pwd" gom:"pwd"`
	Email    string    `json:"email" gom:"email"`
	Valid    int       `json:"valid" gom:"-"`
	NickName string    `json:"nicks" gom:"nick_name"`
	RegDate  time.Time `json:"reg_date" gom:"reg_date"`
}

var db *gom.DB

func init() {
	//Create DB ,Global
	var er error
	db, er = gom.Open("mysql", dsn, true)
	if er != nil {
		panic(er)
	}
}

func main() {
	var users []User
	//Query
	db.Where(gom.Cnd("name", gom.Eq, "kmlixh")).Page(0, 100).Select(&users)
	//Update
	temp := users[0]
	temp.NickName = uuid.New().String()
	temp.RegDate = time.Now()
	db.Update(temp)
	//Delete
	db.Delete(users[1])
	tt := User{
		Pwd:      "123213",
		Email:    "1@test.com",
		Valid:    1,
		NickName: uuid.New().String(),
		RegDate:  time.Now(),
	}
	db.Insert(tt)

}


用于接收实体的对象,可以增加gom标记(TAG)来实现数据库字段到实体字段的特殊映射。正常情况下,其实什么都不需要做。
type User struct {
Id       int64     `json:"id" gom:"id"`
Pwd      string    `json:"pwd" gom:"pwd"`
Email    string    `json:"email" gom:"email"`
Valid    int       `json:"valid" gom:"-"`
NickName string    `json:"nicks" gom:"nick_name"`
RegDate  time.Time `json:"reg_date" gom:"reg_date"`
}


短划线“-”标记此字段在数据库中不映射。除非特别使用gom标记指定了数据库映射关系,gom会自动将数据库字段按照驼峰转蛇形的方式转换,例如:CamelName会被转换为camel_name.而正常情况下,这些操作都是不必要的,甚至你什么都不用做
DB结构体具有的方法(函数)如下:
RawDb() 获取原生的sql.Db对象
Table(tableName string) 设置表名
Raw() *sql.Db 获取go底层的db对象
OrderBy()排序
CleanOrders清除排序
OrderByAsc
OrderByDesc
Where2
Where
Clone
Page
Count
Sum
Select
SelectByModel
First
Insert
Delete
Update
ExecuteRaw
ExecuteStatement
Begin
IsInTransaction
Commit
Rollback
DoTransaction
CleanDb

迭代注记

2024年1月6日 v3.0版本发布
1.增加了对Postgres数据库的兼容。
底层使用的是github.com/jackc/pgx/v5,所以配置数据的dsn和此库一致
例如标准的jdbc连接串:postgres://username:password@localhost:5432/database_name
或者是DSN:"user=postgres password=secret host=localhost port=5432 database=pgx_test sslmode=disable"
2.重构了底层逻辑,简化了业务流程。
去除了大量无关的代码逻辑。简化了对tag的使用。
2023年12月30日 修复查询迭代是sql必须存在于一行的bug
例如 使用db.Where()...之后,如果换行调用db.Select之类的CRUD语句,前面的状态会丢失。主要 是由于没有遵守Golang的参数传递的原则导致的。
2022年9月3日 修复In只有一个参数是sql异常的mysql报错;版本更新为v2.1.1
2022年9月2日 修复MapToCondition 没有处理简单类型数组的bug;版本更新为2.1.0
2022年9月1日 修复某些情况下,In条件解析数组参数异常的bug;版本更新为2.10
2022年7月21日 修复复杂条件解析逻辑混乱的bug;版本更新为2.0.9(你猜的没错,2.0.8也是修复这个bug,没修好)
2022年7月20日 修复Count和Sum时条件无效的bug,版本更新为v2.0.7(中间两个版本改了什么忘记了,懒得去🍵git)
2022年4月17日 修复bug,更新版本为v2.0.4
修复查询条件关系错误的bug;
修复查询条件初始化为空时附加属性不合理的bug;
新增CndEmpty()方法,用于创建空的Condition对象,此方法与CndRaw("")等价
2022年4月15日 01:56:50 v2.0.0发布
v2.0
代码几乎全部重构,你大概可以认为这是一个全新的东西,API全变了(不过也没事,之前的版本也就我一个人在用^_^自嗨锅)
代码测试覆盖率93.0%(相关的测试覆盖率结果可以看test_cover.html以及cover.out)
2019年6月19日 17:44:18
v1.1.2
修复CreateSingleTable的一些bug
2019年6月15日 08:18:25
v1.1.1
修复一些bug;
增加NotIn模式
2019年5月15日 09:18:06
v1.0.8
截止1.0.8又修复了若干bug,详细请看commit
2019年4月30日 11:15:38
1.修复了大量的bug;(具体可以看提交记录)
2.改造了数据获取的方式,从原来的固定格式转换,变成了接近于数据库底层的Scanner模式的性能
3.优化了自定义类型的查询和存储
2017年6月22日 12:54:36
1.修复若干bug(具体修复哪些bug记不清了 ^_^)
2.修复Update,Insert,Delete方法传入不定参数时的bug(无法解析,或者解析不正确,使用递归解决)
3.修复Condition为空的情况下会莫名注入一个“where”进入sql语句的bug 
4.Db对象增加了一个Count函数,故名思议,用来做count的
2017年6月18日22:47:53
1.修复无法使用事务的bug
2.修改了数据库操作的一些基础逻辑,每次操作前都会进行Prepare操作,以提高一些“性能”
3.为了修复上面的bug,修改了整体的gom.Db结构

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug bool

Functions

func ArrayIntersect

func ArrayIntersect(slice1, slice2 []string) []string

func ArrayIntersect2

func ArrayIntersect2(slice1, slice2 []string) ([]string, []string, []string)

func ArrayOf

func ArrayOf(i ...interface{}) []interface{}

func ByteArrayScan

func ByteArrayScan(src interface{}) (interface{}, error)

func CamelToSnakeString

func CamelToSnakeString(s string) string

func Cnd

func Cnd(field string, operation define.Operation, values ...interface{}) define.Condition

func CndEmpty

func CndEmpty() define.Condition

func CndEq

func CndEq(field string, value interface{}) define.Condition

func CndFull

func CndFull(linker define.Linker, field string, operation define.Operation, rawExpression string, values ...interface{}) define.Condition

func CndGe

func CndGe(field string, value interface{}) define.Condition

func CndGt

func CndGt(field string, value interface{}) define.Condition

func CndIn

func CndIn(field string, values ...interface{}) define.Condition

func CndIsNotNull

func CndIsNotNull(field string) define.Condition

func CndIsNull

func CndIsNull(field string) define.Condition

func CndLe

func CndLe(field string, value interface{}) define.Condition

func CndLike

func CndLike(field string, value interface{}) define.Condition

func CndLikeIgnoreEnd

func CndLikeIgnoreEnd(field string, value interface{}) define.Condition

func CndLikeIgnoreStart

func CndLikeIgnoreStart(field string, value interface{}) define.Condition

func CndLt

func CndLt(field string, value interface{}) define.Condition

func CndNotEq

func CndNotEq(field string, value interface{}) define.Condition

func CndNotIn

func CndNotIn(field string, values ...interface{}) define.Condition

func CndRaw

func CndRaw(rawExpresssion string, values ...interface{}) define.Condition

func Float32Scan

func Float32Scan(src interface{}) (interface{}, error)

func GenDefaultStructFromDatabase added in v3.0.3

func GenDefaultStructFromDatabase(db *DB, packageName string, fileName string, tables ...string) error

func GetColumns added in v3.0.1

func GetColumns(v reflect.Value) ([]string, []string, []string, map[string]string)

func IntScan

func IntScan(src interface{}) (interface{}, error)

func MakeOrderBy

func MakeOrderBy(name string, orderType define.OrderType) define.OrderBy

func MakePage

func MakePage(page int64, size int64) define.PageInfo

func MapToCondition

func MapToCondition(maps map[string]interface{}) define.Condition

func Md5Text added in v3.0.1

func Md5Text(str string) string

func ScannerResultToStruct

func ScannerResultToStruct(t reflect.Type, scanners []interface{}, columnNames []string) reflect.Value

func SliceToGroupSlice

func SliceToGroupSlice(vs interface{}) map[string][]interface{}

func StructToCondition

func StructToCondition(vs interface{}, columns ...string) define.Condition

func StructToMap

func StructToMap(vs interface{}, columns ...string) (map[string]interface{}, error)

func UnZipSlice

func UnZipSlice(vs interface{}) []any

func UnderscoreToUpperCamelCase added in v3.0.3

func UnderscoreToUpperCamelCase(s string) string

下划线单词转为大写驼峰单词

Types

type CndImpl

type CndImpl struct {
	// contains filtered or unexported fields
}

func (*CndImpl) And

func (c *CndImpl) And(field string, operation define.Operation, value ...interface{}) define.Condition

func (*CndImpl) And2

func (c *CndImpl) And2(condition define.Condition) define.Condition

func (*CndImpl) And3

func (c *CndImpl) And3(rawExpresssion string, values ...interface{}) define.Condition

func (*CndImpl) And3Bool

func (c *CndImpl) And3Bool(b bool, rawExpresssion string, values ...interface{}) define.Condition

func (*CndImpl) AndBool

func (c *CndImpl) AndBool(b bool, field string, operation define.Operation, values ...interface{}) define.Condition

func (*CndImpl) Eq

func (c *CndImpl) Eq(field string, values interface{}) define.Condition

func (*CndImpl) EqBool

func (c *CndImpl) EqBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) Field

func (c *CndImpl) Field() string

func (*CndImpl) Ge

func (c *CndImpl) Ge(field string, values interface{}) define.Condition

func (*CndImpl) GeBool

func (c *CndImpl) GeBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) Gt

func (c *CndImpl) Gt(field string, values interface{}) define.Condition

func (*CndImpl) GtBool

func (c *CndImpl) GtBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) HasSubConditions

func (c *CndImpl) HasSubConditions() bool

func (*CndImpl) In

func (c *CndImpl) In(field string, values ...interface{}) define.Condition

func (*CndImpl) InBool

func (c *CndImpl) InBool(b bool, field string, values ...interface{}) define.Condition

func (*CndImpl) IsNotNull

func (c *CndImpl) IsNotNull(field string) define.Condition

func (*CndImpl) IsNotNullBool

func (c *CndImpl) IsNotNullBool(b bool, filed string) define.Condition

func (*CndImpl) IsNull

func (c *CndImpl) IsNull(filed string) define.Condition

func (*CndImpl) IsNullBool

func (c *CndImpl) IsNullBool(b bool, field string) define.Condition

func (*CndImpl) Items

func (c *CndImpl) Items() []define.Condition

func (*CndImpl) Le

func (c *CndImpl) Le(field string, values interface{}) define.Condition

func (*CndImpl) LeBool

func (c *CndImpl) LeBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) Like

func (c *CndImpl) Like(field string, values interface{}) define.Condition

func (*CndImpl) LikeBool

func (c *CndImpl) LikeBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) LikeIgnoreEnd

func (c *CndImpl) LikeIgnoreEnd(field string, values interface{}) define.Condition

func (*CndImpl) LikeIgnoreEndBool

func (c *CndImpl) LikeIgnoreEndBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) LikeIgnoreStart

func (c *CndImpl) LikeIgnoreStart(field string, values interface{}) define.Condition

func (*CndImpl) LikeIgnoreStartBool

func (c *CndImpl) LikeIgnoreStartBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) Linker

func (c *CndImpl) Linker() define.Linker

func (*CndImpl) Lt

func (c *CndImpl) Lt(field string, values interface{}) define.Condition

func (*CndImpl) LtBool

func (c *CndImpl) LtBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) NotEq

func (c *CndImpl) NotEq(field string, values interface{}) define.Condition

func (*CndImpl) NotEqBool

func (c *CndImpl) NotEqBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) NotIn

func (c *CndImpl) NotIn(field string, values ...interface{}) define.Condition

func (*CndImpl) NotInBool

func (c *CndImpl) NotInBool(b bool, field string, values ...interface{}) define.Condition

func (*CndImpl) NotLike added in v3.0.2

func (c *CndImpl) NotLike(field string, values interface{}) define.Condition

func (*CndImpl) NotLikeBool added in v3.0.2

func (c *CndImpl) NotLikeBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) Operation

func (c *CndImpl) Operation() define.Operation

func (*CndImpl) Or

func (c *CndImpl) Or(field string, operation define.Operation, values ...interface{}) define.Condition

func (*CndImpl) Or2

func (c *CndImpl) Or2(condition define.Condition) define.Condition

func (*CndImpl) Or3

func (c *CndImpl) Or3(rawExpresssion string, values ...interface{}) define.Condition

func (*CndImpl) Or3Bool

func (c *CndImpl) Or3Bool(b bool, rawExpresssion string, values ...interface{}) define.Condition

func (*CndImpl) OrBool

func (c *CndImpl) OrBool(b bool, field string, operation define.Operation, values ...interface{}) define.Condition

func (*CndImpl) OrEq

func (c *CndImpl) OrEq(field string, values interface{}) define.Condition

func (*CndImpl) OrEqBool

func (c *CndImpl) OrEqBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) OrGe

func (c *CndImpl) OrGe(field string, values interface{}) define.Condition

func (*CndImpl) OrGeBool

func (c *CndImpl) OrGeBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) OrGt

func (c *CndImpl) OrGt(field string, values interface{}) define.Condition

func (*CndImpl) OrGtBool

func (c *CndImpl) OrGtBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) OrIn

func (c *CndImpl) OrIn(field string, values ...interface{}) define.Condition

func (*CndImpl) OrInBool

func (c *CndImpl) OrInBool(b bool, field string, values ...interface{}) define.Condition

func (*CndImpl) OrIsNotNull

func (c *CndImpl) OrIsNotNull(field string) define.Condition

func (*CndImpl) OrIsNotNullBool

func (c *CndImpl) OrIsNotNullBool(b bool, field string) define.Condition

func (*CndImpl) OrIsNull

func (c *CndImpl) OrIsNull(field string) define.Condition

func (*CndImpl) OrIsNullBool

func (c *CndImpl) OrIsNullBool(b bool, field string) define.Condition

func (*CndImpl) OrLe

func (c *CndImpl) OrLe(field string, values interface{}) define.Condition

func (*CndImpl) OrLeBool

func (c *CndImpl) OrLeBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) OrLike

func (c *CndImpl) OrLike(field string, values interface{}) define.Condition

func (*CndImpl) OrLikeBool

func (c *CndImpl) OrLikeBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) OrLikeIgnoreEnd

func (c *CndImpl) OrLikeIgnoreEnd(field string, values interface{}) define.Condition

func (*CndImpl) OrLikeIgnoreEndBool

func (c *CndImpl) OrLikeIgnoreEndBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) OrLikeIgnoreStart

func (c *CndImpl) OrLikeIgnoreStart(field string, values interface{}) define.Condition

func (*CndImpl) OrLikeIgnoreStartBool

func (c *CndImpl) OrLikeIgnoreStartBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) OrLt

func (c *CndImpl) OrLt(field string, values interface{}) define.Condition

func (*CndImpl) OrLtBool

func (c *CndImpl) OrLtBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) OrNotEq

func (c *CndImpl) OrNotEq(field string, values interface{}) define.Condition

func (*CndImpl) OrNotEqBool

func (c *CndImpl) OrNotEqBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) OrNotIn

func (c *CndImpl) OrNotIn(field string, values ...interface{}) define.Condition

func (*CndImpl) OrNotInBool

func (c *CndImpl) OrNotInBool(b bool, field string, values ...interface{}) define.Condition

func (*CndImpl) OrNotLike added in v3.0.2

func (c *CndImpl) OrNotLike(field string, values interface{}) define.Condition

func (*CndImpl) OrNotLikeBool added in v3.0.2

func (c *CndImpl) OrNotLikeBool(b bool, field string, values interface{}) define.Condition

func (*CndImpl) PayLoads

func (c *CndImpl) PayLoads() int64

func (*CndImpl) RawExpression

func (c *CndImpl) RawExpression() string

func (*CndImpl) SetValues

func (c *CndImpl) SetValues(values []interface{})

func (*CndImpl) Values

func (c *CndImpl) Values() []interface{}

type CommonSqlResult

type CommonSqlResult struct {
	// contains filtered or unexported fields
}

func (CommonSqlResult) LastInsertId

func (c CommonSqlResult) LastInsertId() (int64, error)

func (CommonSqlResult) RowsAffected

func (c CommonSqlResult) RowsAffected() (int64, error)

type CountResult

type CountResult struct {
	Count int64
	Error error
}

type CountScanner

type CountScanner struct {
}

type DB

type DB struct {
	// contains filtered or unexported fields
}

func Open

func Open(driverName string, dsn string, debugs bool) (*DB, error)

func OpenWithConfig

func OpenWithConfig(driverName string, dsn string, maxOpen int, maxIdle int, debugs bool) (*DB, error)

func (*DB) Begin

func (db *DB) Begin() error

func (*DB) CleanDb

func (db *DB) CleanDb() *DB

func (*DB) CleanOrders

func (db *DB) CleanOrders() *DB

func (DB) Clone

func (db DB) Clone() DB

func (*DB) Commit

func (db *DB) Commit()

func (DB) Count

func (db DB) Count(columnName string) (int64, error)

func (*DB) Delete

func (db *DB) Delete(vs ...interface{}) (sql.Result, error)

func (*DB) DoTransaction

func (db *DB) DoTransaction(work TransactionWork) (interface{}, error)

func (*DB) ExecuteRaw

func (db *DB) ExecuteRaw(rawSql string, datas ...any) (sql.Result, error)

func (*DB) ExecuteStatement

func (db *DB) ExecuteStatement(statement string, data ...any) (sql.Result, error)

func (DB) Factory

func (db DB) Factory() define.SqlFactory

func (*DB) First

func (db *DB) First(vs interface{}) (interface{}, error)

func (DB) GetColumns added in v3.0.4

func (db DB) GetColumns(table string) ([]define.Column, error)

func (*DB) GetCondition

func (db *DB) GetCondition() define.Condition

func (DB) GetCurrentSchema added in v3.0.4

func (db DB) GetCurrentSchema() (string, error)

func (*DB) GetOrderBys

func (db *DB) GetOrderBys() []define.OrderBy

func (*DB) GetPage

func (db *DB) GetPage() (int64, int64)

func (*DB) GetPageInfo

func (db *DB) GetPageInfo() define.PageInfo

func (DB) GetRawDb

func (db DB) GetRawDb() *sql.DB

func (DB) GetTable

func (db DB) GetTable() string

func (DB) GetTableStruct added in v3.0.12

func (db DB) GetTableStruct(table string) (define.ITableStruct, error)

func (DB) GetTableStruct2 added in v3.0.13

func (db DB) GetTableStruct2(i any) (define.ITableStruct, error)

func (DB) GetTables added in v3.0.4

func (db DB) GetTables() ([]string, error)

func (*DB) Insert

func (db *DB) Insert(v interface{}, columns ...string) (sql.Result, error)

func (*DB) IsInTransaction

func (db *DB) IsInTransaction() bool

func (*DB) OrderBy

func (db *DB) OrderBy(field string, t define.OrderType) *DB

func (*DB) OrderByAsc

func (db *DB) OrderByAsc(field string) *DB

func (*DB) OrderByDesc

func (db *DB) OrderByDesc(field string) *DB

func (*DB) OrderBys

func (db *DB) OrderBys(orderbys []define.OrderBy) *DB

func (*DB) Page

func (db *DB) Page(page int64, pageSize int64) *DB

func (*DB) RawSql

func (db *DB) RawSql(sql string, datas ...any) *DB

func (*DB) Rollback

func (db *DB) Rollback()

func (*DB) Select

func (db *DB) Select(vs any, columns ...string) (interface{}, error)

func (*DB) Sum

func (db *DB) Sum(columnName string) (int64, error)

func (*DB) Table

func (db *DB) Table(table string) *DB

func (*DB) Update

func (db *DB) Update(v interface{}, columns ...string) (sql.Result, error)

func (*DB) Where

func (db *DB) Where(cnd define.Condition) *DB

func (*DB) Where2

func (db *DB) Where2(sql string, patches ...interface{}) *DB

type DefaultModel

type DefaultModel struct {
	// contains filtered or unexported fields
}

func (DefaultModel) Clone

func (d DefaultModel) Clone() define.TableModel

func (DefaultModel) ColumnDataMap

func (d DefaultModel) ColumnDataMap() map[string]interface{}

func (DefaultModel) Columns

func (d DefaultModel) Columns() []string

func (DefaultModel) Condition

func (d DefaultModel) Condition() define.Condition

func (DefaultModel) OrderBys

func (d DefaultModel) OrderBys() []define.OrderBy

func (DefaultModel) Page

func (d DefaultModel) Page() define.PageInfo

func (DefaultModel) PrimaryAuto added in v3.0.1

func (d DefaultModel) PrimaryAuto() []string

func (DefaultModel) PrimaryKeys added in v3.0.1

func (d DefaultModel) PrimaryKeys() []string

func (*DefaultModel) SetColumns added in v3.0.1

func (d *DefaultModel) SetColumns(columns []string) error

func (DefaultModel) Table

func (d DefaultModel) Table() string

type DefaultScanner

type DefaultScanner struct {
	RawMetaInfo
	// contains filtered or unexported fields
}

func (DefaultScanner) Scan

func (d DefaultScanner) Scan(rows *sql.Rows) (interface{}, error)

type EmptyScanner

type EmptyScanner struct {
	ColName string
}
var EMPTY_SCANNER *EmptyScanner = &EmptyScanner{}

func (EmptyScanner) Scan

func (e EmptyScanner) Scan(_ interface{}) error

func (EmptyScanner) Value

func (e EmptyScanner) Value() (driver.Value, error)

type FieldInfo

type FieldInfo struct {
	FieldName string
	FieldType reflect.Type
}

type IRowScanner

type IRowScanner interface {
	Scan(rows *sql.Rows) (interface{}, error)
}

type IScanner

type IScanner interface {
	Value() (driver.Value, error)
	Scan(src interface{}) error
}

func GetIScannerOfColumn

func GetIScannerOfColumn(col interface{}) IScanner

type ITableName

type ITableName interface {
	TableName() string
}

type OrderByImpl

type OrderByImpl struct {
	// contains filtered or unexported fields
}

func (OrderByImpl) Name

func (o OrderByImpl) Name() string

func (OrderByImpl) Type

func (o OrderByImpl) Type() define.OrderType

type PageImpl

type PageImpl struct {
	// contains filtered or unexported fields
}

func (PageImpl) Page

func (p PageImpl) Page() (int64, int64)

type RawMetaInfo

type RawMetaInfo struct {
	reflect.Type
	TableName string
	IsSlice   bool
	IsPtr     bool
	IsStruct  bool
	RawData   reflect.Value
}

func GetRawTableInfo

func GetRawTableInfo(v any) RawMetaInfo

type ScanFunc

type ScanFunc func(src interface{}) (interface{}, error)

type ScannerGenerateFunc

type ScannerGenerateFunc func(colName string, col interface{}) IScanner

type ScannerImpl

type ScannerImpl struct {
	Object driver.Value
	ScanFunc
}

func (*ScannerImpl) Scan

func (scanner *ScannerImpl) Scan(src interface{}) error

func (ScannerImpl) Value

func (scanner ScannerImpl) Value() (driver.Value, error)

type TransactionWork

type TransactionWork func(databaseTx *DB) (interface{}, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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