1// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
 2//
 3// SPDX-License-Identifier: AGPL-3.0-or-later
 4
 5package db
 6
 7import (
 8	"encoding/binary"
 9	"encoding/hex"
10	"fmt"
11)
12
13func putUint64(dst []byte, v uint64) {
14	binary.BigEndian.PutUint64(dst, v)
15}
16
17func readUint64(src []byte) uint64 {
18	return binary.BigEndian.Uint64(src)
19}
20
21// Uint64Hex renders v as a zero-padded lower-case hexadecimal string.
22func Uint64Hex(v uint64) string {
23	return fmt.Sprintf("%016x", v)
24}
25
26func encodeHex(b []byte) string {
27	return hex.EncodeToString(b)
28}