app

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package app implements grit's business logic layer.

Index

Constants

View Source
const (
	AppName = "grit"
)

Variables

View Source
var (
	Version = "development" // overwritten on build
)

Functions

This section is empty.

Types

type App

type App struct {
	Database *db.Database
}

func New

func New() (*App, error)

func (*App) AddChild

func (a *App) AddChild(name string, parent interface{}) (*multitree.Node, error)

AddChild creates a new node and links an existing node to it. A parent d-node is implicitly created, if it doesn't already exist.

func (*App) AddChildTree added in v0.3.0

func (a *App) AddChildTree(tree *multitree.Node, parent interface{}) (int64, error)

AddChildTree creates a new tree and links parent to its root. It returns the root ID.

func (*App) AddRoot

func (a *App) AddRoot(name string) (*multitree.Node, error)

AddNode creates a root and returns it as a member of its multitree.

func (*App) AddRootTree added in v0.3.0

func (a *App) AddRootTree(tree *multitree.Node) (int64, error)

AddRootTree creates a new tree at the root level. It returns the root ID.

func (*App) CheckNode

func (a *App) CheckNode(selector interface{}) error

func (*App) Close

func (a *App) Close()

func (*App) GetDateNodes

func (a *App) GetDateNodes() ([]*multitree.Node, error)

func (*App) GetGraph

func (a *App) GetGraph(selector interface{}) (*multitree.Node, error)

func (*App) GetNode

func (a *App) GetNode(selector interface{}) (*multitree.Node, error)

func (*App) GetNodeByAlias

func (a *App) GetNodeByAlias(alias string) (*multitree.Node, error)

func (*App) GetNodeByName

func (a *App) GetNodeByName(name string) (*multitree.Node, error)

func (*App) GetRoots

func (a *App) GetRoots() ([]*multitree.Node, error)

func (*App) LinkNodes

func (a *App) LinkNodes(origin, dest interface{}) (*multitree.Link, error)

LinkNodes creates a new link connecting two nodes. D-nodes are implicitly created as needed.

func (*App) RemoveNode

func (a *App) RemoveNode(selector interface{}) ([]*multitree.Node, error)

RemoveNode deletes the node and returns its orphaned children.

func (*App) RemoveNodeRecursive

func (a *App) RemoveNodeRecursive(selector interface{}) ([]*multitree.Node, error)

RemoveNodeRecursive deletes the node and all its tree descendants. Nodes that have multiple parents are only unlinked from the current tree.

func (*App) RenameNode

func (a *App) RenameNode(selector interface{}, name string) error

func (*App) SetAlias

func (a *App) SetAlias(id int64, alias string) error

func (*App) UncheckNode

func (a *App) UncheckNode(selector interface{}) error

func (*App) UnlinkNodes

func (a *App) UnlinkNodes(origin, dest interface{}) error

UnlinkNodes removes the link connecting the given nodes.

type AppError

type AppError struct {
	Msg  string
	Code ErrCode
}

func NewError

func NewError(code ErrCode, msg string) *AppError

func (*AppError) Error

func (e *AppError) Error() string

type ErrCode

type ErrCode int
const (
	ErrNotFound ErrCode = iota
	ErrForbidden
	ErrInvalidSelector
	ErrInvalidName
)

Jump to

Keyboard shortcuts

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