removed DATATYPE_USERSUB and replaced with DATATYPE_USERDATA

This commit is contained in:
Alfred Kamanda 2024-12-04 20:38:52 +03:00
parent b615c27cf6
commit 4ecfc9de38
Signed by untrusted user: Alfred-mk
GPG Key ID: 7EA3D01708908703

View File

@ -6,10 +6,6 @@ import (
"git.defalsify.org/vise.git/db" "git.defalsify.org/vise.git/db"
) )
const (
DATATYPE_USERSUB = 64
)
// PrefixDb interface abstracts the database operations. // PrefixDb interface abstracts the database operations.
type PrefixDb interface { type PrefixDb interface {
Get(ctx context.Context, key []byte) ([]byte, error) Get(ctx context.Context, key []byte) ([]byte, error)
@ -35,13 +31,13 @@ func (s *SubPrefixDb) toKey(k []byte) []byte {
} }
func (s *SubPrefixDb) Get(ctx context.Context, key []byte) ([]byte, error) { func (s *SubPrefixDb) Get(ctx context.Context, key []byte) ([]byte, error) {
s.store.SetPrefix(DATATYPE_USERSUB) s.store.SetPrefix(db.DATATYPE_USERDATA)
key = s.toKey(key) key = s.toKey(key)
return s.store.Get(ctx, key) return s.store.Get(ctx, key)
} }
func (s *SubPrefixDb) Put(ctx context.Context, key []byte, val []byte) error { func (s *SubPrefixDb) Put(ctx context.Context, key []byte, val []byte) error {
s.store.SetPrefix(DATATYPE_USERSUB) s.store.SetPrefix(db.DATATYPE_USERDATA)
key = s.toKey(key) key = s.toKey(key)
return s.store.Put(ctx, key, val) return s.store.Put(ctx, key, val)
} }