Documentation ¶
Index ¶
- Constants
- Variables
- func BuildDelRollBackSql(column []Column, dataItems [][]string, tableName string) (string, error)
- func DeleteSpecifyCharAtHead(str string) string
- func GetCondition(sqlAfterWhere string) []string
- func GetSelectColumn(sql string, db *sql.DB) ([]string, error)
- func GetSqlAfterWhere(sql string) string
- func GetSqlColumn(sql string) ([]string, error)
- func GetTableColumn(tableName string, db *sql.DB) (*[]Column, error)
- func GetTableName(sql string) (string, error)
- func GetTablePrimaryInfo(columnInfos []Column) (primaryCol []string, index []int)
- func HandelKeyWorldForCondition(originWhere string) string
- func IsKeyWord(name string) bool
- func IsSubKey(keyA, keyB string) bool
- func NewReadSql(sql string) *readSql
- func ReplaceSpecifyChar(str string) string
- func ScanMap(rows Rows) ([]map[string]interface{}, error)
- func SinglePrimaryKeyIsInt(nodes []ast.StmtNode) bool
- func SortColOnOriginSeq(columnInfos []Column, column []string) []string
- func SplitMultiSql(sql string) (resp []string, err error)
- func VarcharLengthTooLong(nodes []ast.StmtNode) bool
- type ColsSeq
- type Column
- type Rows
- type WriterBuffer
Constants ¶
View Source
const ( Semicolon = `;` Space = ` ` DoubleSpace = ` ` Table = ` ` NewLine = ` ` )
View Source
const KeyJoinChar = "+"
Variables ¶
View Source
var Parser *parser.Parser = parser.New()
Functions ¶
func BuildDelRollBackSql ¶
func DeleteSpecifyCharAtHead ¶
func GetCondition ¶
获取sql的条件,字符串处理 方式: 小写化,and前后有空格,空格分割,再依次进一步判断。
func GetTablePrimaryInfo ¶
func HandelKeyWorldForCondition ¶
add “ to key words todo 有瑕疵,同时有关键字和value内包含关键字内容的情况(eg: xxxx where `index` = 'index hello'; ),会出问题。待更换更好的方式。
func NewReadSql ¶
func NewReadSql(sql string) *readSql
func ReplaceSpecifyChar ¶
func SinglePrimaryKeyIsInt ¶
func SortColOnOriginSeq ¶
columnInfos:所有的顺序的列信息, column: 待排序列信息 注意这个返回值里有空值,为了对应其原来的顺序和位置 eg : {"id","","age"}
func SplitMultiSql ¶
func VarcharLengthTooLong ¶
Types ¶
type Rows ¶
type Rows interface { Close() error Columns() ([]string, error) Next() bool Scan(dest ...interface{}) error }
Rows defines methods that scanner needs, which database/sql.Rows already implements
type WriterBuffer ¶
Click to show internal directories.
Click to hide internal directories.