statement

package
v0.0.0-...-a98f5d9 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ORDER_ASC  string = "ASC"
	ORDER_DESC string = "DESC"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClauseType

type ClauseType int

ClauseType defines the dataype of SQL clause

const (
	CLAUSE_INSERT ClauseType = iota
	CLAUSE_VALUES
	CLAUSE_SELECT
	CLAUSE_DISTINCT
	CLAUSE_FROM
	CLAUSE_UPDATE
	CLAUSE_DELETE
	CLAUSE_COUNT
	CLAUSE_WHERE
	CLAUSE_GROUPBY
	CLAUSE_HAVING
	CLAUSE_ORDERBY
	CLAUSE_LIMIT
)

type Statement

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

Statement defines the structure of SQL statement.

func NewStatement

func NewStatement(table string) *Statement

func (*Statement) Build

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

Build generates the final SQL and SQLVars by the orders of SQL clauses.

func (*Statement) Reset

func (own *Statement) Reset(table ...string)

Reset initializes the parameters of the Statement.

func (*Statement) WithClause

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

WithClause adds the type and variables of a specific clause.

func (*Statement) WithTableName

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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