-
Notifications
You must be signed in to change notification settings - Fork 1
/
constant.go
69 lines (60 loc) · 2.2 KB
/
constant.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package quirk
// error messages.
const (
msgTooManyMutationFields = "Too many fields filled in QuirkMutation"
msgTransactionFailure = "Transaction failure"
msgInvalidSchemaRead = "Invalid schema caused reading error"
msgTooManyResponses = "Too many responses from query for unique nodes"
msgMutationHadNoUID = "UID was not found in the mutation response"
msgBuilderWriting = "invalid pred[%#v] or val[%#v]"
msgNilUID = "*string was nil in response"
)
// defaults.
const (
// templateDefault is used as a default setup for the Quirk progress bar.
// Note: This can be changed when setting up the client WithTemplate()
templateDefault = `{{ cyan "Inserting Nodes:" }} {{counters .}} {{ bar . "[" "=" (cycle . ">" ) " " "]"}} [{{etime . | cyan }}:{{rtime . | cyan }}] {{percent .}}`
// maxWorkers is used as a default for the maximum concurrent insert workers
// that are allowed to run when using a Multi operation.
maxWorkers = 50
// blank identifier default.
// This is used when the data given doesn't contain any
// set predicate key in the Quirk client.
blankDefault = "data"
// used as the default identifier when inserting a node.
// Any node that is inserted with Quirk should have this.
predicateKeyDefault = "name"
)
const tagUnique tagOptions = "unique"
// rdf related constants for building the mutation.
const (
rdfBase = "%s <%s> \"%v\""
rdfReference = "%s <%s> <%v>"
rdfEnd = " .\n"
)
const (
// quirkTag is for identifying a structure tag.
// Example:
// type MyStruct struct {
// field string `quirk:"field"`
// }
quirkTag = "quirk"
// Used to see if the query building process returned an empty query.
emptyQuery = "{}"
// The beginning of the GraphQL+ query function signature.
queryfunc = "%s(func: eq(%s, %q), first: 1){uid}\n"
)
const (
// xsInit is used to indicate to Dgraph that we are explicitly
// using a certain datatype in the RDF.
xsInit = "^^"
// XML Datatypes.
xsInt = xsInit + "<xs:int>"
xsBool = xsInit + "<xs:boolean>"
xsFloat = xsInit + "<xs:float>"
// unused at the moment.
xsString = xsInit + "<xs:string>"
xsDateTime = xsInit + "<xs:date>"
// notifier to fix byte slice.
xsByte = xsInit + "<xs:byte>"
)