35 lines
653 B
Go
35 lines
653 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
//"query-inter/q"
|
|
|
|
"github.com/DataDog/go-sqllexer"
|
|
// "github.com/DataDog/go-sqllexer"
|
|
)
|
|
|
|
func main() {
|
|
selectQuery := "SELECT MIN(Price) AS SmallestPrice, CategoryID FROM Products GROUP BY CategoryID;"
|
|
|
|
//allStatements := q.ExtractSqlStatmentsFromString(selectQuery)
|
|
//fmt.Println(allStatements)
|
|
|
|
lexer := sqllexer.New(selectQuery)
|
|
for {
|
|
token := lexer.Scan()
|
|
fmt.Println(token.Value, token.Type)
|
|
|
|
if token.Type == sqllexer.EOF {
|
|
break
|
|
}
|
|
}
|
|
|
|
//for _, sql := range allStatements {
|
|
//query := q.ParseSelectStatement(sql)
|
|
//fmt.Print(i)
|
|
//fmt.Println(query)
|
|
//fmt.Println(query.GetFullSql())
|
|
//}
|
|
|
|
}
|