appflag

package
v0.43.3-0...-9926edd Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package appflag contains functionality to work with flags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder interface {
	BindRoot(flagSet *pflag.FlagSet)
	NewRunFunc(func(context.Context, Container) error, ...Interceptor) func(context.Context, app.Container) error
}

Builder builds run functions.

func NewBuilder

func NewBuilder(appName string, options ...BuilderOption) Builder

NewBuilder returns a new Builder.

type BuilderOption

type BuilderOption func(*builder)

BuilderOption is an option for a new Builder

func BuilderWithTimeout

func BuilderWithTimeout(defaultTimeout time.Duration) BuilderOption

BuilderWithTimeout returns a new BuilderOption that adds a timeout flag and the default timeout.

func BuilderWithTracing

func BuilderWithTracing() BuilderOption

BuilderWithTracing enables zap tracing for the builder.

type Container

type Container interface {
	app.Container
	appname.Container
	applog.Container
}

Container is a container.

type Interceptor

type Interceptor func(func(context.Context, Container) error) func(context.Context, Container) error

Interceptor intercepts and adapts the request or response of run functions.

Jump to

Keyboard shortcuts

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