-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.template
59 lines (49 loc) · 1.8 KB
/
README.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{{- $types := .Types -}}
{{- $operators := .Operators -}}
# sqlparser - meant for querying csv files
[![Build Status](https://img.shields.io/travis/marianogappa/sqlparser.svg)](https://travis-ci.org/marianogappa/sqlparser) [![Coverage Status](https://coveralls.io/repos/github/marianogappa/sqlparser/badge.svg?branch=master)](https://coveralls.io/github/MarianoGappa/sqlparser?branch=master) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/marianogappa/sqlparser/master/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/marianogappa/sqlparser?style=flat-square)](https://goreportcard.com/report/github.com/marianogappa/sqlparser) [![GoDoc](https://godoc.org/github.com/marianogappa/sqlparser?status.svg)](https://godoc.org/github.com/marianogappa/sqlparser)
### Usage
```
package main
import (
"fmt"
"log"
"github.com/marianogappa/sqlparser"
)
func main() {
query, err := sqlparser.Parse("SELECT a, b, c FROM 'd' WHERE e = '1' AND f > '2'")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+#v", query)
}
```
{{range .NoErrorExamples}}
### Example: {{.Name}}
```
query, err := sqlparser.Parse(`{{.SQL}}`)
query.Query {
Type: {{index $types .Expected.Type}}
TableName: {{.Expected.TableName}}
Conditions: [{{range .Expected.Conditions}}
{
Operand1: {{.Operand1}},
Operand1IsField: {{.Operand1IsField}},
Operator: {{index $operators .Operator}},
Operand2: {{.Operand2}},
Operand2IsField: {{.Operand2IsField}},
}{{end -}}]
Updates: {{.Expected.Updates}}
Inserts: {{.Expected.Inserts}}
Fields: {{.Expected.Fields}}
Aliases: {{.Expected.Aliases}}
}
```
{{end}}
{{range .ErrorExamples}}
### Example: {{.Name}}
```
query, err := sqlparser.Parse(`{{.SQL}}`)
{{.Err}}
```
{{end}}