info

package
v0.0.0-...-fa720cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "info <graph>",
	Short: "Print vertex/edge counts for a graph",
	Long:  ``,
	Args:  cobra.ExactArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {
		graph := args[0]

		conn, err := gripql.Connect(rpc.ConfigWithDefaults(host), true)
		if err != nil {
			return err
		}

		fmt.Printf("Graph: %s\n", graph)

		q := gripql.V().Count()
		res, err := conn.Traversal(&gripql.GraphQuery{Graph: graph, Query: q.Statements})
		if err != nil {
			return err
		}
		for row := range res {
			fmt.Printf("Vertex Count: %v\n", row.GetCount())
		}

		q = gripql.E().Count()
		res, err = conn.Traversal(&gripql.GraphQuery{Graph: graph, Query: q.Statements})
		if err != nil {
			return err
		}
		for row := range res {
			fmt.Printf("Edge Count: %v\n", row.GetCount())
		}

		return nil
	},
}

Cmd line declaration

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL