graph

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Broadcast = &cobra.Command{
	Use:     "broadcast",
	Short:   "graphikDB broadcast operations",
	Example: `graphikctl broadcast --channel testing --data '{"text": "testing!"}'`,
	Run: func(cmd *cobra.Command, args []string) {
		ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
		defer cancel()
		client, err := helpers.GetClient(ctx)
		if err != nil {
			fmt.Println(err.Error())
			return
		}
		var attributeMap = map[string]interface{}{}
		err = json.Unmarshal([]byte(attributes), &attributeMap)
		if err != nil {
			fmt.Println(err.Error())
			return
		}
		if err := client.Broadcast(ctx, &apipb.OutboundMessage{
			Channel: channel,
			Data:    apipb.NewStruct(attributeMap),
		}); err != nil {
			fmt.Println(err.Error())
			return
		}
	},
}
View Source
var Create = &cobra.Command{
	Use:   "create",
	Short: "graphikDB create operations (doc, connection)",
}
View Source
var Edit = &cobra.Command{
	Use:   "edit",
	Short: "graphikDB edit operations (doc, connection)",
}
View Source
var Get = &cobra.Command{
	Use:   "get",
	Short: "graphikDB get operations (doc, connection, schema)",
}
View Source
var Put = &cobra.Command{
	Use:   "put",
	Short: "graphikDB put operations (doc, connection)",
}
View Source
var Search = &cobra.Command{
	Use:   "search",
	Short: "graphikDB search operations  (docs, connections)",
}
View Source
var Stream = &cobra.Command{
	Use:     "stream",
	Short:   "graphikDB stream operations",
	Example: `graphikctl stream --channel testing --expression "has(this.data.text)"`,
	Run: func(cmd *cobra.Command, args []string) {
		client, err := helpers.GetClient(context.Background())
		if err != nil {
			fmt.Println(err.Error())
			return
		}
		if err := client.Stream(context.Background(), &apipb.StreamFilter{
			Channel:    channel,
			Expression: expression,
		}, func(msg *apipb.Message) bool {
			fmt.Println(protojson.Format(msg))
			return true
		}); err != nil {
			fmt.Println(err.Error())
			return
		}
	},
}
View Source
var Traverse = &cobra.Command{
	Use:   "traverse",
	Short: "graphikDB traversal operations",
	Run: func(cmd *cobra.Command, args []string) {
		ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
		defer cancel()
		client, err := helpers.GetClient(ctx)
		if err != nil {
			fmt.Println(err.Error())
			return
		}
		resp, err := client.Traverse(ctx, &apipb.TraverseFilter{
			Root: &apipb.Ref{
				Gtype: gtype,
				Gid:   gid,
			},
			DocExpression:        docExpression,
			ConnectionExpression: connectionExpression,
			Limit:                uint64(limit),
			Sort:                 sort,
			Reverse:              reverse,
			Algorithm:            apipb.Algorithm(apipb.Algorithm_value[algorithm]),
			MaxDepth:             uint64(maxDepth),
			MaxHops:              uint64(maxHops),
		})
		if err != nil {
			fmt.Println(err.Error())
			return
		}
		fmt.Println(protojson.Format(resp))
	},
}
View Source
var TraverseMe = &cobra.Command{
	Use:   "traverseMe",
	Short: "graphikDB traversal(me) operations",
	Run: func(cmd *cobra.Command, args []string) {
		ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
		defer cancel()
		client, err := helpers.GetClient(ctx)
		if err != nil {
			fmt.Println(err.Error())
			return
		}
		resp, err := client.TraverseMe(ctx, &apipb.TraverseMeFilter{
			DocExpression:        docExpression,
			ConnectionExpression: connectionExpression,
			Limit:                uint64(limit),
			Sort:                 sort,
			Reverse:              reverse,
			Algorithm:            apipb.Algorithm(apipb.Algorithm_value[algorithm]),
			MaxDepth:             uint64(maxDepth),
			MaxHops:              uint64(maxHops),
		})
		if err != nil {
			fmt.Println(err.Error())
			return
		}
		fmt.Println(protojson.Format(resp))
	},
}

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