filesystem

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CFeature

type CFeature[MakeTypedFeature interface{}] struct {
	feature.CFeature
	CGormDBPathSupport[MakeTypedFeature]

	MountPoints map[string][]*CMountPoint
}

func (*CFeature[MakeTypedFeature]) Exists

func (f *CFeature[MakeTypedFeature]) Exists(path string) (present bool)

func (*CFeature[MakeTypedFeature]) FindPageMatterPath

func (f *CFeature[MakeTypedFeature]) FindPageMatterPath(path string) (realpath string, err error)

func (*CFeature[MakeTypedFeature]) FindPathMountPoint

func (f *CFeature[MakeTypedFeature]) FindPathMountPoint(path string) (mps []*CMountPoint)

func (*CFeature[MakeTypedFeature]) FindPathsWhereContext added in v0.2.2

func (f *CFeature[MakeTypedFeature]) FindPathsWhereContext(path string, orJsonConditions ...map[string]interface{}) (found []string, err error)

func (*CFeature[MakeTypedFeature]) FindPathsWhereContextEquals added in v0.2.2

func (f *CFeature[MakeTypedFeature]) FindPathsWhereContextEquals(path string, conditions map[string]interface{}) (found []string, err error)

func (*CFeature[MakeTypedFeature]) FindPathsWhereContextKeyEquals added in v0.2.2

func (f *CFeature[MakeTypedFeature]) FindPathsWhereContextKeyEquals(path, key string, value interface{}) (found []string, err error)

func (*CFeature[MakeTypedFeature]) FindPathsWithContextKey added in v0.2.2

func (f *CFeature[MakeTypedFeature]) FindPathsWithContextKey(path, key string) (found []string, err error)

func (*CFeature[MakeTypedFeature]) FindReadPageMatter

func (f *CFeature[MakeTypedFeature]) FindReadPageMatter(path string) (pm *matter.PageMatter, err error)

func (*CFeature[MakeTypedFeature]) Init

func (f *CFeature[MakeTypedFeature]) Init(this interface{})

func (*CFeature[MakeTypedFeature]) MountPathROFS

func (f *CFeature[MakeTypedFeature]) MountPathROFS(path, point string, rofs fs.FileSystem)

func (*CFeature[MakeTypedFeature]) MountPathRWFS

func (f *CFeature[MakeTypedFeature]) MountPathRWFS(path, point string, rwfs fs.RWFileSystem)

func (*CFeature[MakeTypedFeature]) ReadPageMatter

func (f *CFeature[MakeTypedFeature]) ReadPageMatter(path string) (pm *matter.PageMatter, err error)

func (*CFeature[MakeTypedFeature]) RemovePageMatter

func (f *CFeature[MakeTypedFeature]) RemovePageMatter(path string) (err error)

func (*CFeature[MakeTypedFeature]) Setup

func (f *CFeature[MakeTypedFeature]) Setup(enjin feature.Internals)

func (*CFeature[MakeTypedFeature]) Startup

func (f *CFeature[MakeTypedFeature]) Startup(ctx *cli.Context) (err error)

func (*CFeature[MakeTypedFeature]) WritePageMatter

func (f *CFeature[MakeTypedFeature]) WritePageMatter(pm *matter.PageMatter) (err error)

type CGormDBPathSupport

type CGormDBPathSupport[MakeTypedFeature interface{}] struct {
}

type CMountPoint

type CMountPoint struct {
	// Path is the actual filesystem path
	Path string
	// Mount is the URL path prefix
	Mount string
	// ROFS is the read-only filesystem, always non-nil
	ROFS fs.FileSystem
	// RWFS is the write-only filesystem, nil when fs is read-only
	RWFS fs.RWFileSystem
}

type EmbedPathSupport

type EmbedPathSupport[MakeTypedFeature interface{}] interface {
}

type Feature

type Feature[MakeTypedFeature interface{}] interface {
	feature.Feature

	// MountPathROFS mounts the given fs.FileSystem path to the virtual URI point
	MountPathROFS(path, point string, rofs fs.FileSystem)

	// MountPathRWFS mounts the given fs.RWFileSystem path to the virtual URI point
	MountPathRWFS(path, point string, rwfs fs.RWFileSystem)

	// FindPathMountPoint returns the available mounts matching the given path.
	// For example if there are mounted points of "/stuff" and "/", calling:
	//
	//   f.FindPathMountPoint("/thing")
	//
	// would return the "/" mounts and calling:
	//
	//   f.FindPathMountPoint("/stuff/thing")
	//
	// would return the "/stuff" mounts
	FindPathMountPoint(path string) (mps []*CMountPoint)

	// Exists returns true if the given URI path is present on any of this
	// feature instance's mounted filesystems (can be a file or directory)
	Exists(path string) (present bool)

	// FindPageMatterPath looks for the actual path by checking for the prefix
	// with each of the enjin provided page format extensions, this allows for
	// finding PageMatter without knowing the page's actual format or language
	// first. Uses FindPathMountPoint on the prefix to find the correct
	// filesystem
	FindPageMatterPath(prefix string) (path string, err error)

	// FindReadPageMatter parses the given path file data into a matter.PageMatter
	// structure, suitable for further processing as page.Page or any other
	// type. The first fs.FileSystem which has the given path is used. The order
	// checked is the order features are added during the main enjin build
	// phase. ReadPageMatter uses FindPageMatterPath to find the matter for
	// reading
	FindReadPageMatter(path string) (pm *matter.PageMatter, err error)

	// ReadPageMatter is like FindReadPageMatter except that it uses the path
	// without using FindPageMatterPath
	ReadPageMatter(path string) (pm *matter.PageMatter, err error)

	// WritePageMatter constructs new file data from the existing pm.Body with
	// pm.Matter (using pm.FrontMatterType) and writes it to the first
	// fs.RWFileSystem that matches the PageMatter's path
	WritePageMatter(pm *matter.PageMatter) (err error)
}

type GormDBPathSupport

type GormDBPathSupport[MakeTypedFeature interface{}] interface {
}

type LocalPathSupport

type LocalPathSupport[MakeTypedFeature interface{}] interface {
}

type MakeFeature

type MakeFeature[MakeTypedFeature interface{}] interface {
	LocalPathSupport[MakeTypedFeature]
	EmbedPathSupport[MakeTypedFeature]
	ZipPathSupport[MakeTypedFeature]
	GormDBPathSupport[MakeTypedFeature]
}

type ZipPathSupport

type ZipPathSupport[MakeTypedFeature interface{}] interface {
}

Jump to

Keyboard shortcuts

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