mdb

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ShowSql = false

Variables

View Source
var Insert insert
View Source
var Scan = &scan{}
View Source
var Update update

Functions

func ConnectionMysql

func ConnectionMysql(dataSource *msystem.Mysql) *sqlx.DB

func ConnectionSqlite3

func ConnectionSqlite3(dataSource *msystem.Sqlite3) *sqlx.DB

func InitMysql

func InitMysql()

func InitSqlIte3

func InitSqlIte3()

func NewInsert

func NewInsert(tableName string, ignore ...string) *insert

func NewSelect

func NewSelect(tableName string) *query

func NewUpdate

func NewUpdate(tableName string) *update

Types

type Counter

type Counter struct {
	Count int64 `db:"count"`
}

func (Counter) Nil

func (domain Counter) Nil() bool

func (Counter) OK

func (domain Counter) OK() bool

type SQLExecute

type SQLExecute struct {
	DB              *sqlx.DB
	TransactionalId string
	ShowSql         bool
	Transactional   *sqlx.Tx
}
var MySql *SQLExecute
var SqlIte3 *SQLExecute

func (*SQLExecute) Commit

func (domain *SQLExecute) Commit() *SQLExecute

func (*SQLExecute) Count

func (domain *SQLExecute) Count(tableName string, where map[string]any) (count Counter)

func (*SQLExecute) Delete

func (domain *SQLExecute) Delete(tableName string, where map[string]any) (rowsAffect int64)

func (*SQLExecute) Exists

func (domain *SQLExecute) Exists(tableName string, where map[string]any) (exists bool)

func (*SQLExecute) Insert

func (domain *SQLExecute) Insert(insertSql string, params ...any) (rowsAffect int64, lastId int64)

func (*SQLExecute) InsertMap

func (domain *SQLExecute) InsertMap(tableName string, entity any) (rowsAffect int64, lastId int64)

func (*SQLExecute) NotFound

func (domain *SQLExecute) NotFound(tableName string, where map[string]any) (notFound bool)

func (*SQLExecute) OpenTransactional

func (domain *SQLExecute) OpenTransactional() *SQLExecute

func (*SQLExecute) Rollback

func (domain *SQLExecute) Rollback() *SQLExecute

func (*SQLExecute) SelectById

func (domain *SQLExecute) SelectById(entity any, tableName string, idName string, idValue any)

func (*SQLExecute) SelectList

func (domain *SQLExecute) SelectList(entity any, sql string, params ...any)

func (*SQLExecute) SelectPage

func (domain *SQLExecute) SelectPage(entity []any, query *query, searchPage mmodel.CmdPage) *mmodel.Pageable

func (*SQLExecute) SelectRow

func (domain *SQLExecute) SelectRow(entity any, sql string, params ...any)

func (*SQLExecute) Update

func (domain *SQLExecute) Update(updateSql string, params ...any) (rowsAffect int64)

func (*SQLExecute) UpdateMap

func (domain *SQLExecute) UpdateMap(tableName string, update map[string]any, where map[string]any) (rowsAffect int64)

Jump to

Keyboard shortcuts

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