1#include "duckdb/parser/constraints/not_null_constraint.hpp"
2
3#include "duckdb/common/field_writer.hpp"
4
5namespace duckdb {
6
7NotNullConstraint::NotNullConstraint(LogicalIndex index) : Constraint(ConstraintType::NOT_NULL), index(index) {
8}
9
10NotNullConstraint::~NotNullConstraint() {
11}
12
13string NotNullConstraint::ToString() const {
14 return "NOT NULL";
15}
16
17unique_ptr<Constraint> NotNullConstraint::Copy() const {
18 return make_uniq<NotNullConstraint>(args: index);
19}
20
21void NotNullConstraint::Serialize(FieldWriter &writer) const {
22 writer.WriteField<idx_t>(element: index.index);
23}
24
25unique_ptr<Constraint> NotNullConstraint::Deserialize(FieldReader &source) {
26 auto index = source.ReadRequired<idx_t>();
27 return make_uniq_base<Constraint, NotNullConstraint>(args: LogicalIndex(index));
28}
29
30} // namespace duckdb
31