Documentation ¶
Index ¶
- func EscapeLiteralForPG(value string) string
- func EscapeLiteralForPGPatternMatch(value string) string
- func FormatErrorMsg(err error, id string) error
- func IsSafeUUID(uuid string) bool
- func IsSqlSafe(str string) bool
- func ProcessInvalid(err error, msg string) error
- func ProcessSQLNotFound(err error, id string, wrap string) error
- func ProcessUnauthenticated(err error, msg string) error
- type InvalidError
- type NotFoundError
- type UnauthenticatedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeLiteralForPG ¶
func FormatErrorMsg ¶
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 ¶
Ensuring it only has valid UUID characters TODO: unit tests
func ProcessInvalid ¶
ProcessInvalid returns InvalidError
func ProcessSQLNotFound ¶
ProcessSQLNotFound checks for err of type sql.ErrNoRows and returns NotFoundError if true, otherwise wrap original error and return
func ProcessUnauthenticated ¶
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