package
0.0.0-20240906124643-5ce5b849629e
Repository: https://github.com/mikeydub/go-gallery.git
Documentation: pkg.go.dev
# Functions
No description provided by the author
No description provided by the author
BodyAsError returns the HTTP body as an error Returns ErrReadBody if the body cannot be read.
No description provided by the author
ChunkBy splits a slice into chunks of a given size.
No description provided by the author
ContainsAnyString checks whether a string contains any of the given substrings.
ContainsString checks whether an item exists in a slice.
CopyMax will copy until a certain point and error after that point.
Dedupe removes duplicate elements from a slice, preserving the order of the remaining elements.
DedupeWithTranslate can be used when T is not good for comparison or there should be some other value used for comparison as opposed to golang equality check.
Difference will take in 2 arrays and return the elements that exist in the second array but are not in the first.
ErrorAs unwraps errors until it finds an error of type T.
ErrorIs returns true if the given error is of type T.
ErrResponse sends a json response for an error during endpoint execution.
No description provided by the author
No description provided by the author
FindFile finds a file relative to the working directory by searching outer directories up to the search depth.
No description provided by the author
FindFirstFieldFromMap finds the first field in the map that contains the given field.
No description provided by the author
No description provided by the author
FromPointer returns the value of a pointer, or the zero value of the pointer's type if the pointer is nil.
No description provided by the author
No description provided by the author
GetGinContext retrieves a gin.Context previously stored in the request context via the GinContextToContext middleware, or nil if no gin.Context is found.
No description provided by the author
GetURIPath takes a uri in any form and returns just the path.
GetValueFromMap is a function that returns the value at the first occurence of a given key in a map that potentially contains nested maps.
GetValueFromMapUnsafe is a function that returns the value at the first occurence of a given key in a map that potentially contains nested maps This function is unsafe because it will also return if the specified key is a substring of any key found in the map.
No description provided by the author
No description provided by the author
InByteSizeFormat converts a number of bytes to a human-readable string using SI units (kB, MB, GB, TB, PB, EB, ZB, YB).
InDocker returns true if the service is running as a container.
No description provided by the author
LoadEncryptedEnvFile configures the environment with the configured input file.
LoadEncryptedServiceKey loads an encrypted service key JSON file from disk.
LoadEncryptedServiceKeyOrError loads an encrypted service key JSON file from disk or errors.
LoadEnvFile configures the environment with the configured input file.
Map applies a function to each element of a slice, returning a new slice of the same length.
No description provided by the author
No description provided by the author
No description provided by the author
MapWithoutError applies a function to each element of a slice, returning a new slice of the same length.
MustFindFile panics if the file is not found up to the default search depth.
MustFindFile panics if the file is not found up to the default search depth.
MustGetGinContext retrieves a gin.Context previously stored in the request context via the GinContextToContext middleware, or panics if no gin.Context is found.
NewFileHeaderReader returns a new FileHeaderReader.
No description provided by the author
RandEthAddress returns a random ethereum address.
RandHexString returns a random hex string of given length.
RandStringBytes returns a random alphanumeric string of given length.
RemoveBOM removes the byte order mark from a byte array.
RemoveLeftPaddedZeros is a function that removes the left padded zeros from a large hex string.
ResolveEnvFile finds the appropriate env file to use for the service.
No description provided by the author
No description provided by the author
No description provided by the author
StringToPointerIfNotEmpty returns a pointer to the string if it is a non-empty string.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Track the time it takes to execute a function.
No description provided by the author
UnmarshallBody takes a request body and unmarshals it into the given struct input must be a pointer to a struct with json tags.
VarNotSetTo panics if an environment variable is not set or set to `emptyVal`.
# Constants
DefaultSearchDepth represents the maximum amount of nested maps (aka recursions) that can be searched.
EB is the number of bytes in an exabyte.
GB is the number of bytes in a gigabyte.
No description provided by the author
KB is the number of bytes in a kilobyte.
MB is the number of bytes in a megabyte.
PB is the number of bytes in a petabyte.
TB is the number of bytes in a terabyte.
# Structs
ErrHTTP represents an error returned from an HTTP request.
ErrInvalidInput is an error response for an invalid input.
ErrorResponse represents a json response for an error during endpoint execution.
No description provided by the author
FileHeaderReader is a struct that wraps an io.Reader and pre-reads the first 512 bytes of the reader When the reader is read, the first 512 bytes are returned first, then the rest of the reader is read, so that the first 512 bytes are not lost.
No description provided by the author
SuccessResponse represents a true or false success response for an endpoint.
# Type aliases
No description provided by the author