store

package
v0.0.0-...-d530cd0 Latest Latest
Warning

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

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

Documentation

Overview

the node_store creates and implements various methods to store and retrieve nodes. it's setup to be an interface so that it can be easily swapped out with other implementations as darwin grows

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalStore

type LocalStore struct {
	// Path is the path to the local store
	Path string `json:"path"`
}

func (*LocalStore) Delete

func (s *LocalStore) Delete(n *node.Node) error

Delete deletes a node from the store

func (*LocalStore) Load

func (s *LocalStore) Load(id uuid.UUID) (*node.Node, error)

Load loads a node from the store

func (*LocalStore) LoadAll

func (s *LocalStore) LoadAll() (map[uuid.UUID]*node.Node, error)

LoadAll searches the Path for all nodes that follow the *.yaml format and them loads them into a slice of nodes

func (*LocalStore) NodePath

func (s *LocalStore) NodePath(n *node.Node) string

NodePath returns the path to the node file

func (*LocalStore) Save

func (s *LocalStore) Save(n *node.Node) error

Save saves a node to the store

type Store

type Store interface {
	// Save saves a node to its store
	Save(*node.Node) error
	// Load loads a node from its store
	Load(uuid.UUID) (*node.Node, error)
	// LoadAll loads all the nodes from its store
	LoadAll() (map[uuid.UUID]*node.Node, error)
	// Delete deletes a node from its store
	Delete(*node.Node) error
}

The NodeStore interface defines the methods that a node object will use to store, edit and retrieve nodes.

Jump to

Keyboard shortcuts

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