Documentation ¶
Overview ¶
Copyright (C) 2017, Zipper Team. All rights reserved.
This file is part of zipper ¶
The zipper is free software: you can use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
The zipper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ISC License for more details.
You should have received a copy of the ISC License along with this program. If not, see <https://opensource.org/licenses/isc>.
Index ¶
- Variables
- func AppDataDir(appName string, roaming bool) string
- func AssertEquals(t testing.TB, actual interface{}, expected interface{})
- func AssertNotEquals(t testing.TB, actual interface{}, expected interface{})
- func AssertSame(t testing.TB, actual interface{}, expected interface{})
- func ByteToFloat64(src []byte) float64
- func BytesToHex(byteSlice []byte) string
- func BytesToUint32(src []byte) uint32
- func BytesToUint32Arrary(src []byte) []uint32
- func CheckInt64Border(x, y int64) bool
- func Contain(obj interface{}, target interface{}) bool
- func CurrentTimestamp() uint32
- func DecodeUint32(bytes []byte, cnt uint32) ([]uint32, error)
- func DelStringFromSlice(val string, slice *[]string)
- func Deserialize(data []byte, obj interface{}) error
- func FileExist(filePath string) bool
- func Float64ToByte(src float64) []byte
- func HexToBytes(s string) []byte
- func IsDirEmpty(path string) (bool, error)
- func IsDirExist(path string) (bool, error)
- func IsDirMissingOrEmpty(path string) (bool, error)
- func MinimizeSilce(src []byte) []byte
- func OpenDir(dir string) (string, error)
- func OpenFile(path string) (*os.File, error)
- func ReadVarInt(r io.Reader) (uint64, error)
- func Serialize(obj interface{}) []byte
- func Uint32ArrayToBytes(arrary []uint32) []byte
- func Uint32ToBytes(src uint32) []byte
- func UnmarshalFixedText(input, out []byte) error
- func VarDecode(r io.Reader, val interface{}) error
- func VarEncode(w io.Writer, val interface{})
- func VarInt(n uint64) []byte
- func WriteVarInt(w io.Writer, count uint64)
- func ZeroMemory(s interface{})
- type Bytes
- type Times
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AppDataDir ¶
AppDataDir returns a default data directory for the databases
func AssertEquals ¶
func AssertNotEquals ¶
func AssertSame ¶
func ByteToFloat64 ¶
func BytesToHex ¶
func BytesToUint32 ¶
func BytesToUint32Arrary ¶
func CheckInt64Border ¶
func CurrentTimestamp ¶
func CurrentTimestamp() uint32
func DelStringFromSlice ¶
func Deserialize ¶
Deserialize deserializes bytes to object
func Float64ToByte ¶
func HexToBytes ¶
func IsDirEmpty ¶
IsDirEmpty determines whether a directory is empty
func IsDirExist ¶
IsDirExist determines whether a directory exists
func IsDirMissingOrEmpty ¶
IsDirMissingOrEmpty determines whether a directory is empty or missing
func MinimizeSilce ¶
func OpenDir ¶
OpenDir opens or creates a dir If the dir already exists, open it . If it does not, It will create the file with mode 0700.
func OpenFile ¶
OpenFile opens or creates a file If the file already exists, open it . If it does not, It will create the file with mode 0644.
func ReadVarInt ¶
ReadVarInt decodes varint and returns real length
func Uint32ArrayToBytes ¶
func Uint32ToBytes ¶
func UnmarshalFixedText ¶
UnmarshalFixedText decodes the input as a string with 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalText method for fixed-size types.
func VarInt ¶
VarInt converts n to varint bytes the raw protocol: https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer
func WriteVarInt ¶
WriteVarInt writes varint bytes to stream
Types ¶
type Bytes ¶
type Bytes []byte
Bytes marshals/unmarshals as a JSON string .
func (Bytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Bytes) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Bytes) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.