query

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogicAnd    = uint8(1)
	LogicOr     = uint8(2)
	LogicAndNot = uint8(3)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

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

func (*Condition) Empty

func (cond *Condition) Empty()

func (*Condition) GetExp

func (cond *Condition) GetExp() []conditionExp

func (*Condition) Not

func (cond *Condition) Not(query interface{}, values ...interface{})

func (*Condition) Or

func (cond *Condition) Or(query interface{}, values ...interface{})

func (*Condition) SetExp

func (cond *Condition) SetExp(exp []conditionExp)

func (*Condition) Where

func (cond *Condition) Where(query interface{}, values ...interface{})

type DB

type DB struct {
	SqlDb *sql.DB
	SqlTx *sql.Tx
	HasTx bool
}

func (*DB) Begin

func (db *DB) Begin() error

func (*DB) Commit

func (db *DB) Commit() error

func (*DB) Exec

func (db *DB) Exec(Sql string, args ...interface{}) (sql.Result, error)

func (*DB) Query

func (db *DB) Query(Sql string, args ...interface{}) (*sql.Rows, error)

func (*DB) Rollback

func (db *DB) Rollback() error

type Exp

type Exp struct {
	Value string
}

type Sql

type Sql struct {
	Cond Condition
	// contains filtered or unexported fields
}

struct for build SQL

func (*Sql) BuildDelete

func (sql *Sql) BuildDelete() string

Build SQL statement for delete record from table

func (*Sql) BuildInsert

func (sql *Sql) BuildInsert() string

build insert sql

func (*Sql) BuildSelect

func (sql *Sql) BuildSelect() string

build select SQL statement

func (*Sql) BuildUpdate

func (sql *Sql) BuildUpdate() string

build update sql

func (*Sql) Field

func (sql *Sql) Field(fields ...string) *Sql

update field in sql

func (*Sql) FilterRows

func (sql *Sql) FilterRows(rows []map[string]interface{}) *Sql

filter update columns

func (*Sql) GetModelStruct

func (sql *Sql) GetModelStruct() model.ModelStruct

func (*Sql) GetRows

func (sql *Sql) GetRows() []map[string]interface{}

func (*Sql) Group

func (sql *Sql) Group(group string) *Sql

*

  • group by in sql

func (*Sql) HasCondition

func (sql *Sql) HasCondition() bool

check if the condition exist

func (*Sql) Having

func (sql *Sql) Having(having string) *Sql

having condition in sql

func (*Sql) Join

func (sql *Sql) Join(join string) *Sql

let join in sql

func (*Sql) Limit

func (sql *Sql) Limit(limit string) *Sql

limit in sql

func (*Sql) Offset

func (sql *Sql) Offset(offset string) *Sql

query offset in sql

func (*Sql) Omit

func (sql *Sql) Omit(omit ...string) *Sql

ignore update field in sql

func (*Sql) Option

func (sql *Sql) Option(option string) *Sql

extra query (such as for update) in sql

func (*Sql) Order

func (sql *Sql) Order(order string) *Sql

order by in sql

func (*Sql) RightJoin

func (sql *Sql) RightJoin(join string) *Sql

right join in sql

func (*Sql) Rows

func (sql *Sql) Rows(rows []map[string]interface{}) *Sql

insert data rows or update data set in sql

func (*Sql) Select

func (sql *Sql) Select(column string) *Sql

fields in sql

func (*Sql) SetModelStruct

func (sql *Sql) SetModelStruct(modelStruct model.ModelStruct)

set model

func (*Sql) SetTable

func (sql *Sql) SetTable(tableName string)

func (*Sql) Union

func (sql *Sql) Union(sql2 *Sql) *Sql

union in sql

func (*Sql) UpdateSet

func (sql *Sql) UpdateSet(updateSet string) *Sql

update set in sql

func (*Sql) WhereSql

func (sql *Sql) WhereSql() string

build where sql from complex condition

Jump to

Keyboard shortcuts

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