tls

package
v0.0.0-...-a060367 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeywordTo

func KeywordTo(key string) string

KeywordTo

func ParserClause

func ParserClause(paramMap map[string]interface{}, keyword bool, filterateColumns ...string) ([]string, []interface{})

ParserClause

func ParserColumns

func ParserColumns(obj any, tag string, keyword bool) []string

ParserColumns parser obj the tag columns names

func ParserTagToMap

func ParserTagToMap(obj any, tag string) (map[string]interface{}, error)

ParserTagToMap read obj the tag generate map[string]interface{}

Types

type Clause

type Clause struct {
	Condition []string
	Params    []interface{}
	End       bool
}

Clause

func NewClause

func NewClause() Clause

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

func (e *Engine[T]) BatchInsert(dests ...T) (sql.Result, error)

BatchInsert

func (*Engine[T]) DeleteById

func (e *Engine[T]) DeleteById(params ...any) (sql.Result, error)

DelById based on PrimaryKey() the deletion statement based on PrimaryKey will be automatically renewed

func (*Engine[T]) FindById

func (e *Engine[T]) FindById(dest T, params ...any) error

FindById based on PrimaryKey() the query statement based on PrimaryKey will be automatically renewed

func (*Engine[T]) UpdateById

func (e *Engine[T]) UpdateById(dest T) (sql.Result, error)

UpdateById based on PrimaryKey() the modification statement based on PrimaryKey will be automatically renewed

func (*Engine[T]) Where

func (e *Engine[T]) Where() *WhereEngine[T]

Where

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

func MustOpen(dataSourceName string, tag string) *MySQL

MustOpen is the same as sql.Open, but returns an *tls.MySQL instead and panics on error.

func Open

func Open(dataSourceName string, tag string) (*MySQL, error)

Open is the same as sql.Open, but returns an *tls.MySQL instead.

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]) Count

func (se *WhereEngine[T]) Count() (int, error)

Count

func (*WhereEngine[T]) Delete

func (se *WhereEngine[T]) Delete() (sql.Result, error)

Delete

func (*WhereEngine[T]) Find

func (se *WhereEngine[T]) Find(dest any, columns ...string) error

Find

func (*WhereEngine[T]) Get

func (se *WhereEngine[T]) Get(dest any, columns ...string) error

Get

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

func (*WhereEngine[T]) Update

func (se *WhereEngine[T]) Update(conditions string, params ...interface{}) (sql.Result, error)

Update

Jump to

Keyboard shortcuts

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