Documentation
¶
Index ¶
- func KeywordTo(key string) string
- func ParserClause(paramMap map[string]interface{}, keyword bool, filterateColumns ...string) ([]string, []interface{})
- func ParserColumns(obj any, tag string, keyword bool) []string
- func ParserTagToMap(obj any, tag string) (map[string]interface{}, error)
- type Clause
- type Engine
- type MySQL
- type TableInterface
- type WhereEngine
- func (se *WhereEngine[T]) And(condition string, params ...interface{}) *WhereEngine[T]
- func (se *WhereEngine[T]) AndIn(condition string, params ...interface{}) *WhereEngine[T]
- func (se *WhereEngine[T]) Count() (int, error)
- func (se *WhereEngine[T]) Delete() (sql.Result, error)
- func (se *WhereEngine[T]) Find(dest any, columns ...string) error
- func (se *WhereEngine[T]) Get(dest any, columns ...string) error
- func (se *WhereEngine[T]) Or(condition string, params ...interface{}) *WhereEngine[T]
- func (se *WhereEngine[T]) OrIn(condition string, params ...interface{}) *WhereEngine[T]
- func (se *WhereEngine[T]) Update(conditions string, params ...interface{}) (sql.Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParserClause ¶
func ParserClause(paramMap map[string]interface{}, keyword bool, filterateColumns ...string) ([]string, []interface{})
ParserClause
func ParserColumns ¶
ParserColumns parser obj the tag columns names
Types ¶
type Engine ¶
type Engine[T TableInterface] struct { *MySQL // contains filtered or unexported fields }
Engine sql builder for generating single table operations
func (*Engine[T]) BatchInsert ¶
BatchInsert
func (*Engine[T]) DeleteById ¶
DelById based on PrimaryKey() the deletion statement based on PrimaryKey will be automatically renewed
func (*Engine[T]) FindById ¶
FindById based on PrimaryKey() the query statement based on PrimaryKey will be automatically renewed
func (*Engine[T]) UpdateById ¶
UpdateById based on PrimaryKey() the modification statement based on PrimaryKey will be automatically renewed
type MySQL ¶
type MySQL struct { *sqlx.DB Tag string // tag used for kernel operations to parse the field information of the structure based on this label }
MySQL is tls core
func MustOpen ¶
MustOpen is the same as sql.Open, but returns an *tls.MySQL instead and panics on error.
func (*MySQL) Engine ¶
func (mysql *MySQL) Engine(obj TableInterface) *Engine[TableInterface]
Engine generate this obj sql engine
type TableInterface ¶
type TableInterface interface { TableName() string // TableName returnes the table name PrimaryKey() []string // PrimaryKey returnes the table id columns }
TableInterface
type WhereEngine ¶
type WhereEngine[T TableInterface] struct { *Engine[T] // contains filtered or unexported fields }
func (*WhereEngine[T]) And ¶
func (se *WhereEngine[T]) And(condition string, params ...interface{}) *WhereEngine[T]
And
func (*WhereEngine[T]) AndIn ¶
func (se *WhereEngine[T]) AndIn(condition string, params ...interface{}) *WhereEngine[T]
AndIn
func (*WhereEngine[T]) Find ¶
func (se *WhereEngine[T]) Find(dest any, columns ...string) error
Find
func (*WhereEngine[T]) Or ¶
func (se *WhereEngine[T]) Or(condition string, params ...interface{}) *WhereEngine[T]
Or
func (*WhereEngine[T]) OrIn ¶
func (se *WhereEngine[T]) OrIn(condition string, params ...interface{}) *WhereEngine[T]
OrIn
Click to show internal directories.
Click to hide internal directories.