Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAll(b, flags Bits) bool
- func CheckAny(b, flags Bits) bool
- func CheckFatal(e error) error
- func CheckNotFatal(e error) error
- func DebugRuntimeCallerFuncion(targetName string) string
- func DebugToJSONStringNoIndentEscaped(o interface{}) string
- func Explode2(x string) (a, b string)
- func Explode3(x string) (a, b, c string)
- func FromGOB(network []byte, o interface{}) error
- func FromJSONBytes(buf []byte, o interface{}) error
- func FromJSONString(buf string, o interface{}) error
- func GenerateUniqueID(idType string, nowLocal time.Time) (string, string)
- func HTTPBytesGet(url string) ([]byte, *http.Header, error)
- func HTTPJSONGet(url string, o interface{}, username string, password string) error
- func HTTPParamGetInt(req *http.Request, key string, defaultValue int) int
- func HTTPParamGetString(req *http.Request, key string, defaultValue string) string
- func HTTPXMLGet(url string, o interface{}) error
- func Implode2(a, b string) string
- func Implode3(a, b, c string) string
- func IsPrivateIPV4Get(ip net.IP) bool
- func IsSetAll(b, flags Bits) bool
- func IsSetAny(b, flags Bits) bool
- func KeepShort(s *string, maxLenght int) *string
- func MD5Hash(text string) string
- func PrivateIPV4Get() (net.IP, error)
- func PrivateIPV4GetLower16() (uint16, error)
- func PrivateIPV4GetLower16OrDie() uint16
- func PrivateIPV4GetLower32OrDie() uint32
- func ReadJSONFile(filename string, o interface{}) error
- func ReadJSONFileCompressed(filename string, o interface{}) error
- func ReadXMLFile(filename string, o interface{}) error
- func SnowflakeExtractGroup(id string, idType string) string
- func SnowflakeID(idType string, nowLocal time.Time) string
- func SnowflakeIDWithGroup(idType string, nowLocal time.Time) (groupID string, uniqueID string)
- func ToGOB(o interface{}) []byte
- func ToJSONBytes(v interface{}) []byte
- func ToJSONBytesNoIndent(v interface{}) []byte
- func ToJSONBytesNoIndentOrError(v interface{}) ([]byte, error)
- func ToJSONBytesOrError(v interface{}) ([]byte, error)
- func ToJSONString(v interface{}) string
- func ToJSONStringNoIndent(v interface{}) string
- func ToJSONStringOrError(v interface{}) (string, error)
- func ToXMLString(v interface{}) string
- func TouchFile(filename string) error
- func URLIsValid(urlString string) error
- func WriteJSONFile(filename string, o interface{}) error
- func WriteJSONFileCompressed(filename string, o interface{}) error
- type Bits
- type StructTraverseTraverser
- type StructTraverseVisitor
- type Time
Constants ¶
const StringNone = ""
Variables ¶
var ( EmptyJSONBytes = []byte("{}") EmptyJSONString = string(EmptyJSONBytes) )
var ErrorInvalidId = errors.New("invalid Snowflake ID")
Functions ¶
func CheckFatal ¶
CheckFatal checks the error and panics if it's not nil
func CheckNotFatal ¶
CheckNotFatal checks the error, logs it if not nil, and moves on
func DebugToJSONStringNoIndentEscaped ¶
func DebugToJSONStringNoIndentEscaped(o interface{}) string
func FromJSONBytes ¶
FromJSONBytes parses JSON bytes buffer into o
func FromJSONString ¶
FromJSONString parses JSON string into o
func GenerateUniqueID ¶
GenerateUniqueID sorted by time
func HTTPBytesGet ¶
HTTPBytesGet fetches payload into a buffer
func HTTPJSONGet ¶
HTTPJSONGet getches JSON from the given url
func HTTPParamGetInt ¶
HTTPParamGetInt get an integer param from an HTTP request
func HTTPParamGetString ¶
HTTPParamGetString get a string param from an HTTP request
func HTTPXMLGet ¶
HTTPXMLGet fetches XML payload and parses it into o
func IsPrivateIPV4Get ¶
IsPrivateIPV4Get checks if the given IP is private (AWS/EC2)
func PrivateIPV4Get ¶
PrivateIPV4Get gets the private IP of the current AWS/EC2 server
func PrivateIPV4GetLower16 ¶
PrivateIPV4GetLower16 gets the lower 16 bits of the IP address
func PrivateIPV4GetLower16OrDie ¶
func PrivateIPV4GetLower16OrDie() uint16
PrivateIPV4GetLower16OrDie gets the lower 16 bits of the IP address
func PrivateIPV4GetLower32OrDie ¶
func PrivateIPV4GetLower32OrDie() uint32
func ReadJSONFile ¶
ReadJSONFile reads a JSON file into o
func ReadJSONFileCompressed ¶
ReadJSONFileCompressed read compressed (gzip) JSON file
func ReadXMLFile ¶
ReadXMLFile reads an XML file into o
func SnowflakeExtractGroup ¶
func SnowflakeIDWithGroup ¶
func ToJSONBytes ¶
func ToJSONBytes(v interface{}) []byte
ToJSONBytes serializes v into a buffer of JSON bytes
func ToJSONBytesNoIndent ¶
func ToJSONBytesNoIndent(v interface{}) []byte
ToJSONBytesNoIndent serializes v into a buffer of JSON bytes
func ToJSONBytesNoIndentOrError ¶
ToJSONBytesNoIndent serializes v into a buffer of JSON bytes
func ToJSONBytesOrError ¶
ToJSONBytesOrError serializes v into a buffer of JSON bytes
func ToJSONString ¶
func ToJSONString(v interface{}) string
ToJSONString serializes v into a JSON string
func ToJSONStringNoIndent ¶
func ToJSONStringNoIndent(v interface{}) string
ToJSONStringNoIndent serialize v into a JSON string
func ToJSONStringOrError ¶
ToJSONStringOrError serializes v into a JSON string
func ToXMLString ¶
func ToXMLString(v interface{}) string
ToXMLString serializes v into an XML string
func URLIsValid ¶
URLIsValid check if a given string is a valid URL
func WriteJSONFile ¶
WriteJSONFile writes the object 'o' as JSON into the given file
func WriteJSONFileCompressed ¶
WriteJSONFileCompressed write o as a compressed JSON file (gzip)
Types ¶
type StructTraverseTraverser ¶
type StructTraverseTraverser struct {
Params map[string]interface{}
}
Traverse the structs recursively allowing to modify the instances in place if required. For example - hiding or updating values selectively just before serializing to JSON.
*
func CreateStructTraverseContext ¶
func CreateStructTraverseContext(params map[string]interface{}) *StructTraverseTraverser
func (*StructTraverseTraverser) Traverse ¶
func (t *StructTraverseTraverser) Traverse(objectToTraverse interface{}) error
type StructTraverseVisitor ¶
type StructTraverseVisitor interface {
StructTraverseVisitor(traverseContext *StructTraverseTraverser) error
}
Interface to be adopted for instances that want to hide / modify fields by StructTraverseTraverser
*