Documentation ¶
Overview ¶
MIT License
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- func AddressToString(address int64) (ret string)
- func BinMarshal(out *[]byte, v interface{}) (*[]byte, error)
- func BinToDec(bin []byte) int64
- func BinToDecBytesShift(bin *[]byte, num int64) int64
- func BinToHex(v interface{}) []byte
- func BinUnmarshal(out *[]byte, v interface{}) error
- func BinUnmarshalBuff(buf *bytes.Buffer, v interface{}) error
- func BytesShift(str *[]byte, index int64) (ret []byte)
- func BytesShiftReverse(str *[]byte, v interface{}) []byte
- func BytesToFloat64(s []byte) float64
- func BytesToInt(s []byte) int
- func BytesToInt64(s []byte) int64
- func DecToBin(v interface{}, sizeBytes int64) []byte
- func DecodeLenInt64(data *[]byte) (int64, error)
- func DecodeLenInt64Buf(buf *bytes.Buffer) (int64, error)
- func DecodeLength(buf *[]byte) (ret int64, err error)
- func DecodeLengthBuf(buf *bytes.Buffer) (int, error)
- func EGSMoney(money string) string
- func EncodeLenByte(out *[]byte, buf []byte) *[]byte
- func EncodeLenInt64(data *[]byte, x int64) *[]byte
- func EncodeLenInt64InPlace(x int64) []byte
- func EncodeLength(length int64) []byte
- func EncodeLengthPlusData(idata interface{}) []byte
- func Escape(data string) string
- func EscapeForJSON(data string) string
- func EscapeName(name string) string
- func EscapeSQL(name string) string
- func FieldToBytes(v interface{}, num int) []byte
- func FillLeft(slice []byte) []byte
- func Float64ToStr(f float64) string
- func HexToBin(ihexdata interface{}) []byte
- func InSliceString(search string, slice []string) bool
- func Int64ToByte(num int64) []byte
- func Int64ToStr(num int64) string
- func IntToStr(num int) string
- func InterfaceSliceToStr(i []interface{}) (strs []string, err error)
- func InterfaceToFloat64(i interface{}) float64
- func InterfaceToStr(v interface{}) (string, error)
- func IsByteColumn(table, column string) bool
- func IsLatin(name string) bool
- func IsValidAddress(address string) bool
- func NumString(in string) string
- func RSortMap(m map[int64]string) []map[int64]string
- func Round(num float64) int64
- func RoundWithPrecision(num float64, precision int) float64
- func RoundWithoutPrecision(num float64) int64
- func Sanitize(name string, available string) string
- func SanitizeName(input string) string
- func SanitizeNumber(input string) string
- func SanitizeScript(input string) string
- func SliceReverse(s []int64) []int64
- func SortMap(m map[int64]string) []map[int64]string
- func StrToFloat64(s string) float64
- func StrToInt(s string) int
- func StrToInt64(s string) int64
- func StrToMoney(str string) float64
- func StrToUint64(s string) uint64
- func StringToAddress(address string) (result int64)
- func StripTags(value string) string
- func UInt32ToStr(num uint32) string
- func ValidateEmail(email string) bool
- func ValueToInt(v interface{}) (ret int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressToString ¶
AddressToString converts int64 address to apla address as XXXX-...-XXXX.
func BinMarshal ¶
BinMarshal converts v parameter to []byte slice.
func BinToDecBytesShift ¶
BinToDecBytesShift converts the input binary []byte to int64 and shifts the input bin
func BinUnmarshal ¶
BinUnmarshal converts []byte slice which has been made with BinMarshal to v
func BinUnmarshalBuff ¶
func BytesShift ¶
BytesShift returns the index bytes of the input []byte and shift str pointer
func BytesShiftReverse ¶
BytesShiftReverse gets []byte from the end of the input and cut the input pointer to []byte
func BytesToFloat64 ¶
BytesToFloat64 converts []byte to float64
func DecodeLenInt64 ¶
DecodeLenInt64 gets int64 from []byte and shift the slice. The []byte should be encoded with EncodeLengthPlusInt64.
func DecodeLength ¶
DecodeLength decodes []byte to int64 and shifts buf. Bytes must be encoded with EncodeLength function.
0x43 => 67 0x820400 => 1024 0x830f4240 => 1000000
func EncodeLenByte ¶
func EncodeLenInt64 ¶
func EncodeLenInt64InPlace ¶
func EncodeLength ¶
EncodeLength encodes int64 number to []byte. If it is less than 128 then it returns []byte{length}. Otherwise, it returns (0x80 | len of int64) + int64 as BigEndian []byte
67 => 0x43 1024 => 0x820400 1000000 => 0x830f4240
func EncodeLengthPlusData ¶
func EncodeLengthPlusData(idata interface{}) []byte
EncodeLengthPlusData encoding interface into []byte
func EscapeForJSON ¶
EscapeForJSON replaces quote to slash and quote
func EscapeName ¶
EscapeName deletes unaccessable characters for input name(s)
func FieldToBytes ¶
FieldToBytes returns the value of n-th field of v as []byte
func HexToBin ¶
func HexToBin(ihexdata interface{}) []byte
HexToBin converts hex interface to binary []byte
func InSliceString ¶
InSliceString searches the string in the slice of strings
func InterfaceSliceToStr ¶
InterfaceSliceToStr converts the slice of interfaces to the slice of strings
func InterfaceToFloat64 ¶
func InterfaceToFloat64(i interface{}) float64
InterfaceToFloat64 converts the interfaces to the float64
func InterfaceToStr ¶
InterfaceToStr converts the interfaces to the string
func IsByteColumn ¶
func IsLatin ¶
IsLatin checks if the specified string contains only latin character, digits and '-', '_'.
func IsValidAddress ¶
IsValidAddress checks if the specified address is apla address.
func RoundWithPrecision ¶
RoundWithPrecision rounds float64 value
func RoundWithoutPrecision ¶
RoundWithoutPrecision is round float64 without precision
func SanitizeName ¶
SanitizeName deletes unaccessable characters from name string
func SanitizeNumber ¶
SanitizeNumber deletes unaccessable characters from number or name string
func SanitizeScript ¶
SanitizeScript deletes unaccessable characters from input string
func StrToUint64 ¶
StrToUint64 converts string to the unsinged int64
func StringToAddress ¶
StringToAddress converts string apla address to int64 address. The input address can be a positive or negative number, or apla address in XXXX-...-XXXX format. Returns 0 when error occurs.
func ValueToInt ¶
ValueToInt converts interface (string or int64) to int64
Types ¶
This section is empty.