util

package
v0.0.0-...-e0434a4 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanRecover

func CanRecover(errorList ...error) bool

func CloseSilently

func CloseSilently(closable interface{ Close() error })

useful in cases where you would write defer thing.Close to work around lint checks for unhandled errors

func DefaultMiddleWare

func DefaultMiddleWare(logger *zap.Logger, fakeServiceName string, r *chi.Mux) error

DefaultMiddleWare builds an http handler with logging fakeServiceName feeds into laas and normally would be a micros service name, here it's a fake

func DefaultTransport

func DefaultTransport() *http.Transport

func EnvironmentVariableNameFor

func EnvironmentVariableNameFor(s string) string

func EnvironmentVariablesAsMap

func EnvironmentVariablesAsMap(names ...string) (map[string]string, error)

func HTTPClient

func HTTPClient() *http.Client

func IgnoreError

func IgnoreError(f func() error)

useful in cases where you want to document that you explicitly do not want to handle errors

func NewRouter

func NewRouter(serviceName string, logger *zap.Logger) (*chi.Mux, error)

func Retry

func Retry(backoff wait.Backoff, f func() error) error

Retry unconditionally retries something until it works

func RetryConditionally

func RetryConditionally(retryBackoff wait.Backoff, f func() (bool, error)) error

RetryConditionally keeps retrying as long as f() returns true, indicating that it is retriable.

func RetryObjectUpdater

func RetryObjectUpdater(logger *zap.Logger, updater updater.ObjectUpdater, obj runtime.Object) error

RetryObjectUpdater retries the objectupdater. It's hardcoded to use the retry.DefaultRetry from client-go as it's designed for the conflict scenario

func ToRawExtension

func ToRawExtension(obj interface{}) (*runtime.RawExtension, error)

Types

type ErrInvalidVariableName

type ErrInvalidVariableName struct {
	// contains filtered or unexported fields
}

func NewErrInvalidVariableName

func NewErrInvalidVariableName(varName string) *ErrInvalidVariableName

func (*ErrInvalidVariableName) Error

func (e *ErrInvalidVariableName) Error() string

type ErrVariableNotFound

type ErrVariableNotFound struct {
	Similar string
	// contains filtered or unexported fields
}

func NewErrVariableNotFound

func NewErrVariableNotFound(varName string, similar string) *ErrVariableNotFound

func (*ErrVariableNotFound) Error

func (e *ErrVariableNotFound) Error() string

type ErrorList

type ErrorList struct {
	ErrorList []error
}

func NewErrorList

func NewErrorList(initialErrList ...error) *ErrorList

func (*ErrorList) Add

func (e *ErrorList) Add(err ...error)

func (*ErrorList) AddErrorList

func (e *ErrorList) AddErrorList(errorList *ErrorList)

func (*ErrorList) CanRecover

func (e *ErrorList) CanRecover() bool

func (*ErrorList) Error

func (e *ErrorList) Error() string

func (*ErrorList) HasErrors

func (e *ErrorList) HasErrors() bool

type HTTPServer

type HTTPServer struct {
	// contains filtered or unexported fields
}

func NewHTTPServer

func NewHTTPServer(serviceName string, logger *zap.Logger, config options.ServerConfig) (*HTTPServer, error)

func (*HTTPServer) GetRouter

func (a *HTTPServer) GetRouter() *chi.Mux

func (*HTTPServer) Run

func (a *HTTPServer) Run(ctx context.Context) error

type JSONPatch

type JSONPatch = []Patch

type Operation

type Operation string
const (
	Add     Operation = "add"
	Remove  Operation = "remove"
	Replace Operation = "replace"
	Move    Operation = "move"
	Copy    Operation = "copy"
	Test    Operation = "test"
)

Operation Constants

type Patch

type Patch = struct {
	Operation Operation   `json:"op"`
	From      string      `json:"from,omitempty"`
	Path      string      `json:"path"`
	Value     interface{} `json:"value,omitempty"`
}

Directories

Path Synopsis
Package auth contains types for working with non blank user names.
Package auth contains types for working with non blank user names.
Package sets has auto-generated set types.
Package sets has auto-generated set types.

Jump to

Keyboard shortcuts

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