-
Notifications
You must be signed in to change notification settings - Fork 1
/
configuration.go
40 lines (34 loc) · 1.09 KB
/
configuration.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
40
package quirk
import "github.com/damienfamed75/yalp"
// ClientConfiguration is used to pass in options
// to change the client and customize it to the user's liking.
type ClientConfiguration func(*Client)
// WithLogger sets the logger used by the quirk client.
// By default this is quirk.NewNilLogger.
func WithLogger(l yalp.Logger) ClientConfiguration {
return func(c *Client) {
c.logger = l
}
}
// WithPredicateKey sets the field(predicate) that will
// be used to label inserted nodes. By default this is "name"
func WithPredicateKey(predicateName string) ClientConfiguration {
return func(c *Client) {
c.predicateKey = predicateName
}
}
// WithTemplate sets the field in the Quirk client that
// uses a progress bar to show the nodes being inserted with multi
// node sets.
func WithTemplate(tmpl string) ClientConfiguration {
return func(c *Client) {
c.template = tmpl
}
}
// WithMaxWorkerCount will set the maximum workers that will be spun when
// using a Multi operation.
func WithMaxWorkerCount(count int) ClientConfiguration {
return func(c *Client) {
c.maxWorkerCount = count
}
}