dump

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "dump <graph>",
	Short: "Dump vertices/edges from 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
		}

		if vertexDump {
			q := gripql.V()
			elems, err := conn.Traversal(&gripql.GraphQuery{Graph: graph, Query: q.Statements})
			if err != nil {
				return err
			}
			for v := range elems {
				txt, err := protojson.Marshal(v.GetVertex())
				if err != nil {
					return err
				}
				fmt.Printf("%s\n", string(txt))
			}
		}

		if edgeDump {
			q := gripql.E()
			elems, err := conn.Traversal(&gripql.GraphQuery{Graph: graph, Query: q.Statements})
			if err != nil {
				return err
			}
			for v := range elems {
				txt, err := protojson.Marshal(v.GetEdge())
				if err != nil {
					return err
				}
				fmt.Printf("%s\n", string(txt))
			}
		}

		return nil
	},
}

Cmd command 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