mysql

package
v0.0.0-...-5802de0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQL

type MySQL struct {
	// contains filtered or unexported fields
}

MySQL ...

func NewMySQLStore

func NewMySQLStore(connection string) (*MySQL, error)

NewMySQLStore creates an instance of MySQLStore with the given connection string.

func (*MySQL) CreateSchema

func (m *MySQL) CreateSchema()

CreateSchema bootstraps the initial database schema.

func (*MySQL) GetNodes

func (m *MySQL) GetNodes() ([]*graph.Node, error)

GetNodes returns all the nodes. Intrensic info of a node is persisted in 'nodes' table. And the parent child relation is persisted in 'parents' table. First fetch all the info of the nodes. Then fetch all the info of parent child relation. Create child list for each node from that parent child relation. Return error at any point and avoid transaction.

func (*MySQL) InsertNode

func (m *MySQL) InsertNode(node *graph.Node) error

InsertNode creates a graph node with it's parent child relationship into the datastore. Operations are done within a transaction to maintain data consistency.

func (*MySQL) UpdateParent

func (m *MySQL) UpdateParent(curNode, targetNode *graph.Node) error

UpdateParent changes parent of 'curNode' to the 'targetNode'. If root is given as curNode an error is returned. It also updates the parent child relationship within a transaction.

Jump to

Keyboard shortcuts

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