adapters

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryLoader

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

InMemoryLoader is a simple implementation of ports.GraphLoader for testing.

func NewInMemoryLoader

func NewInMemoryLoader() *InMemoryLoader

NewInMemoryLoader creates a new empty loader.

func (*InMemoryLoader) AddNode

func (l *InMemoryLoader) AddNode(id string, data []byte)

AddNode allows pre-populating the loader for tests.

func (*InMemoryLoader) GetNode

func (l *InMemoryLoader) GetNode(id string) ([]byte, error)

GetNode retrieves a node from memory.

func (*InMemoryLoader) ListNodes added in v0.3.0

func (l *InMemoryLoader) ListNodes() ([]string, error)

ListNodes lists all node IDs in memory.

type LoaderTransition added in v0.3.0

type LoaderTransition struct {
	From      string `json:"from" mapstructure:"from"`
	FromFull  string `json:"from_node_id" mapstructure:"from_node_id"`
	To        string `json:"to" mapstructure:"to"`
	ToFull    string `json:"to_node_id" mapstructure:"to_node_id"`
	Condition string `json:"condition" mapstructure:"condition"`
}

type LoamLoader

type LoamLoader struct {
	Repo *loam.TypedRepository[NodeMetadata]
}

LoamLoader adapts the Loam library to the Trellis GraphLoader interface.

func NewLoamLoader

func NewLoamLoader(repo *loam.TypedRepository[NodeMetadata]) *LoamLoader

NewLoamLoader creates a new Loam adapter.

func (*LoamLoader) GetNode

func (l *LoamLoader) GetNode(id string) ([]byte, error)

GetNode retrieves a node from the Loam repository using the direct Service API. Note: Loam Service.GetDocument is a direct convenience lookup.

func (*LoamLoader) ListNodes added in v0.3.0

func (l *LoamLoader) ListNodes() ([]string, error)

ListNodes lists all nodes in the repository.

type NodeMetadata

type NodeMetadata struct {
	ID          string             `json:"id" mapstructure:"id"`
	Type        string             `json:"type" mapstructure:"type"`
	Transitions []LoaderTransition `json:"transitions" mapstructure:"transitions"`
}

NodeMetadata represents the header/metadata of a Trellis Node. It uses "mapstructure" tags to match standard Frontmatter/YAML keys (to, from).

Jump to

Keyboard shortcuts

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