/
uzer_007
/
reindexer
Обзор
Документация
Войти
/
uzer_007
/
reindexer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
cpp_src/core/cjson/cjsonmodifier.h
54 строки
2 KB
Sannikov Ilya
Update to version v5.11.0
06 фев 2026, 09:50
06 фев 2026, 09:50
e7fb0cd
Код
Авторство
О чём код?
#pragma once #include "core/cjson/tagspath.h" #include "core/payload/payloadiface.h" #include "core/payload/payloadtype.h" namespace reindexer { class TagsMatcher; class FloatVectorsHolderVector; class [[nodiscard]] CJsonModifier { public: CJsonModifier(TagsMatcher& tagsMatcher, PayloadType pt) noexcept : pt_(std::move(pt)), tagsMatcher_(tagsMatcher) {} void SetFieldValue(std::string_view tuple, const IndexedTagsPath& fieldPath, const VariantArray& val, WrSerializer& ser, const Payload& pl, FloatVectorsHolderVector&, ScalarIndexesSetT&); void SetObject(std::string_view tuple, const IndexedTagsPath& fieldPath, const VariantArray& val, WrSerializer& ser, const Payload& pl, FloatVectorsHolderVector&, ScalarIndexesSetT&); void RemoveField(std::string_view tuple, const IndexedTagsPath& fieldPath, WrSerializer& wrser, ScalarIndexesSetT&); private: struct [[nodiscard]] UpdateTagType { explicit UpdateTagType(TagType raw) noexcept : rawType{raw} {} UpdateTagType(TagType raw, FloatVectorDimension dims) noexcept : rawType{raw}, isFloatVectorRef{true}, valueDims{dims} {} TagType rawType; bool isFloatVectorRef = false; FloatVectorDimension valueDims; }; class Context; Context initState(std::string_view tuple, const IndexedTagsPath& fieldPath, const VariantArray& val, WrSerializer& ser, const Payload* pl, FieldModifyMode mode, FloatVectorsHolderVector&, ScalarIndexesSetT& objectScalarIndexes); bool updateFieldInTuple(Context& ctx); bool dropFieldInTuple(Context&, JustCopy); bool buildCJSON(Context& ctx); bool needToInsertField(const Context& ctx) const; void insertField(Context& ctx) const; void embedFieldValue(TagType, int field, Context& ctx, size_t idx) const; void updateObject(Context&, TagName) const; void updateArrayItem(TagType arrayType, const Variant& newValue, Context&) const; void writeCTag(const ctag& tag, Context& ctx); void updateArray(TagType atagType, uint32_t count, TagName, Context&); void copyArray(TagName, Context&); UpdateTagType determineUpdateTagType(const Context& ctx, int field) const; bool checkIfFoundTag(Context& ctx, TagType tag, bool isLastItem = false) const; bool isIndexed(int field) const noexcept { return (field >= 0); } PayloadType pt_; IndexedTagsPath fieldPath_, tagsPath_; TagsMatcher& tagsMatcher_; }; } // namespace reindexer