dialect

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect interface {
	// GetName get dialect's name
	GetName() string

	// ShowColumns show columns of specified table
	ShowColumns(table string) string

	// ShowColumnsWithComment show columns with coment of specified table
	ShowColumnsWithComment(schema, table string) string

	// ShowTables show tables of database
	ShowTables() string

	// Insert
	Insert(comp *SQLComponent) string

	// Delete
	Delete(comp *SQLComponent) string

	// Update
	Update(comp *SQLComponent) string

	// Select
	Select(comp *SQLComponent) string

	// GetDelimiter return the delimiter of Dialect.
	GetDelimiter() string
}

Dialect is methods set of different driver.

func GetDialect

func GetDialect() Dialect

GetDialect return the default Dialect.

func GetDialectByDriver

func GetDialectByDriver(driver string) Dialect

GetDialectByDriver return the Dialect of given driver.

type H

type H map[string]interface{}

H is a shorthand of map.

type Join

type Join struct {
	Table     string
	FieldA    string
	Operation string
	FieldB    string
}

Join contains the table and field and operation.

type RawUpdate

type RawUpdate struct {
	Expression string
	Args       []interface{}
}

RawUpdate contains the expression and arguments.

type SQLComponent

type SQLComponent struct {
	Fields     []string
	Functions  []string
	TableName  string
	Wheres     []Where
	Leftjoins  []Join
	Args       []interface{}
	Order      string
	Offset     string
	Limit      string
	WhereRaws  string
	UpdateRaws []RawUpdate
	Group      string
	Statement  string
	Values     H
}

SQLComponent is a sql components set.

type Where

type Where struct {
	Operation string
	Field     string
	Qmark     string
}

Where contains the operation and field.

Jump to

Keyboard shortcuts

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