glue

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: MIT Imports: 12 Imported by: 0

README

GoZix Glue

The package represents a very simple and easy implementation of the extensible application on golang. The core components of an application are bundles that are glued together using a dependency injection container.

Built-in Tags

Symbol Value Description
TagCliCommand cli.cmd Add a cli command
TagRootPersistentFlags cli.persistent_flags Add custom flags to root command

Built-in Services

Symbol Value Description
DefCliRoot cli.cmd.root Cli root command
DefCliVersion cli.cmd.version Cli version command
DefContext context Current context
DefRegistry registry A key/value registry

Documentation

Overview

Package glue provide basic functionality.

Index

Constants

View Source
const (
	// DefCliRoot is root command definition name.
	DefCliRoot = "cli.cmd.root"

	// DefCliVersion is version command definition name.
	DefCliVersion = "cli.cmd.version"

	// DefContext is global context definition name.
	DefContext = "context"

	// DefRegistry is registry definition name.
	// Deprecated: use Context instead of Registry. Will be removed in 3.0.
	DefRegistry = "registry"

	// TagCliCommand is tag to mark exported cli commands.
	TagCliCommand = "cli.cmd"

	// TagRootPersistentFlags is tag to mark FlagSet for add to root command persistent flags
	TagRootPersistentFlags = "cli.persistent_flags"
)

Variables

View Source
var ErrNilContext = errors.New("nil context")

ErrNilContext is error triggered when detected nil context in option value.

Functions

This section is empty.

Types

type App

type App interface {
	Execute() error
}

App interface.

func NewApp

func NewApp(options ...Option) (_ App, err error)

NewApp is app constructor.

type Bundle

type Bundle interface {
	Name() string
	Build(builder *di.Builder) error
}

Bundle is an node interface.

type BundleDependsOn

type BundleDependsOn interface {
	Bundle
	DependsOn() []string
}

BundleDependsOn is an node with dependencies interface.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option interface.

func Bundles

func Bundles(bundles ...Bundle) Option

Bundles option.

func Context added in v1.1.0

func Context(ctx context.Context) Option

Context option.

func Scopes

func Scopes(scopes ...string) Option

Scopes option.

func Version

func Version(version string) Option

Version option.

type Registry

type Registry interface {
	Get(name string) interface{}
	Set(name string, value interface{})
	Fill(name string, value interface{}) error
}

Registry interface. Deprecated: use Context instead of Registry. Will be removed in 3.0.

Directories

Path Synopsis
Package mock provide gozix mocks.
Package mock provide gozix mocks.

Jump to

Keyboard shortcuts

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