Golang encoding/binary.PutUvarint() function example
package encoding/binary
PutUvarint encodes a uint64 into buf(1st parameter) and returns the number of bytes written. If the buffer is too small, PutUvarint will panic.
Golang encoding/binary.PutUvarint() function usage example
func encodeBlockHandle(dst []byte, b blockHandle) int {
n := binary.PutUvarint(dst, b.offset)
m := binary.PutUvarint(dst[n:], b.length)
return n + m
}
References :
http://golang.org/pkg/encoding/binary/#PutUvarint
https://github.com/syndtr/goleveldb/blob/master/leveldb/table/table.go
Advertisement
Something interesting
Tutorials
+7.3k Golang : Of hash table and hash map
+33k Golang : How to check if a date is within certain range?
+11k How to test Facebook App on localhost ?
+14.9k Golang : How to check for empty array string or string?
+14k Golang : Reverse IP address for reverse DNS lookup example
+12.3k Golang : Validate email address
+5k Golang : Calculate a pip value and distance to target profit example
+7k Golang : Gargish-English language translator
+5.7k Unix/Linux/MacOSx : Get local IP address
+18.1k Golang : Convert IPv4 address to decimal number(base 10) or integer
+23.9k Golang : Fix type interface{} has no field or no methods and type assertions example
+24.6k Golang : How to validate URL the right way