• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stephenafamo / bob / 14939098091

09 May 2025 10:59PM UTC coverage: 36.868% (-4.6%) from 41.506%
14939098091

push

github

stephenafamo
Move reusable sqlite parser components to antlrhelpers package

0 of 758 new or added lines in 12 files covered. (0.0%)

547 existing lines in 8 files now uncovered.

6533 of 17720 relevant lines covered (36.87%)

212.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/gen/bobgen-helpers/parser/config.go
1
package parser
2

3
import (
4
        "strings"
5

6
        "github.com/stephenafamo/bob/gen/drivers"
7
)
8

9
// ParseQueryConfig parses a user configuration string into a QueryCoonfig.
10
// The configuration string should be in the format:
11
// "row_name:row_slice_name:generate_row"
12
func ParseQueryConfig(options string) drivers.QueryConfig {
×
13
        var i int
×
14
        var part string
×
15
        var found bool
×
16

×
17
        col := drivers.QueryConfig{
×
18
                GenerateRow: true,
×
19
        }
×
20
        for {
×
21
                part, options, found = strings.Cut(options, ":")
×
22
                switch i {
×
23
                case 0:
×
24
                        col.RowName = part
×
25
                case 1:
×
26
                        col.RowSliceName = part
×
27
                case 2:
×
28
                        switch part {
×
29
                        case "true", "yes":
×
30
                                col.GenerateRow = true
×
31
                        case "false", "no", "skip":
×
32
                                col.GenerateRow = false
×
33
                        }
34
                }
35
                if !found {
×
36
                        break
×
37
                }
38
                i++
×
39
        }
40

41
        return col
×
42
}
43

44
// ParseQueryColumnConfig parses a user configuration string into a QueryCol.
45
// The configuration string should be in the format:
46
// "name:type:notnull"
UNCOV
47
func ParseQueryColumnConfig(options string) drivers.QueryCol {
×
NEW
48
        if options == "" {
×
NEW
49
                return drivers.QueryCol{}
×
NEW
50
        }
×
51

UNCOV
52
        var i int
×
UNCOV
53
        var part string
×
UNCOV
54
        var found bool
×
UNCOV
55

×
UNCOV
56
        col := drivers.QueryCol{}
×
UNCOV
57
        for {
×
UNCOV
58
                part, options, found = strings.Cut(options, ":")
×
UNCOV
59
                switch i {
×
UNCOV
60
                case 0:
×
UNCOV
61
                        col.Name = part
×
62
                case 1:
×
63
                        col.TypeName = part
×
64
                case 2:
×
65
                        switch part {
×
66
                        case "null", "true", "yes":
×
67
                                col.Nullable.Set(true)
×
68
                        case "notnull", "nnull", "false", "no":
×
69
                                col.Nullable.Set(false)
×
70
                        }
71
                }
UNCOV
72
                if !found {
×
UNCOV
73
                        break
×
74
                }
75
                i++
×
76
        }
77

UNCOV
78
        return col
×
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc