-
Notifications
You must be signed in to change notification settings - Fork 2
/
options.go
42 lines (37 loc) · 1.21 KB
/
options.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
41
42
package gocql
import (
"time"
"github.com/americanas-go/ignite"
)
// Options represents gocql options.
type Options struct {
Hosts []string
Port int
DC string `config:"dc"`
Username string
Password string
CQLVersion string `config:"CQLVersion"`
ProtoVersion int
Timeout time.Duration
ConnectTimeout time.Duration
Keyspace string
NumConns int
Consistency string
SocketKeepalive time.Duration
MaxPreparedStmts int
MaxRoutingKeyInfo int
PageSize int
DefaultTimestamp bool
ReconnectInterval time.Duration
MaxWaitSchemaAgreement time.Duration
DisableInitialHostLookup bool
WriteCoalesceWaitTime time.Duration
}
// NewOptions returns options from config file or environment vars.
func NewOptions() (*Options, error) {
return ignite.NewOptionsWithPath[Options](root)
}
// NewOptionsWithPath unmarshals a given key path into options and returns it.
func NewOptionsWithPath(path string) (opts *Options, err error) {
return ignite.NewOptionsWithPath[Options](root, path)
}