Documentation ¶
Index ¶
- Variables
- func Capitalize(str string) string
- func DateTimePointerToRFC3339(inputTime *time.Time) string
- func DateTimePointerToRecordFormat(inputTime *time.Time) *string
- func DateTimeToRFC3339(inputTime time.Time) string
- func DateTimeToRecordFormat(inputTime time.Time) *string
- func Decrypt(str string) (string, error)
- func ElementsInSlicesEqual(sliceA []int64, sliceB []int64) bool
- func Encrypt(str string) (string, error)
- func FormatAvailabilityStatus(status string) string
- func FormatTimeToString(inputTime time.Time, format string) string
- func GeneratedXRhIdentity(account, orgId string) string
- func IdentityFromKafkaHeaders(headers []kafka.Header) (*identity.Identity, error)
- func InitializeEncryption()
- func InterfaceToInt64(i interface{}) (int64, error)
- func InterfaceToString(i interface{}) (string, error)
- func NewErrBadRequest(t interface{}) error
- func NewErrNotFound(t string) error
- func OverrideEncryptionKey(k string)
- func ParseXRHIDHeader(inputIdentity string) (*identity.XRHID, error)
- func SliceContainsString(slice []string, target string) bool
- func StringRef(str string) *string
- func StringValueOrNil(inputValue interface{}) *string
- func ValueOrBlank(strRef *string) string
- type Collection
- type ErrBadRequest
- type ErrNotFound
- type Error
- type ErrorDocument
- type Filter
- type Links
- type Metadata
- type Resource
Constants ¶
This section is empty.
Variables ¶
var ErrBadRequestEmpty = NewErrBadRequest("")
var ErrNotFoundEmpty = NewErrNotFound("")
var FilterRegex = regexp.MustCompile(`\w+`)
Simple regex - which matches only the characters. the filters would come in like this:
filter[name][eq] or filter[source_type][name][eq]
and get matched as:
["filter", "name", "eq"] or ["filter", "source_type", "name", "eq"]
var RecordDateTimeFormat = "2006-01-02 15:04:05 MST"
Functions ¶
func Capitalize ¶
func DateTimeToRFC3339 ¶
func DateTimeToRecordFormat ¶
func ElementsInSlicesEqual ¶
ElementsInSlicesEqual sorts and compare slices of int64 and returns that slices are equal
func GeneratedXRhIdentity ¶
GeneratedXRhIdentity returns a base64 encoded header to use as x-rh-identity when one is not provided
func IdentityFromKafkaHeaders ¶
IdentityFromKafkaHeaders returns an identity from the provided Kafka headers, if the array contains one of the "x-rh-sources-account-number" or "x-rh-identity" headers. It returns early on the first match, without any specific preference or order.
func InitializeEncryption ¶
func InitializeEncryption()
InitializeEncryption allows reinitializing the encryption key by reading from the "ENCRYPTION_KEY" environment variable again. Useful for testing purposes outside the "util" package.
func InterfaceToInt64 ¶
InterfaceToInt64 takes an interface and returns an int64 for any float64, int64 or string received -whether they are pointers or not-.
func InterfaceToString ¶
InterfaceToString takes a number in interface format and converts it to the string representation
func NewErrBadRequest ¶
func NewErrBadRequest(t interface{}) error
func NewErrNotFound ¶
func OverrideEncryptionKey ¶
func OverrideEncryptionKey(k string)
func SliceContainsString ¶
SliceContainsString returns true if the specified target is present in the given slice.
func StringValueOrNil ¶
func StringValueOrNil(inputValue interface{}) *string
func ValueOrBlank ¶
Types ¶
type Collection ¶
type Collection struct { Data []interface{} `json:"data"` Meta Metadata `json:"meta"` Links Links `json:"links"` }
func CollectionResponse ¶
func CollectionResponse(collection []interface{}, req *http.Request, count, limit, offset int) *Collection
type ErrBadRequest ¶
type ErrBadRequest struct {
Message string
}
func (ErrBadRequest) Error ¶
func (e ErrBadRequest) Error() string
type ErrNotFound ¶
type ErrNotFound struct {
Type string
}
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
func (ErrNotFound) Is ¶
func (e ErrNotFound) Is(err error) bool
type ErrorDocument ¶
type ErrorDocument struct {
Errors []Error `json:"errors"`
}
func ErrorDocWithRequestId ¶
func ErrorDocWithRequestId(message, status, uuid string) *ErrorDocument
func NewErrorDoc ¶
func NewErrorDoc(message, status string) *ErrorDocument