appcontext

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: MIT Imports: 12 Imported by: 20

Documentation

Index

Constants

View Source
const (
	AppNameKey = iota
	DomainKey
	WebAppURLKey
	LoggerKey
	ProcessusGrabberKey
	SecureIDKey
	WriterKey
	LogLevelKey
	DatabaseKey
)

Variables

This section is empty.

Functions

func AppName added in v0.0.2

func AppName(ctx context.Context) string

func Database

func Database(ctx context.Context) database.Context

func Domain added in v0.0.2

func Domain(ctx context.Context) string

func Level

func Level(ctx context.Context) log.Level

func Logger

func Logger(ctx context.Context) logger.Logger

func OptionArgs

func OptionArgs(args *Options, defaultAppName string)

func SecretOrPassword

func SecretOrPassword(secret string) string

func SecureID added in v0.0.2

func SecureID(ctx context.Context) security.SecureID

func WebAppURL added in v0.0.2

func WebAppURL(ctx context.Context) string

func WithAppName

func WithAppName(ctx context.Context, name string) context.Context

WithAppName returns a context with the Application name set

func WithDatabase

func WithDatabase(ctx context.Context, db database.Context) context.Context

WithDatabase returns a context with the database set

func WithDomain added in v0.0.2

func WithDomain(ctx context.Context, name string) context.Context

WithDomain returns a context with the Domain name set

func WithHasherWorker

func WithHasherWorker(ctx context.Context, options HasherOptions) context.Context

WithHasherWorker returns a context with the password worker set

func WithLogLevel

func WithLogLevel(ctx context.Context, level string) context.Context

WithLogLevel returns a context with the LogLevel set

func WithLogger

func WithLogger(ctx context.Context, database logger.Logger) context.Context

WithLogger returns a context with the log Writer set

func WithOptions

func WithOptions(ctx context.Context, options Options) context.Context

func WithProcessusGrabber added in v0.0.2

func WithProcessusGrabber(ctx context.Context, grabber Worker) context.Context

func WithSecureID added in v0.0.2

func WithSecureID(ctx context.Context, secureID security.SecureID) context.Context

func WithWebAppURL added in v0.0.2

func WithWebAppURL(ctx context.Context, url string) context.Context

WithWebAppUrl returns a context with the WebApplication url set

func WithWriter

func WithWriter(ctx context.Context, writer io.Writer) context.Context

WithWriter returns a context with the log Writer set

Types

type HasherOptions

type HasherOptions struct {
	Time   int
	Memory int
	Thread int

	NumWorker int
}

type Options

type Options struct {
	AppName  string
	LogLevel string

	PasswordHashSeed string
	Hasher           HasherOptions
}

type Worker added in v0.1.0

type Worker interface {
	Run(ctx context.Context, numWorkers int)
}

func HasherWorker

func HasherWorker(ctx context.Context) Worker

Jump to

Keyboard shortcuts

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