orm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CTx

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

CTx 事务

func (*CTx) Commit

func (tx *CTx) Commit() error

Commit 提交事务

func (*CTx) Delete

func (tx *CTx) Delete() error

Delete 删除数据

func (*CTx) Equal

func (tx *CTx) Equal(field string, v any) *CTx

Equal 相等 Where 子句

func (*CTx) Insert

func (tx *CTx) Insert(v ...any) error

Insert 插入数据

func (*CTx) Limit

func (tx *CTx) Limit(count int, offset ...int) *CTx

Limit 添加 Limit 子句

func (*CTx) Order

func (tx *CTx) Order(name string, desc ...bool) *CTx

Order 添加 Order By 子句

func (*CTx) Reset

func (tx *CTx) Reset()

Reset 重置会话

func (*CTx) Rollback

func (tx *CTx) Rollback() error

Rollback 回滚事务

func (*CTx) Select

func (tx *CTx) Select(v any) (int, error)

Select 查询数据

func (*CTx) Set

func (tx *CTx) Set(field string, v any) *CTx

Set 添加 Set 子句

func (*CTx) Table

func (tx *CTx) Table(name string) *CTx

Table 设置表格名

func (*CTx) Unequal

func (tx *CTx) Unequal(field string, v any) *CTx

Unequal 不相等 Where 子句

func (*CTx) Update

func (tx *CTx) Update() error

Update 修改数据

func (*CTx) Where

func (tx *CTx) Where(field, flag string, v any) *CTx

Where 添加 Where 子句

type Engine

type Engine struct {
	DB *sql.DB
}

Engine ORM引擎

func NewEngine

func NewEngine(source string) (*Engine, error)

NewEngine 构造ORM引擎

func (*Engine) Close

func (engine *Engine) Close()

Close 关闭数据库连接

func (*Engine) NewSession

func (engine *Engine) NewSession() *Session

NewSession 构造数据库会话

func (*Engine) SetMaxIdleConns

func (engine *Engine) SetMaxIdleConns(v int)

SetMaxIdleConns 设置池中最大空闲连接数,即保留连接以备下次使用

func (*Engine) SetMaxOpenConns

func (engine *Engine) SetMaxOpenConns(v int)

SetMaxOpenConns 设置打开的最大连接数

type Session

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

Session 数据库会话

func (*Session) Begin

func (session *Session) Begin() (*CTx, error)

GetTx 获取事务

func (*Session) Delete

func (session *Session) Delete() error

Delete 删除数据

func (*Session) Equal

func (session *Session) Equal(field string, v any) *Session

Equal 相等 Where 子句

func (*Session) Insert

func (session *Session) Insert(v ...any) error

Insert 插入数据

func (*Session) Limit

func (session *Session) Limit(count int, offset ...int) *Session

Limit 添加 Limit 子句

func (*Session) Order

func (session *Session) Order(name string, desc ...bool) *Session

Order 添加 Order By 子句

func (*Session) Reset

func (session *Session) Reset()

Reset 重置会话

func (*Session) Select

func (session *Session) Select(v any) (int, error)

Select 查询数据

func (*Session) Set

func (session *Session) Set(field string, v any) *Session

Set 添加 Set 子句

func (*Session) Table

func (session *Session) Table(name string) *Session

Table 设置表格名

func (*Session) Unequal

func (session *Session) Unequal(field string, v any) *Session

Unequal 不相等 Where 子句

func (*Session) Update

func (session *Session) Update() error

Update 修改数据

func (*Session) Where

func (session *Session) Where(field, flag string, v any) *Session

Where 添加 Where 子句

type StoreInsert

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

StoreInsert 插入缓存

func (*StoreInsert) Clear

func (store *StoreInsert) Clear()

Clear 清除插入缓存

type StoreLimit

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

StoreLimit limit缓存

func (*StoreLimit) Clear

func (store *StoreLimit) Clear()

Clear 重置 limit 缓存

type StoreOrder

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

StoreOrder orderby缓存

type StoreSet

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

StoreSet set缓存

type StoreWhere

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

StoreWhere where缓存

Jump to

Keyboard shortcuts

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