MCPcopy
hub / github.com/dgraph-io/dgraph / init

Function init

dgraph/cmd/increment/increment.go:32–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30var Increment x.SubCommand
31
32func init() {
33 Increment.Cmd = &cobra.Command{
34 Use: "increment",
35 Short: "Increment a counter transactionally",
36 Run: func(cmd *cobra.Command, args []string) {
37 run(Increment.Conf)
38 },
39 Annotations: map[string]string{"group": "tool"},
40 }
41 Increment.EnvPrefix = "DGRAPH_INCREMENT"
42 Increment.Cmd.SetHelpTemplate(x.NonRootTemplate)
43
44 flag := Increment.Cmd.Flags()
45 // --tls SuperFlag
46 x.RegisterClientTLSFlags(flag)
47
48 flag.String("cloud", "", "addr=xxx; jwt=yyy")
49 flag.String("alpha", "localhost:9080", "Address of Dgraph Alpha.")
50 flag.Int("num", 1, "How many times to run per goroutine.")
51 flag.Int("retries", 10, "How many times to retry setting up the connection.")
52 flag.Duration("wait", 0*time.Second, "How long to wait.")
53 flag.Int("conc", 1, "How many goroutines to run.")
54
55 flag.String("creds", "",
56 `Various login credentials if login is required.
57 user defines the username to login.
58 password defines the password of the user.
59 namespace defines the namespace to log into.
60 Sample flag could look like --creds user=username;password=mypass;namespace=2`)
61
62 flag.String("pred", "counter.val",
63 "Predicate to use for storing the counter.")
64 flag.Bool("ro", false,
65 "Read-only. Read the counter value without updating it.")
66 flag.Bool("be", false,
67 "Best-effort. Read counter value without retrieving timestamp from Zero.")
68 flag.String("jaeger", "", "Send opencensus traces to Jaeger.")
69}
70
71// Counter stores information about the value being incremented by this tool.
72type Counter struct {

Callers

nothing calls this directly

Calls 3

RegisterClientTLSFlagsFunction · 0.92
runFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected