Documentation ¶
Index ¶
- func AuthWrapper(fn server.HandlerFunc) server.HandlerFunc
- func BcryptCheck(password string, hash string) bool
- func BcryptEncode(originstr string) string
- func EmptyFieldError(field string) error
- func ExtractContext(ctx context.Context, t opentracing.Tracer, name string) opentracing.Span
- func GetEnvironment(key, value string) string
- func InvalidFieldError(field, reason string) error
- func NewTracer(serviceName string, addr string) (opentracing.Tracer, io.Closer, error)
- type ErrInvalidField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthWrapper ¶
func AuthWrapper(fn server.HandlerFunc) server.HandlerFunc
AuthWrapper is a high-order function which takes a HandlerFunc and returns a function, which takes a context, request and response interface. The token is extracted from the context. If valid, the call is passed along to the handler. If not, an error is returned.
func BcryptCheck ¶
BcryptCheck compare password and hash
func BcryptEncode ¶
BcryptEncode encode string to bcrypt crypto string
func EmptyFieldError ¶
emptyFieldError creates an errInvalidField for an empty field
func ExtractContext ¶
ExtractContext extract metadata from tracing context and return new span
func GetEnvironment ¶
GetEnvironment Get a value from an environment variable and return value if no value exists
func InvalidFieldError ¶
invalidFieldError creates an errInvalidField for a specific field and reason
Types ¶
type ErrInvalidField ¶
type ErrInvalidField struct {
// contains filtered or unexported fields
}
ErrInvalidField represents a validation error
func (ErrInvalidField) Error ¶
func (e ErrInvalidField) Error() string