statement

package
v0.0.0-...-dd3ac02 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInteger

func IsInteger(val any) bool

Types

type ClauseType

type ClauseType int

ClauseType 定义 SQL 子句的数据类型

const (
	ClauseInsert            ClauseType = iota // insert
	ClauseReplaceMysql                        // replace(MySQL)
	ClauseReplacePostgresql                   // replace(PostgreSQL)
	ClauseUpdate                              // update
	ClauseDelete                              // delete
	ClauseSelect                              // select
	ClauseCount                               // count
	ClauseValues                              // values
	ClauseDistinct                            // distinct
	ClauseFrom                                // from
	ClauseInnerJoin                           // inner join
	ClauseLeftJoin                            // left join
	ClauseRightJoin                           // right join
	ClauseWhere                               // where
	ClauseGroupBy                             // group by
	ClauseHaving                              // having
	ClauseOrderBy                             // order by
	ClauseLimit                               // limit
)

type Statement

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

Statement 定义 SQL 语句的数据结构

func NewStatement

func NewStatement(table string) *Statement

NewStatement 创建一个 SQL 语句

func (*Statement) GenerateSQL

func (own *Statement) GenerateSQL(types ...ClauseType) (string, []any)

GenerateSQL 生成完整的 SQL 语句和参数列表

func (*Statement) Reset

func (own *Statement) Reset()

Reset 重置 SQL 语句的子句和参数

func (*Statement) WithClause

func (own *Statement) WithClause(typ ClauseType, vars ...any) *Statement

WithClause 添加 SQL 子句

func (*Statement) WithTableName

func (own *Statement) WithTableName(name string) *Statement

WithTableName 指定数据表名

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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