lbug 0.16.1

An in-process property graph database management system built for query speed and scalability
Documentation
#include "binder/expression/literal_expression.h"

#include "common/exception/binder.h"
#include <format>

using namespace lbug::common;

namespace lbug {
namespace binder {

void LiteralExpression::cast(const LogicalType& type) {
    // The following is a safeguard to make sure we are not changing literal type unexpectedly.
    if (!value.allowTypeChange()) {
        // LCOV_EXCL_START
        throw BinderException(
            std::format("Cannot change literal expression data type from {} to {}.",
                dataType.toString(), type.toString()));
        // LCOV_EXCL_STOP
    }
    dataType = type.copy();
    value.setDataType(type);
}

} // namespace binder
} // namespace lbug