utils

package
v0.0.0-...-0490640 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeLiteralForPG

func EscapeLiteralForPG(value string) string

func EscapeLiteralForPGPatternMatch

func EscapeLiteralForPGPatternMatch(value string) string

func FormatErrorMsg

func FormatErrorMsg(err error, id string) error

Error codes can be found here: https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15 FormatErrorMsg takes a message and a string id to return a unified error msg across requests

func IsSafeUUID

func IsSafeUUID(uuid string) bool

Ensuring it only has valid UUID characters TODO: unit tests

func IsSqlSafe

func IsSqlSafe(str string) bool

Ensuring str only has the characters we support at the moment TODO: unit tests

func ProcessInvalid

func ProcessInvalid(err error, msg string) error

ProcessInvalid returns InvalidError

func ProcessSQLNotFound

func ProcessSQLNotFound(err error, id string, wrap string) error

ProcessSQLNotFound checks for err of type sql.ErrNoRows and returns NotFoundError if true, otherwise wrap original error and return

func ProcessUnauthenticated

func ProcessUnauthenticated(err error, msg string) error

ProcessUnauthenticated returns UnauthenticatedError

Types

type InvalidError

type InvalidError struct {
	Msg string
	// contains filtered or unexported fields
}

InvalidError is the error returned when user has provided invalid arguments

func (*InvalidError) Error

func (e *InvalidError) Error() string

type NotFoundError

type NotFoundError struct {
	Id string
	// contains filtered or unexported fields
}

NotFoundError is the error returned when nothing was found

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type UnauthenticatedError

type UnauthenticatedError struct {
	Msg string
	// contains filtered or unexported fields
}

UnauthenticatedError is the error returned when user is not authenticated with an external service such as aws or azure

func (*UnauthenticatedError) Error

func (e *UnauthenticatedError) Error() string

Jump to

Keyboard shortcuts

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