forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
declare_token.go
39 lines (33 loc) · 824 Bytes
/
declare_token.go
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
package ravendb
import "strings"
var _ queryToken = &declareToken{}
type declareToken struct {
name string
parameters string
body string
}
/*
// TODO: why is this unused? Should declareToken be publicly exposed?
func newDeclareToken(name string, body string, parameters string) *declareToken {
return &declareToken{
name: name,
body: body,
parameters: parameters,
}
}
*/
func (t *declareToken) writeTo(writer *strings.Builder) error {
writer.WriteString("declare ")
writer.WriteString("function ")
writer.WriteString(t.name)
writer.WriteString("(")
writer.WriteString(t.parameters)
writer.WriteString(") ")
writer.WriteString("{")
writer.WriteString("\n")
writer.WriteString(t.body)
writer.WriteString("\n")
writer.WriteString("}")
writer.WriteString("\n")
return nil
}