-
-
Notifications
You must be signed in to change notification settings - Fork 178
/
Copy pathrethinkdb.go
50 lines (42 loc) · 1.45 KB
/
rethinkdb.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
43
44
45
46
47
48
49
50
package rethinkdb
import (
"log/slog"
"reflect"
"gopkg.in/rethinkdb/rethinkdb-go.v6/encoding"
)
const (
SystemDatabase = "rethinkdb"
TableConfigSystemTable = "table_config"
ServerConfigSystemTable = "server_config"
DBConfigSystemTable = "db_config"
ClusterConfigSystemTable = "cluster_config"
TableStatusSystemTable = "table_status"
ServerStatusSystemTable = "server_status"
CurrentIssuesSystemTable = "current_issues"
UsersSystemTable = "users"
PermissionsSystemTable = "permissions"
JobsSystemTable = "jobs"
StatsSystemTable = "stats"
LogsSystemTable = "logs"
)
func init() {
// Set encoding package
encoding.IgnoreType(reflect.TypeOf(Term{}))
}
// SetTags allows you to override the tags used when decoding or encoding
// structs. The driver will check for the tags in the same order that they were
// passed into this function. If no parameters are passed then the driver will
// default to checking for the rethinkdb tag (the rethinkdb tag is always included)
// Old-style gorethink tag is also supported but deprecated
func SetTags(tags ...string) {
encoding.Tags = append(tags, encoding.TagName, encoding.OldTagName)
}
// SetVerbose allows the driver logging level to be set. If true is passed then
// the log level is set to Debug otherwise it defaults to Info.
func SetVerbose(verbose bool) {
if verbose {
slog.SetLogLoggerLevel(slog.LevelDebug)
return
}
slog.SetLogLoggerLevel(slog.LevelInfo)
}