mdb

package
v0.2.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ShowSql = false

Variables

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

Functions

func ConnectionMysql

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

func GetId added in v0.0.9

func GetId(dest any) (string, any)

func GetTableName added in v0.0.9

func GetTableName(dest any) string

func InitMysql

func InitMysql()

func NewInsert

func NewInsert(entity Table, ignore ...string) (string, []any)

func NewInsertMap added in v0.0.9

func NewInsertMap(tableName string, dataMap map[string]any) (string, []any)

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 D added in v0.2.2

type D = map[string]any

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) DeleteByField added in v0.0.9

func (domain *SQLExecute) DeleteByField(entity any, fieldName string, fieldVal any) (rowsAffect int64)

func (*SQLExecute) DeleteById added in v0.0.9

func (domain *SQLExecute) DeleteById(entity any) (rowsAffect int64)

func (*SQLExecute) Exec added in v0.0.9

func (domain *SQLExecute) Exec(execSql string, params ...any) (rowsAffect int64, err error)

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(entity Table, ignore ...string) (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) SelectByField added in v0.0.9

func (domain *SQLExecute) SelectByField(entity any, fieldName string, fieldValue any)

func (*SQLExecute) SelectById

func (domain *SQLExecute) SelectById(entity 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)

type Table added in v0.0.9

type Table interface {
	TableName() string
}

type TableId added in v0.0.9

type TableId interface {
	IdName() string
	IdVal() any
}

Jump to

Keyboard shortcuts

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