Documentation ¶
Index ¶
- func DeDupFilters(filters map[string][]string)
- func DiffArray(a, b []string) (inANotB []string)
- 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 KvMatches(matchKey string, matchVal string, kv *common.Kv) bool
- func ProcessInvalid(err error, msg string) error
- func ProcessNotFound(err error, id string) error
- func ProcessSQLNotFound(err error, id string, wrap string) error
- func ProcessUnauthenticated(err error, msg string) error
- func UniqueStringSlice(stringSlice []string) []string
- type InvalidError
- type NotFoundError
- type UnauthenticatedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeDupFilters ¶
Take out the duplicate entries if they exist.. not need to return the map.. maps are passed by ref. getting the duplicates out of the filters avoids the filtersQuery from becoming less efficient by having duplicate clauses. Duplicates in filter entries also make deep filtering impossible because deep filtering at the moment requires that we have exactly one profile and no controls or one profile and one control. If we have duplicates, it's easy to see why deep filtering would therefore, break.
func DiffArray ¶
DiffArray - A util func that takes two string arrays (a and b), and returns an array containing elements that are in a but not b
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 ProcessNotFound ¶
ProcessNotFound returns NotFoundError
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
func UniqueStringSlice ¶
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