iceberg-cpp
Loading...
Searching...
No Matches
conversions.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
22#include <span>
23#include <vector>
24
25#include "iceberg/expression/literal.h"
26#include "iceberg/result.h"
27#include "iceberg/type_fwd.h"
28
31
32namespace iceberg {
33
35class ICEBERG_EXPORT Conversions {
36 public:
41 static Result<std::vector<uint8_t>> ToBytes(const PrimitiveType& type,
42 const Literal::Value& value);
43
47 static Result<std::vector<uint8_t>> ToBytes(const Literal& literal);
48
54 static Result<Literal::Value> FromBytes(const PrimitiveType& type,
55 std::span<const uint8_t> data);
56
61 static Result<Literal> FromBytes(std::shared_ptr<PrimitiveType> type,
62 std::span<const uint8_t> data);
63};
64
65} // namespace iceberg
Conversion utilities for primitive types.
Definition conversions.h:35
Literal is a literal value that is associated with a primitive type.
Definition literal.h:39
A data type that does not have child fields.
Definition type.h:66