forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmore_like_this_scope.go
35 lines (29 loc) · 900 Bytes
/
more_like_this_scope.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
package ravendb
type moreLikeThisScope struct {
token *moreLikeThisToken
addQueryParameter func(interface{}) string
onDispose func()
}
func newMoreLikeThisScope(token *moreLikeThisToken, addQueryParameter func(interface{}) string, onDispose func()) *moreLikeThisScope {
return &moreLikeThisScope{
token: token,
addQueryParameter: addQueryParameter,
onDispose: onDispose,
}
}
func (s *moreLikeThisScope) Close() {
if s.onDispose != nil {
s.onDispose()
}
}
func (s *moreLikeThisScope) withOptions(options *MoreLikeThisOptions) {
if options == nil {
return
}
// force using *non* entity serializer here:
optionsAsJson := valueToTree(options)
s.token.optionsParameterName = s.addQueryParameter(optionsAsJson)
}
func (s *moreLikeThisScope) withDocument(document string) {
s.token.documentParameterName = s.addQueryParameter(document)
}