Documentation ¶
Index ¶
- Constants
- func FormatLimitOffset(limit, offset int) string
- func StringPtr(s string) *string
- type DB
- type EdgeService
- func (es *EdgeService) CreateEdge(ctx context.Context, graphUID string, e *api.Edge) error
- func (es *EdgeService) DeleteEdge(ctx context.Context, graphUID, edgeUID string) error
- func (es *EdgeService) DeleteEdgeBetween(ctx context.Context, graphUID, source, target string) error
- func (es *EdgeService) FindEdgeByUID(ctx context.Context, graphUID, edgeUID string) (*api.Edge, error)
- func (es *EdgeService) FindEdges(ctx context.Context, graphUID string, filter api.EdgeFilter) ([]*api.Edge, int, error)
- func (es *EdgeService) UpdateEdgeBetween(ctx context.Context, graphUID, source, target string, update api.EdgeUpdate) (*api.Edge, error)
- type GraphService
- func (gs *GraphService) CreateGraph(ctx context.Context, g *api.Graph) error
- func (gs *GraphService) DeleteGraph(ctx context.Context, uid string) error
- func (gs *GraphService) FindGraphByUID(ctx context.Context, uid string) (*api.Graph, error)
- func (gs *GraphService) FindGraphs(ctx context.Context, filter api.GraphFilter) ([]*api.Graph, int, error)
- func (gs *GraphService) UpdateGraph(ctx context.Context, uid string, update api.GraphUpdate) (*api.Graph, error)
- type NodeService
- func (ns *NodeService) CreateNode(ctx context.Context, graphUID string, n *api.Node) error
- func (ns *NodeService) DeleteNodeByID(ctx context.Context, graphUID string, id int64) error
- func (ns *NodeService) DeleteNodeByUID(ctx context.Context, graphUID, nodeUID string) error
- func (ns *NodeService) FindNodeByID(ctx context.Context, graphUID string, id int64) (*api.Node, error)
- func (ns *NodeService) FindNodeByUID(ctx context.Context, graphUID, nodeUID string) (*api.Node, error)
- func (ns *NodeService) FindNodes(ctx context.Context, graphUID string, filter api.NodeFilter) ([]*api.Node, int, error)
- func (ns *NodeService) UpdateNode(ctx context.Context, graphUID string, id int64, update api.NodeUpdate) (*api.Node, error)
- type NullTime
- type Tx
Constants ¶
const ( // MemoryDSN is the in-memory data source name. MemoryDSN = "sqlite://:memory:" // Migrations is the file path glob for migrations. Migrations = "schema/*.sql" // Scehem is required sqlite scheme Scheme = "sqlite" )
Variables ¶
This section is empty.
Functions ¶
func FormatLimitOffset ¶
FormatLimitOffset returns a SQL string for a given limit & offset. Clauses are only added if limit and/or offset are greater than zero.
Types ¶
type DB ¶
type DB struct { // Datasource name. DSN string // contains filtered or unexported fields }
DB represents the database connection.
type EdgeService ¶
type EdgeService struct {
// contains filtered or unexported fields
}
EdgeService lets you manage edges.
func NewEdgeService ¶
func NewEdgeService(db *DB) (*EdgeService, error)
NewEdgeService creates an instance of EdgeService and returns it.
func (*EdgeService) CreateEdge ¶
CreateEdge creates a new edge.
func (*EdgeService) DeleteEdge ¶
func (es *EdgeService) DeleteEdge(ctx context.Context, graphUID, edgeUID string) error
DeleteEdge permanently removes an edge by UID.
func (*EdgeService) DeleteEdgeBetween ¶
func (es *EdgeService) DeleteEdgeBetween(ctx context.Context, graphUID, source, target string) error
DeleteEdgeBetween permanently deletes all edges between two nodes.
func (*EdgeService) FindEdgeByUID ¶
func (es *EdgeService) FindEdgeByUID(ctx context.Context, graphUID, edgeUID string) (*api.Edge, error)
FindEdgeByUID returns a single edge with the given uid.
func (*EdgeService) FindEdges ¶
func (es *EdgeService) FindEdges(ctx context.Context, graphUID string, filter api.EdgeFilter) ([]*api.Edge, int, error)
FindEdges returns all edges matching the filter.
func (*EdgeService) UpdateEdgeBetween ¶
func (es *EdgeService) UpdateEdgeBetween(ctx context.Context, graphUID, source, target string, update api.EdgeUpdate) (*api.Edge, error)
UpdateEdgeBetween updates an edge between two nodes.
type GraphService ¶
type GraphService struct {
// contains filtered or unexported fields
}
GraphService lets you manage graphs.
func NewGraphService ¶
func NewGraphService(db *DB) (*GraphService, error)
NewGraphService creates an instance of GraphService and returns it.
func (*GraphService) CreateGraph ¶
CreateGraph creates a new graph.
func (*GraphService) DeleteGraph ¶
func (gs *GraphService) DeleteGraph(ctx context.Context, uid string) error
DeleteGraph permanently removes a graph by ID.
func (*GraphService) FindGraphByUID ¶
FindGraphByUID returns a single graph with the given uid.
func (*GraphService) FindGraphs ¶
func (gs *GraphService) FindGraphs(ctx context.Context, filter api.GraphFilter) ([]*api.Graph, int, error)
FindGraphs returns all graphs matching the filter. It also returns a count of total matching graphs which may differ from the number of returned graphs if the Limit field is set.
func (*GraphService) UpdateGraph ¶
func (gs *GraphService) UpdateGraph(ctx context.Context, uid string, update api.GraphUpdate) (*api.Graph, error)
UpdateGraph updates an existing graph by ID.
type NodeService ¶
type NodeService struct {
// contains filtered or unexported fields
}
NodeService lets you manage graphs.
func NewNodeService ¶
func NewNodeService(db *DB) (*NodeService, error)
NewNodeService creates an instance of NodeService and returns it.
func (*NodeService) CreateNode ¶
CreateNode creates a new node.
func (*NodeService) DeleteNodeByID ¶
DeleteNodeByID permanently removes a node by ID. It automatically removes removed node's incoming and outgoing edges.
func (*NodeService) DeleteNodeByUID ¶
func (ns *NodeService) DeleteNodeByUID(ctx context.Context, graphUID, nodeUID string) error
DeleteNodeByUID permanently removes a node by UID. It automatically removes removed node's incoming and outgoing edges.
func (*NodeService) FindNodeByID ¶
func (ns *NodeService) FindNodeByID(ctx context.Context, graphUID string, id int64) (*api.Node, error)
FindNodeByUID returns a single node with the given uid.
func (*NodeService) FindNodeByUID ¶
func (ns *NodeService) FindNodeByUID(ctx context.Context, graphUID, nodeUID string) (*api.Node, error)
FindNodeByUID returns a single node with the given uid.
func (*NodeService) FindNodes ¶
func (ns *NodeService) FindNodes(ctx context.Context, graphUID string, filter api.NodeFilter) ([]*api.Node, int, error)
FindNodes returns all nodes matching the filter. It also returns a count of total matching nodes which may differ from the number of returned nodes if the Limit field is set.
func (*NodeService) UpdateNode ¶
func (ns *NodeService) UpdateNode(ctx context.Context, graphUID string, id int64, update api.NodeUpdate) (*api.Node, error)
UpdateNode updates an existing node by ID.