Documentation ¶
Index ¶
- Variables
- func ConvertBase32ToBytes(in interface{}, out *interface{}) (err error)
- func ConvertBase64ToBytes(in interface{}, out *interface{}) (err error)
- func ConvertBytesToBase32(in interface{}, out *interface{}) error
- func ConvertBytesToBase64(in interface{}, out *interface{}) error
- func ConvertBytesToHex(in interface{}, out *interface{}) error
- func ConvertBytesToMd5sum(in interface{}, out *interface{}) (err error)
- func ConvertBytesToSha1sum(in interface{}, out *interface{}) (err error)
- func ConvertBytesToString(in interface{}, out *interface{}) error
- func ConvertDateToTime(in interface{}, out *interface{}) (err error)
- func ConvertFloatToString(in interface{}, out *interface{}) (err error)
- func ConvertHexToBytes(in interface{}, out *interface{}) (err error)
- func ConvertIntegerToString(in interface{}, out *interface{}) error
- func ConvertJsonToStruct(in interface{}, out *interface{}) (err error)
- func ConvertStringToBytes(in interface{}, out *interface{}) error
- func ConvertStringToCsv(in interface{}, out *interface{}) (err error)
- func ConvertStringToFloat(in interface{}, out *interface{}) (err error)
- func ConvertStringToInteger(in interface{}, out *interface{}) (err error)
- func ConvertStructToJson(in interface{}, out *interface{}) (err error)
- func ConvertStructToToml(in interface{}, out *interface{}) (err error)
- func ConvertStructToXml(in interface{}, out *interface{}) (err error)
- func ConvertTimeToString(in interface{}, out *interface{}) (err error)
- func ConvertTimeToUnix(in interface{}, out *interface{}) (err error)
- func ConvertUnixTimestampToTime(in interface{}, out *interface{}) (err error)
- func ConvertXmlToStruct(in interface{}, out *interface{}) (err error)
- func FetchUrlToBytes(in interface{}, out *interface{}) error
- func Lowercase(in interface{}, out *interface{}) (err error)
- func RegisterConverter(converter *Converter)
- func ReverseString(in interface{}, out *interface{}) (err error)
- func StreamBufferSplitLines(in chan interface{}) chan interface{}
- func Uppercase(in interface{}, out *interface{}) (err error)
- type ConversionFn
- type Converter
- func (conv *Converter) SetConversionFunc(fn ConversionFn) *Converter
- func (conv *Converter) SetDefaultTypeConverter() *Converter
- func (conv *Converter) SetStreamConvFunc(fn StreamConvFn) *Converter
- func (conv *Converter) SetType(ioType string) *Converter
- func (conv *Converter) SetTypes(inType, outType string) *Converter
- type ConverterChain
- type StreamConvFn
Examples ¶
- ConvertBase32ToBytes
- ConvertBase64ToBytes
- ConvertBytesToBase32
- ConvertBytesToBase64
- ConvertBytesToHex
- ConvertBytesToMd5sum
- ConvertBytesToSha1sum
- ConvertBytesToString
- ConvertFloatToString
- ConvertHexToBytes
- ConvertIntegerToString
- ConvertJsonToStruct
- ConvertStringToBytes
- ConvertStringToCsv
- ConvertStringToFloat
- ConvertStringToInteger
- ConvertStructToJson
- ConvertStructToToml
- ConvertStructToXml
- ConvertTimeToUnix
- FetchUrlToBytes
Constants ¶
This section is empty.
Variables ¶
View Source
var ConvertANSICToTime = DateToTimeConverter(time.ANSIC)
View Source
var ConvertRFC1123ToTime = DateToTimeConverter(time.RFC1123)
View Source
var ConvertRFC3339ToTime = DateToTimeConverter(time.RFC3339)
View Source
var ConvertRFC822ToTime = DateToTimeConverter(time.RFC822)
View Source
var ConvertRFC850ToTime = DateToTimeConverter(time.RFC850)
View Source
var ConvertUnixDateToTime = DateToTimeConverter(time.UnixDate)
View Source
var FiveSecondDelayer = Delayer(5 * time.Second)
View Source
var HundredMillisecondDelayer = Delayer(100 * time.Millisecond)
View Source
var OneMinuteDelayer = Delayer(time.Minute)
View Source
var OneSecondDelayer = Delayer(time.Second)
View Source
var RegisteredConverters []*Converter
View Source
var TenSecondDelayer = Delayer(10 * time.Second)
View Source
var TwoSecondDelayer = Delayer(2 * time.Second)
Functions ¶
func ConvertBase32ToBytes ¶
func ConvertBase32ToBytes(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} ConvertBase32ToBytes("NBSWY3DPEB3W64TMMQQQ====", &output) fmt.Println(output)
Output: [104 101 108 108 111 32 119 111 114 108 100 33]
func ConvertBase64ToBytes ¶
func ConvertBase64ToBytes(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} ConvertBase64ToBytes("aGVsbG8gd29ybGQh", &output) fmt.Println(output)
Output: [104 101 108 108 111 32 119 111 114 108 100 33]
func ConvertBytesToBase32 ¶
func ConvertBytesToBase32(in interface{}, out *interface{}) error
Example ¶
var output interface{} ConvertBytesToBase32([]byte("hello world!"), &output) fmt.Println(output)
Output: NBSWY3DPEB3W64TMMQQQ====
func ConvertBytesToBase64 ¶
func ConvertBytesToBase64(in interface{}, out *interface{}) error
Example ¶
var output interface{} ConvertBytesToBase64([]byte("hello world!"), &output) fmt.Println(output)
Output: aGVsbG8gd29ybGQh
func ConvertBytesToHex ¶
func ConvertBytesToHex(in interface{}, out *interface{}) error
Example ¶
var output interface{} ConvertBytesToHex([]byte("hello world!"), &output) fmt.Println(output)
Output: 68656c6c6f20776f726c6421
func ConvertBytesToMd5sum ¶
func ConvertBytesToMd5sum(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} ConvertBytesToMd5sum([]byte("hello world!"), &output) fmt.Println(output)
Output: fc3ff98e8c6a0d3087d515c0473f8677
func ConvertBytesToSha1sum ¶
func ConvertBytesToSha1sum(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} ConvertBytesToSha1sum([]byte("hello world!"), &output) fmt.Println(output)
Output: 430ce34d020724ed75a196dfc2ad67c77772d169
func ConvertBytesToString ¶
func ConvertBytesToString(in interface{}, out *interface{}) error
Example ¶
var output interface{} ConvertBytesToString([]byte("hello world!"), &output) fmt.Println(output)
Output: hello world!
func ConvertDateToTime ¶
func ConvertDateToTime(in interface{}, out *interface{}) (err error)
func ConvertFloatToString ¶
func ConvertFloatToString(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} ConvertFloatToString(3.1415, &output) fmt.Println(output)
Output: 3.1415
func ConvertHexToBytes ¶
func ConvertHexToBytes(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} ConvertHexToBytes("68656c6c6f20776f726c6421", &output) fmt.Println(output)
Output: [104 101 108 108 111 32 119 111 114 108 100 33]
func ConvertIntegerToString ¶
func ConvertIntegerToString(in interface{}, out *interface{}) error
Example ¶
var output interface{} ConvertIntegerToString(int64(1234567890), &output) fmt.Println(output)
Output: 1234567890
func ConvertJsonToStruct ¶
func ConvertJsonToStruct(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} input := []byte(`["Hello",42,3.1415]`) ConvertJsonToStruct(input, &output) fmt.Printf("%+v\n", output)
Output: [Hello 42 3.1415]
func ConvertStringToBytes ¶
func ConvertStringToBytes(in interface{}, out *interface{}) error
Example ¶
var output interface{} ConvertStringToBytes("hello world!", &output) fmt.Println(output)
Output: [104 101 108 108 111 32 119 111 114 108 100 33]
func ConvertStringToCsv ¶
func ConvertStringToCsv(in interface{}, out *interface{}) (err error)
Example ¶
input := `first_name,last_name,username "Rob","Pike",rob Ken,Thompson,ken "Robert","Griesemer","gri" "Manfred",Touron,moul ` var output interface{} ConvertStringToCsv(input, &output) fmt.Printf("%+v\n", output)
Output: [[first_name last_name username] [Rob Pike rob] [Ken Thompson ken] [Robert Griesemer gri] [Manfred Touron moul]]
func ConvertStringToFloat ¶
func ConvertStringToFloat(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} ConvertStringToFloat("3.1415", &output) fmt.Println(output)
Output: 3.1415
func ConvertStringToInteger ¶
func ConvertStringToInteger(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} ConvertStringToInteger("1234567890", &output) fmt.Println(output)
Output: 1234567890
func ConvertStructToJson ¶
func ConvertStructToJson(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} input := []interface{}{ "Hello", 42, 3.1415, } ConvertStructToJson(input, &output) fmt.Printf("%s\n", output)
Output: ["Hello",42,3.1415]
func ConvertStructToToml ¶
func ConvertStructToToml(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} input := map[string]interface{}{ "a": "Hello", "b": 42, "c": 3.1415, } ConvertStructToToml(input, &output) fmt.Printf("%s\n", output)
Output: a = "Hello" b = 42 c = 3.1415
func ConvertStructToXml ¶
func ConvertStructToXml(in interface{}, out *interface{}) (err error)
Example ¶
var output interface{} input := []interface{}{ "Hello", 42, 3.1415, } ConvertStructToXml(input, &output) fmt.Printf("%s\n", output)
Output: <string>Hello</string><int>42</int><float64>3.1415</float64>
func ConvertTimeToString ¶
func ConvertTimeToString(in interface{}, out *interface{}) (err error)
func ConvertTimeToUnix ¶
func ConvertTimeToUnix(in interface{}, out *interface{}) (err error)
Example ¶
input := time.Date(1988, time.January, 25, 13, 10, 42, 0, time.UTC) var output interface{} ConvertTimeToUnix(input, &output) fmt.Printf("%+v\n", output.(int64))
Output: 570114642
func ConvertUnixTimestampToTime ¶
func ConvertUnixTimestampToTime(in interface{}, out *interface{}) (err error)
func ConvertXmlToStruct ¶
func ConvertXmlToStruct(in interface{}, out *interface{}) (err error)
func FetchUrlToBytes ¶
func FetchUrlToBytes(in interface{}, out *interface{}) error
Example ¶
input := "http://sapin-as-a-service.appspot.com/?size=3" var output interface{} FetchUrlToBytes(input, &output) fmt.Printf("%+s\n", string(output.([]byte)))
Output: * *** ***** ******* ***** ******* ********* *********** ************* *********** ************* *************** ***************** ******************* ********************* ||| ||| |||
func RegisterConverter ¶
func RegisterConverter(converter *Converter)
func ReverseString ¶
func ReverseString(in interface{}, out *interface{}) (err error)
func StreamBufferSplitLines ¶
func StreamBufferSplitLines(in chan interface{}) chan interface{}
Types ¶
type ConversionFn ¶
type ConversionFn func(interface{}, *interface{}) error
func Chain ¶
func Chain(left ConversionFn, rights ...ConversionFn) ConversionFn
func DateToTimeConverter ¶
func DateToTimeConverter(format string) ConversionFn
func Delayer ¶
func Delayer(duration time.Duration) ConversionFn
func GetTypeConversionFunc ¶
func GetTypeConversionFunc(inType, outType string) ConversionFn
func Pipe ¶
func Pipe(left, right ConversionFn) ConversionFn
type Converter ¶
type Converter struct { InputType string OutputType string Name string ConversionFunc ConversionFn StreamConvFunc StreamConvFn IsDefaultTypeConverter bool }
func GetConverterByName ¶
func NewConverter ¶
func (*Converter) SetConversionFunc ¶
func (conv *Converter) SetConversionFunc(fn ConversionFn) *Converter
func (*Converter) SetDefaultTypeConverter ¶
func (*Converter) SetStreamConvFunc ¶
func (conv *Converter) SetStreamConvFunc(fn StreamConvFn) *Converter
type ConverterChain ¶
type ConverterChain []*Converter
func NewConverterChain ¶
func NewConverterChain(filterNames []string) (ConverterChain, error)
func (*ConverterChain) ConversionFunc ¶
func (chain *ConverterChain) ConversionFunc(inType, outType string) (ConversionFn, error)
func (*ConverterChain) Convert ¶
func (chain *ConverterChain) Convert(input interface{}, output *interface{}) error
type StreamConvFn ¶
type StreamConvFn func(chan interface{}) chan interface{}
func ConversionToStreamConv ¶
func ConversionToStreamConv(conversionFn ConversionFn) StreamConvFn
func StreamChain ¶
func StreamChain(streamFuncs ...StreamConvFn) StreamConvFn
func StreamPipe ¶
func StreamPipe(left, right StreamConvFn) StreamConvFn
Source Files ¶
Click to show internal directories.
Click to hide internal directories.