Files
realy/ratel/keys/index/prefixes.go
mleku bbebbe2b02 Add tracing with lol.Tracer in multiple functions.
Introduced `lol.Tracer` for function entry/exit logging across various packages. This improves traceability and debugging of function executions while preserving existing behavior. Removed unused files `doc.go` and `nothing.go` to clean up the repository.
2025-06-29 07:32:24 +01:00

36 lines
802 B
Go

package index
import (
"realy.lol/lol"
"realy.lol/ratel/keys"
)
type P byte
// Key writes a key with the P prefix byte and an arbitrary list of
// keys.Element.
func (p P) Key(element ...keys.Element) (b []byte) {
lol.Tracer("Key", element)
defer func() { lol.Tracer("end Key", b) }()
b = keys.Write(
append([]keys.Element{New(byte(p))}, element...)...)
return
}
// B returns the index.P as a byte.
func (p P) B() byte { return byte(p) }
// I returns the index.P as an int (for use with the KeySizes.
func (p P) I() int { return int(p) }
// GetAsBytes todo wat is dis?
func GetAsBytes(prf ...P) (b [][]byte) {
lol.Tracer("GetAsBytes", prf)
defer func() { lol.Tracer("end GetAsBytes", b) }()
b = make([][]byte, len(prf))
for i := range prf {
b[i] = []byte{byte(prf[i])}
}
return
}