goxr

package module
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AllowFallbackToFsBox could easily set while build time using:
	// go build -ldflags="-X github.com/echocat/goxr.AllowFallbackToFsBox=false" .
	// This is useful in case for behave differently for build versions of you application
	AllowFallbackToFsBox                       = true
	OnFallbackToFsBox    OnFallbackToFsBoxFunc = OnFallbackToFsBox_Default

	ErrBoxIterationNotSupported = errors.New("box iteration not supported")
)
View Source
var OnFallbackToFsBox_Default = func(packedBoxCandidateFilename string, bases []string, fsBox Box) error {
	if AllowFallbackToFsBox {
		return OnFallbackToFsBox_Warn(packedBoxCandidateFilename, bases, fsBox)
	}
	return OnFallbackToFsBox_Fail(packedBoxCandidateFilename, bases, fsBox)
}

noinspection GoSnakeCaseUsage

View Source
var OnFallbackToFsBox_Fail = func(packedBoxCandidateFilename string, bases []string, fsBox Box) error {
	return common.NewPathError("openBox", packedBoxCandidateFilename, common.ErrDoesNotContainBox)
}

noinspection GoSnakeCaseUsage

View Source
var OnFallbackToFsBox_Warn = func(packedBoxCandidateFilename string, bases []string, fsBox Box) error {
	log.With("candidate", packedBoxCandidateFilename).
		Warn("Candidate does not contain a packed box version. This could happen in development mode.")
	return nil
}

noinspection GoSnakeCaseUsage

Functions

This section is empty.

Types

type Box

type Box interface {
	io.Closer
	Open(name string) (common.File, error)
	Info(pathname string) (common.FileInfo, error)
}

func OpenBox

func OpenBox(base ...string) (Box, error)

func OpenBoxBy

func OpenBoxBy(packedBoxCandidateFilename string, base ...string) (Box, error)

func OpenPackedBox

func OpenPackedBox() (Box, error)

type CombinedBox

type CombinedBox []Box

func (CombinedBox) Close

func (instance CombinedBox) Close() error

func (CombinedBox) ForEach added in v0.6.0

func (instance CombinedBox) ForEach(predicate common.FilePredicate, callback func(common.FileInfo) error) error

func (CombinedBox) Info

func (instance CombinedBox) Info(name string) (common.FileInfo, error)

func (CombinedBox) Open

func (instance CombinedBox) Open(name string) (common.File, error)

func (CombinedBox) With

func (instance CombinedBox) With(box Box) CombinedBox

type Iterable added in v0.6.0

type Iterable interface {
	ForEach(common.FilePredicate, func(common.FileInfo) error) error
}

type OnFallbackToFsBoxFunc

type OnFallbackToFsBoxFunc func(packedBoxCandidateFilename string, bases []string, fsBox Box) error

Directories

Path Synopsis
box
fs

Jump to

Keyboard shortcuts

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