content

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: LGPL-3.0 Imports: 2 Imported by: 4

Documentation

Overview

contains data structures that describe content in a repository

Index

Constants

View Source
const (
	// Indent for json indentation
	Indent string = "\t"
	// PathSeparator separator for paths in URIs
	PathSeparator = "/"
)
View Source
const (
	// StatusOk we found content
	StatusOk Status = 200
	// StatusForbidden we found content but you mst not access it
	StatusForbidden = 403
	// StatusNotFound we did not find content
	StatusNotFound = 404
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	ID       string                 `json:"id"`
	Name     string                 `json:"name"`
	URI      string                 `json:"URI"`
	MimeType string                 `json:"mimeType"`
	Hidden   bool                   `json:"hidden,omitempty"`
	Data     map[string]interface{} `json:"data"`
	Groups   []string               `json:"groups"`
}

Item on a node in a content tree - "payload" of an item

func NewItem

func NewItem() *Item

NewItem item contructor

type Node

type Node struct {
	Item  *Item            `json:"item"`
	Nodes map[string]*Node `json:"nodes"`
	Index []string         `json:"index"`
}

Node a node in a content tree

func NewNode

func NewNode() *Node

NewNode constructor

type RepoNode

type RepoNode struct {
	ID            string                 `json:"id"`       // unique identifier - it is your responsibility, that they are unique
	MimeType      string                 `json:"mimeType"` // well a mime type http://www.ietf.org/rfc/rfc2046.txt
	LinkID        string                 `json:"linkId"`   // (symbolic) link/alias to another node
	Groups        []string               `json:"groups"`   // which groups have access to the node, if empty everybody has access to it
	URI           string                 `json:"URI"`
	Name          string                 `json:"name"`
	Hidden        bool                   `json:"hidden"`        // hidden in content.nodes, but can still be resolved when being directly addressed
	DestinationID string                 `json:"destinationId"` // if a node does not have any content like a folder the destinationIds can point to nodes that do aka. the first displayable child node
	Data          map[string]interface{} `json:"data"`          // what ever you want to stuff into it - the payload you want to attach to a node
	Nodes         map[string]*RepoNode   `json:"nodes"`         // child nodes
	Index         []string               `json:"index"`         // defines the order of the child nodes
	// contains filtered or unexported fields
}

RepoNode node in a content tree

func (*RepoNode) AddNode

func (node *RepoNode) AddNode(name string, childNode *RepoNode) *RepoNode

AddNode adds a named child node

func (*RepoNode) CanBeAccessedByGroups

func (node *RepoNode) CanBeAccessedByGroups(groups []string) bool

CanBeAccessedByGroups can this node be accessed by at least one the given groups

func (*RepoNode) GetParent

func (node *RepoNode) GetParent() *RepoNode

GetParent get the parent node of a node

func (*RepoNode) GetPath

func (node *RepoNode) GetPath(dataFields []string) []*Item

GetPath get a path for a repo node

func (*RepoNode) InPath

func (node *RepoNode) InPath(path []*Item) bool

InPath is the given node in a path

func (*RepoNode) IsOneOfTheseMimeTypes

func (node *RepoNode) IsOneOfTheseMimeTypes(mimeTypes []string) bool

IsOneOfTheseMimeTypes is the node one of the given mime types

func (*RepoNode) PrintNode

func (node *RepoNode) PrintNode(id string, level int)

PrintNode essentially a recursive dump

func (*RepoNode) ToItem

func (node *RepoNode) ToItem(dataFields []string) *Item

ToItem convert a repo node to a simple repo item

func (*RepoNode) WireParents

func (node *RepoNode) WireParents()

WireParents helper method to reference from child to parent in a tree recursively

type SiteContent

type SiteContent struct {
	Status    Status            `json:"status"`
	URI       string            `json:"URI"`
	Dimension string            `json:"dimension"`
	MimeType  string            `json:"mimeType"`
	Item      *Item             `json:"item"`
	Data      interface{}       `json:"data"`
	Path      []*Item           `json:"path"`
	URIs      map[string]string `json:"URIs"`
	Nodes     map[string]*Node  `json:"nodes"`
}

SiteContent resolved content for a site

func NewSiteContent

func NewSiteContent() *SiteContent

NewSiteContent constructor

type Status

type Status int

Status status type SiteContent respnses

Jump to

Keyboard shortcuts

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