|
19 | 19 |
|
20 | 20 | #pragma once |
21 | 21 |
|
| 22 | + |
22 | 23 | #include <nlohmann/json_fwd.hpp> |
23 | 24 |
|
24 | 25 | #include "iceberg/expression/expression.h" |
@@ -134,6 +135,63 @@ ICEBERG_EXPORT Result<std::unique_ptr<UnboundPredicate>> UnboundPredicateFromJso |
134 | 135 | /// \return A JSON value representing the term, or an error |
135 | 136 | ICEBERG_EXPORT Result<nlohmann::json> ToJson(const Term& term); |
136 | 137 |
|
| 138 | +/// \brief Deserializes a JSON object into a NamedReference. |
| 139 | +/// |
| 140 | +/// \param json A JSON object representing a named reference |
| 141 | +/// \return A shared pointer to the deserialized NamedReference or an error |
| 142 | +ICEBERG_EXPORT Result<std::unique_ptr<NamedReference>> NamedReferenceFromJson( |
| 143 | + const nlohmann::json& json); |
| 144 | + |
| 145 | +/// \brief Serializes a NamedReference into its JSON representation. |
| 146 | +/// |
| 147 | +/// \param ref The named reference to serialize |
| 148 | +/// \return A JSON object representing the named reference |
| 149 | +ICEBERG_EXPORT nlohmann::json ToJson(const NamedReference& ref); |
| 150 | + |
| 151 | +/// \brief Serializes an UnboundTransform into its JSON representation. |
| 152 | +/// |
| 153 | +/// \param transform The unbound transform to serialize |
| 154 | +/// \return A JSON object representing the unbound transform |
| 155 | +ICEBERG_EXPORT nlohmann::json ToJson(const UnboundTransform& transform); |
| 156 | + |
| 157 | +/// \brief Deserializes a JSON object into an UnboundTransform. |
| 158 | +/// |
| 159 | +/// \param json A JSON object representing an unbound transform |
| 160 | +/// \return A shared pointer to the deserialized UnboundTransform or an error |
| 161 | +ICEBERG_EXPORT Result<std::unique_ptr<UnboundTransform>> UnboundTransformFromJson( |
| 162 | + const nlohmann::json& json); |
| 163 | + |
| 164 | +/// \brief Serializes a Literal into its JSON representation. |
| 165 | +/// |
| 166 | +/// \param literal The literal to serialize |
| 167 | +/// \return A JSON value representing the literal |
| 168 | +ICEBERG_EXPORT nlohmann::json ToJson(const Literal& literal); |
| 169 | + |
| 170 | +/// \brief Deserializes a JSON value into a Literal. |
| 171 | +/// |
| 172 | +/// \param json A JSON value representing a literal |
| 173 | +/// \return The deserialized Literal or an error |
| 174 | +ICEBERG_EXPORT Result<Literal> LiteralFromJson(const nlohmann::json& json); |
| 175 | + |
| 176 | +/// \brief Serializes an UnboundPredicate into its JSON representation. |
| 177 | +/// |
| 178 | +/// \param pred The unbound predicate to serialize |
| 179 | +/// \return A JSON object representing the predicate |
| 180 | +ICEBERG_EXPORT nlohmann::json ToJson(const UnboundPredicate& pred); |
| 181 | + |
| 182 | +/// \brief Deserializes a JSON object into an UnboundPredicate. |
| 183 | +/// |
| 184 | +/// \param json A JSON object representing an unbound predicate |
| 185 | +/// \return A shared pointer to the deserialized UnboundPredicate or an error |
| 186 | +ICEBERG_EXPORT Result<std::unique_ptr<UnboundPredicate>> UnboundPredicateFromJson( |
| 187 | + const nlohmann::json& json); |
| 188 | + |
| 189 | +/// \brief Serializes a Term into its JSON representation. |
| 190 | +/// |
| 191 | +/// \param term The term to serialize (NamedReference or UnboundTransform) |
| 192 | +/// \return A JSON value representing the term |
| 193 | +ICEBERG_EXPORT nlohmann::json TermToJson(const Term& term); |
| 194 | + |
137 | 195 | /// Check if an operation is a unary predicate |
138 | 196 | ICEBERG_EXPORT bool IsUnaryOperation(Expression::Operation op); |
139 | 197 |
|
|
0 commit comments