db/cmd/samples/header_encode.go

28 lines
506 B
Go
Raw Permalink Normal View History

package main
import (
"crypto/rand"
"fmt"
"git.zutto.fi/zutto/db/pkg/headers"
)
func main() {
h := headers.Headers{
HeaderString: []byte(headers.HeaderString),
PageSize: uint64(256 ^ 2),
DBVersion: uint16(1),
WAL: false,
Commit: make([]byte, headers.CommitDataLength),
}
//generate random string for the commit..
_, err := rand.Read(h.Commit[:headers.CommitDataLength])
if err != nil {
fmt.Errorf("Failed to generate random string")
}
fmt.Printf("%c", h.Generate())
}