From 03c024c1a80343ee708ab6b66093b3a7d81d2d90 Mon Sep 17 00:00:00 2001 From: Pavel Merzlyakov Date: Fri, 1 Sep 2023 17:14:09 +0300 Subject: [PATCH] fix read/write generic helpers --- meta.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meta.go b/meta.go index 573a8d0..eb344a3 100644 --- a/meta.go +++ b/meta.go @@ -1,12 +1,14 @@ package meta +const classField = "$id" + func ReadGeneric(r Reader, createFunc StructFactory, field string) (Readable, error) { if err := r.BeginContainer(field); err != nil { return nil, err } var classId uint32 - if err := r.ReadUint32(&classId, ""); err != nil { + if err := r.ReadUint32(&classId, classField); err != nil { return nil, err } @@ -30,7 +32,7 @@ func WriteGeneric(w Writer, s WritableClass, field string) error { if err := w.BeginCollection(s.FieldsCount()+1, field); err != nil { return err } - if err := w.WriteUint32(s.ClassId(), ""); err != nil { + if err := w.WriteUint32(s.ClassId(), classField); err != nil { return err } if err := s.WriteFields(w); err != nil {