initial commits

master
Charles Iliya Krempeaux 2021-11-07 21:05:57 -08:00
parent b42905d454
commit 412a131137
1 changed files with 7 additions and 4 deletions

View File

@ -9,8 +9,8 @@ import (
)
const (
serializationprefix = "x"
serializationsuffix = ".id"
serializationprefix = "xi"
serializationsuffix = "m"
)
var (
@ -27,7 +27,6 @@ func serialize(value uint64) string {
var binstorage bytes.Buffer
{
err := binary.Write(&binstorage, binary.BigEndian, value)
if nil != err {
return ""
@ -84,12 +83,16 @@ func unserialize(value string) (uint64, bool) {
var result uint64
{
var reader io.Reader = bytes.NewReader(p)
var reader *bytes.Reader = bytes.NewReader(p)
err := binary.Read(reader, binary.BigEndian, &result)
if nil != err {
return badvalue, false
}
if expected, actual := 0, reader.Len(); expected != actual {
return badvalue, false
}
}
return result, true