modulepackage
0.1.3
Repository: https://github.com/swan-community/common-go.git
Documentation: pkg.go.dev
# README
common-go
Common Go functionality shared across SWAN repositories.
# Functions
GetTimeFromMinutes returns the date time from the minutes provided.
GetDateInMinutes returns the number of minutes that have elapsed since the IoDateBase epoch.
GetWriter creates a new compressed writer for the content type provided.
HTTPTest returns a test response after having processed the handler, method, URL, and body provided.
Read the next byte as a bool and returns the value.
ReadByte reads the next byte from the buffer.
ReadByteArray reads the first 4 bytes as an unsigned 32 bit integer to determine the length of the byte array contained in the following bytes.
ReadByteArrayArray from two dimensional array of bytes.
ReadByteArrayNoLength reads the number of bytes specified into a new byte array.
ReadDate reads the date from the unsigned 16 bit integer and then determines the date by adding this to the IoDateBase epoch.
ReadDateFromUInt32 reads the date from the buffer where the date is stored as the number of minutes as an unsigned 32 bit integer that have elapsed since the IoDateBase epoch.
ReadFloat32 from the buffer.
ReadMarshaller reads the content into the unmarshaler instance.
ReadString reads a null (zero) terminated string from the byte buffer.
ReadStrings into one dimensional array of strings.
ReadTime from the next binary object.
ReadUint16 reads an unsigned 16 bit integer from the buffer.
ReadUint32 reads an unsigned 32 bit integer from the buffer.
ResponseAsByteArrayTest decompresses the response as a byte array.
ResponseAsMapTest decompresses the response and returns the body as a map.
ResponseAsStringTest decompresses the response and returns the body as a string.
ReturnApplicationError handles HTTP application errors consistently.
ReturnError handles all HTTP errors consistently.
ReturnServerError handles HTTP server errors consistently ensuring they are output to the logger.
SendByteArray writes the data as an octet-stream.
SendByteArrayUncompressed writes the data as an octet-stream without compression.
SendHTMLTemplate parses the template with the model provided and then outputs the result as HTML.
SendJS sends the JSON data provided.
SendJSTemplate parses the template with the model provided and then outputs the result as JS.
SendResponse writes out the data with the content type provided.
SendString writes out the string value with the appropriate content type.
SendTemplate parses the template with the model provided and then outputs the result for the content type provided.
No description provided by the author
WriteBool writes the boolean value to the buffer as a byte.
WriteByte writes the byte provided to the buffer.
ReadByteArray writes the length of the byte array as an unsigned 32 bit integer followed by the bytes.
WriteByteArrayArray two dimensional array of bytes.
WriteByteArrayNoLength writes the byte array to the buffer without recording the length.
WriteDate writes the date as the number of hours since the IoDateBase epoch.
WriteDateToUInt32 writes the date to the buffer as an unsigned 32 bit representing the number of minutes that have elapsed since the IoDateBase epoch.
WriteFloat32 to the buffer.
WriteMarshaller writes the result of marshal binary call to the buffer.
WriteString writes a null (zero) terminated string to the byte buffer.
WriteStrings one dimensional array of strings.
WriteTime as a binary object.
WriteUint16 reads an unsigned 16 bit integer from the buffer where the integer is stored in little endian format.
WriteUint32 reads an unsigned 32 bit integer from the buffer where the integer is stored in little endian format.
# Variables
The base year for all dates encoded with the io time methods.