Documentation ¶
Index ¶
- func CueEvaluatingJsonValue(schemaName string, cueDef string, jsonValue []byte) ([]byte, error)
- func CueValidateJson(schemaName string, cueDef string, jsonBytes []byte) error
- func CueValidateObject(schemaName string, cueDef string, obj interface{}) error
- func ExecuteWithRetry(exeFunc func() (interface{}, bool, error), retries int, ...) (interface{}, error)
- func GenerateLongUUID() string
- func GenerateRandomString(s int) (string, error)
- func GenerateUUID() string
- func GetFunctionName(i interface{}) string
- func GetHttpStatusCodeByErrorType(err error, defaultCode int) int
- func GetLoggerFromContext(c echo.Context) logger.Logger
- func GetMD5Hash(text string) string
- func GetResourceIdFromParam(c echo.Context, paramName string) int64
- func GetSHA256Hash(text string) string
- func GetSHA512Hash(text string) string
- func IsCueError(err error) bool
- func IsDuplicatedError(err error) bool
- func IsSliceContains[T constraints.Ordered](itemSlice []T, searchItem T) bool
- func IsStringContainsAnyKeywords(s string, keywords []string) bool
- func IsStringSliceCaseInsensitiveContains(stringSlice []string, searchString string) bool
- func LcFirst(str string) string
- func NewNotFoundError() error
- func RemoveStringSliceContains(stringSlice []string, searchString string) []string
- func StringSlice(s, sep string) []string
- func ToCamel(s string) string
- func ToCamelInitCaseKeepAll(s string, initCase bool) string
- func ToDelimited(s string, del uint8) string
- func ToKebab(s string) string
- func ToLowerCamel(s string) string
- func ToScreamingDelimited(s string, del uint8, screaming bool) string
- func ToScreamingKebab(s string) string
- func ToScreamingSnake(s string) string
- func ToSnake(s string) string
- func UcFirst(str string) string
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CueEvaluatingJsonValue ¶
CueEvaluatingJsonValue - Simple func to build json from a CueLang definition Parameters: - schemaName: Main cue schema name to eval - cueDef: Cue document, contains Cue definitions - jsonValue: Use to as Cue values for evaluating
func CueValidateJson ¶
CueValidateJson - Simple func to validate json by cue definitions Parameters: - schemaName: Main cue schema name to eval - cueDef: Cue document, contains Cue definitions - jsonBytes: Use to as Cue values for evaluating
func CueValidateObject ¶
Becareful with json ommitempty options. Prefer use CueValidateJson for raw payload before marshal to struct
func ExecuteWithRetry ¶
func GenerateLongUUID ¶
func GenerateLongUUID() string
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateUUID ¶
func GenerateUUID() string
func GetFunctionName ¶
func GetFunctionName(i interface{}) string
func GetLoggerFromContext ¶
func GetResourceIdFromParam ¶
func GetSHA256Hash ¶
GetSHA256Hash -- get sha_256 hash from a string
func GetSHA512Hash ¶
GetSHA512Hash -- get sha_512 hash from a string
func IsCueError ¶
func IsDuplicatedError ¶
func IsSliceContains ¶
func IsSliceContains[T constraints.Ordered](itemSlice []T, searchItem T) bool
func IsStringSliceCaseInsensitiveContains ¶
IsStringSliceCaseInsensitiveContains -- check slice contain string
func NewNotFoundError ¶
func NewNotFoundError() error
NewNotFoundError creates a new error response representing a resource-not-found error (HTTP 404)
func RemoveStringSliceContains ¶
RemoveStringSliceContains -- check slice contain string and remove
func ToCamelInitCaseKeepAll ¶
ToCamelInitCaseKeepAll Converts a string to CamelCase
func ToDelimited ¶
ToDelimited Converts a string to delimited.snake.case (in this case `del = '.'`)
func ToLowerCamel ¶
ToLowerCamel Converts a string to lowerCamelCase
func ToScreamingDelimited ¶
ToScreamingDelimited Converts a string to SCREAMING.DELIMITED.SNAKE.CASE (in this case `del = '.'; screaming = true`) or delimited.snake.case (in this case `del = '.'; screaming = false`)
func ToScreamingKebab ¶
ToScreamingKebab Converts a string to SCREAMING-KEBAB-CASE
func ToScreamingSnake ¶
ToScreamingSnake Converts a string to SCREAMING_SNAKE_CASE
Types ¶
type Error ¶
type Error struct {
Errors map[string]interface{} `json:"errors"`
}
func NewAccessForbiddenError ¶
func NewAccessForbiddenError() Error
NewAccessForbiddenError creates a new error response representing an authorization failure (HTTP 403)
func NewValidationError ¶
func NewValidationError(errs validator.ValidationErrors) Error
NewValidationError creates a new error response representing a data validation error (HTTP 400)