v1beta

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertGraphData

func ConvertGraphData(item *GraphData) (*graphstore.Node, *graphstore.Edge, error)

ConvertGraphData transforms itself back into a node or an edge

Types

type Driver

type Driver interface {
	Put(ctx context.Context, data []*GraphData) error
	Delete(ctx context.Context, data []*GraphData) error
	List(ctx context.Context, kind string, offset, limit int) ([]*GraphData, bool, error)
	NeighborsTo(ctx context.Context, toKeys []string) ([]*GraphData, error)
	NeighborsFrom(ctx context.Context, fromKeys []string) ([]*GraphData, error)
}

Driver represents a generic interface for storing a graph.

func NewSQLDriver

func NewSQLDriver(rwdb, rodb *sqlx.DB, statements *core.Statements) Driver

type Encoding

type Encoding = uint8

Encoding describes how the data is stored

const (
	// EncodingUnspecified signals the data format was not specified.
	EncodingUnspecified Encoding = iota
	// EncodingJSON stores the data as JSON.
	EncodingJSON
	// EncodingProtocolBuffers stores the data as encoded protocol buffers.
	EncodingProtocolBuffers
)

type GraphData

type GraphData struct {
	K1           string        `json:"k1"           db:"k1"            gorm:"column:k1;type:varchar(64);primaryKey;index:secondary,priority:2"`
	K2           string        `json:"k2"           db:"k2"            gorm:"column:k2;type:varchar(64);primaryKey;index:secondary,priority:1"`
	K3           string        `json:"k3"           db:"k3"            gorm:"column:k3;type:varchar(64);primaryKey;index:secondary,priority:3"`
	Kind         string        `json:"kind"         db:"kind"          gorm:"column:kind;type:varchar(255);index:kind"`
	Encoding     Encoding      `json:"encoding"     db:"encoding"      gorm:"column:encoding"`
	Data         string        `json:"data"         db:"data"          gorm:"column:data;type:text"`
	DateDeleted  *sql.NullTime `json:"dateDeleted"  db:"date_deleted"  gorm:"column:date_deleted;index:date_deleted"`
	LastModified time.Time     `json:"lastModified" db:"last_modified" gorm:"column:last_modified;index:last_modified"`
}

GraphData describes how the data is stored

func ConvertEdge

func ConvertEdge(edge *graphstore.Edge, encoding Encoding) *GraphData

ConvertEdge transforms an Edge to a generalized graph item

func ConvertNode

func ConvertNode(node *graphstore.Node, encoding Encoding) *GraphData

ConvertNode transforms a Node to a generalized graph item

func (*GraphData) TableName

func (d *GraphData) TableName() string

TableName returns the name of the collection or the default if not set.

type GraphStoreServer

type GraphStoreServer struct {
	graphstore.UnsafeGraphStoreServer

	Driver Driver
}

GraphStoreServer encapsulates the logic for storing a graph using a generic driver.

func (*GraphStoreServer) Delete

Delete ...

func (*GraphStoreServer) List

List ...

func (*GraphStoreServer) Neighbors

Neighbors ...

func (*GraphStoreServer) Put

Put ...

func (*GraphStoreServer) Traverse

func (s *GraphStoreServer) Traverse(traverseServer graphstore.GraphStore_TraverseServer) error

Traverse ...

Jump to

Keyboard shortcuts

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