From 88b5e6a24c006452b80334c1c17cb29180662095 Mon Sep 17 00:00:00 2001 From: matthewpeterkort Date: Mon, 30 Oct 2023 13:35:21 -0700 Subject: [PATCH] adds additional gripql/client functions --- gripql/client.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gripql/client.go b/gripql/client.go index 647ab4f1..7fd6c880 100644 --- a/gripql/client.go +++ b/gripql/client.go @@ -53,18 +53,32 @@ func (client Client) GetSchema(graph string) (*Graph, error) { } // SampleSchema asks server to scan data to determine possible schema -func (client Client) SampleSchema(graph string) (*Graph, error) { +func (client Client) SampleSchema(graph string) (*Graph, error) { out, err := client.EditC.SampleSchema(context.Background(), &GraphID{Graph: graph}) return out, err } - // AddSchema adds a schema for a graph. func (client Client) AddSchema(graph *Graph) error { _, err := client.EditC.AddSchema(context.Background(), graph) return err } +func (client Client) DeleteEdge(graph string, id string) error { + _, err := client.EditC.DeleteEdge(context.Background(), &ElementID{Graph: graph, Id: id}) + return err +} + +func (client Client) DeleteVertex(graph string, id string) error { + _, err := client.EditC.DeleteVertex(context.Background(), &ElementID{Graph: graph, Id: id}) + return err +} + +func (client Client) GetEdge(graph string, id string) (*Edge, error) { + e, err := client.QueryC.GetEdge(context.Background(), &ElementID{Graph: graph, Id: id}) + return e, err +} + // GetMaping returns the mapping for the given graph. func (client Client) GetMapping(graph string) (*Graph, error) { return client.QueryC.GetMapping(context.Background(), &GraphID{Graph: graph})