File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -36,16 +36,40 @@ type TrackedBuffer struct {
36
36
* bytes.Buffer
37
37
bindLocations []bindLocation
38
38
nodeFormatter NodeFormatter
39
+ vPrefix string
40
+ fPrefix string
41
+ Vars map [string ]string
42
+ vCount int
43
+ fCount int
39
44
}
40
45
41
46
// NewTrackedBuffer creates a new TrackedBuffer.
42
47
func NewTrackedBuffer (nodeFormatter NodeFormatter ) * TrackedBuffer {
43
48
return & TrackedBuffer {
44
49
Buffer : new (bytes.Buffer ),
45
50
nodeFormatter : nodeFormatter ,
51
+ Vars : make (map [string ]string ),
52
+ vPrefix : ":v" ,
53
+ fPrefix : ":f" ,
54
+ vCount : 1 ,
55
+ fCount : 1 ,
46
56
}
47
57
}
48
58
59
+ // VarArg create variable id
60
+ func (buf * TrackedBuffer ) VarArg () string {
61
+ name := fmt .Sprintf ("%s%d" , buf .vPrefix , buf .vCount )
62
+ buf .vCount ++
63
+ return name
64
+ }
65
+
66
+ // FuncArg create function id
67
+ func (buf * TrackedBuffer ) FuncArg () string {
68
+ name := fmt .Sprintf ("%s%d" , buf .fPrefix , buf .fCount )
69
+ buf .fCount ++
70
+ return name
71
+ }
72
+
49
73
// WriteNode function, initiates the writing of a single SQLNode tree by passing
50
74
// through to Myprintf with a default format string
51
75
func (buf * TrackedBuffer ) WriteNode (node SQLNode ) * TrackedBuffer {
You can’t perform that action at this time.
0 commit comments