app

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 3 Imported by: 3

Documentation

Overview

Package app provides functionality for application configurations.

Index

Constants

View Source
const (
	// ErrNoSuchConfig indicates that an application configuration was not found in the store.
	ErrNoSuchConfig = wErr.ErrString("no such configuration")

	// ErrEmptyName indicates that an application name is empty.
	ErrEmptyName = wErr.ErrString("application name is empty")

	// ErrPathNotRelative indicates that an application path is not relative.
	ErrPathNotRelative = wErr.ErrString("path is not relative")

	// ErrNonProjectRootSubDir indicates that an application path is not a subdirectory of the project root directory.
	ErrNonProjectRootSubDir = wErr.ErrString("path is not a subdirectory of the project root directory")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// BaseOutputDir is the base output directory for an application.
	BaseOutputDir string

	// DisplayName is the display name of an application.
	DisplayName string

	// Name is the name of an application.
	Name string

	// PathRel is the relative path to an application root directory.
	PathRel string

	// PkgImportPath is the import path of an application package.
	PkgImportPath string
}

Config holds information and metadata of an application.

type ErrApp

type ErrApp struct {
	// Err is a wrapped error.
	Err error
	// Kind is the error kind.
	Kind error
}

ErrApp represents a application error.

func (*ErrApp) Error

func (e *ErrApp) Error() string

func (*ErrApp) Is

func (e *ErrApp) Is(err error) bool

Is enables usage of errors.Is() to determine the kind of error that occurred.

func (*ErrApp) Unwrap

func (e *ErrApp) Unwrap() error

Unwrap returns the underlying error for usage with errors.Unwrap().

type Store

type Store interface {
	// Add adds a application configuration.
	Add(*Config)

	// Get returns the application configuration for the given name or nil along with an error when not stored.
	Get(string) (*Config, error)
}

Store is a storage that provides methods to record application configurations.

func NewStore

func NewStore() Store

NewStore creates a new store for application configurations.

Jump to

Keyboard shortcuts

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