|
20 | 20 | #include "iceberg/schema_field.h" |
21 | 21 |
|
22 | 22 | #include <format> |
| 23 | +#include <string_view> |
23 | 24 |
|
24 | 25 | #include "iceberg/type.h" |
25 | 26 | #include "iceberg/util/formatter.h" // IWYU pragma: keep |
26 | 27 |
|
27 | 28 | namespace iceberg { |
28 | 29 |
|
29 | | -SchemaField::SchemaField(int32_t field_id, std::string name, std::shared_ptr<Type> type, |
30 | | - bool optional, std::string doc) |
| 30 | +SchemaField::SchemaField(int32_t field_id, std::string_view name, |
| 31 | + std::shared_ptr<Type> type, bool optional, std::string_view doc) |
31 | 32 | : field_id_(field_id), |
32 | | - name_(std::move(name)), |
| 33 | + name_(name), |
33 | 34 | type_(std::move(type)), |
34 | 35 | optional_(optional), |
35 | | - doc_(std::move(doc)) {} |
| 36 | + doc_(doc) {} |
36 | 37 |
|
37 | | -SchemaField SchemaField::MakeOptional(int32_t field_id, std::string name, |
38 | | - std::shared_ptr<Type> type, std::string doc) { |
39 | | - return {field_id, std::move(name), std::move(type), true, std::move(doc)}; |
| 38 | +SchemaField SchemaField::MakeOptional(int32_t field_id, std::string_view name, |
| 39 | + std::shared_ptr<Type> type, std::string_view doc) { |
| 40 | + return {field_id, name, std::move(type), true, doc}; |
40 | 41 | } |
41 | 42 |
|
42 | | -SchemaField SchemaField::MakeRequired(int32_t field_id, std::string name, |
43 | | - std::shared_ptr<Type> type, std::string doc) { |
44 | | - return {field_id, std::move(name), std::move(type), false, std::move(doc)}; |
| 43 | +SchemaField SchemaField::MakeRequired(int32_t field_id, std::string_view name, |
| 44 | + std::shared_ptr<Type> type, std::string_view doc) { |
| 45 | + return {field_id, name, std::move(type), false, doc}; |
45 | 46 | } |
46 | 47 |
|
47 | 48 | int32_t SchemaField::field_id() const { return field_id_; } |
|
0 commit comments