1
1
using System ;
2
2
using System . Linq . Expressions ;
3
3
using System . Runtime . Serialization ;
4
- using Elasticsearch . Net ;
5
4
using Elasticsearch . Net . Utf8Json ;
6
5
7
-
8
6
namespace Nest
9
7
{
10
8
/// <summary>
@@ -52,6 +50,13 @@ public interface ICsvProcessor : IProcessor
52
50
/// </summary>
53
51
[ DataMember ( Name = "trim" ) ]
54
52
bool ? Trim { get ; set ; }
53
+
54
+ /// <summary>
55
+ /// Value used to fill empty fields, empty fields will be skipped if this is not provided.
56
+ /// Empty field is one with no value (2 consecutive separators) or empty quotes (`""`)
57
+ /// </summary>
58
+ [ DataMember ( Name = "empty_value" ) ]
59
+ object EmptyValue { get ; set ; }
55
60
}
56
61
57
62
/// <inheritdoc cref="ICsvProcessor"/>
@@ -70,6 +75,8 @@ public class CsvProcessor : ProcessorBase, ICsvProcessor
70
75
/// <inheritdoc />
71
76
public bool ? Trim { get ; set ; }
72
77
/// <inheritdoc />
78
+ public object EmptyValue { get ; set ; }
79
+ /// <inheritdoc />
73
80
protected override string Name => "csv" ;
74
81
}
75
82
@@ -84,6 +91,7 @@ public class CsvProcessorDescriptor<T> : ProcessorDescriptorBase<CsvProcessorDes
84
91
string ICsvProcessor . Quote { get ; set ; }
85
92
string ICsvProcessor . Separator { get ; set ; }
86
93
bool ? ICsvProcessor . Trim { get ; set ; }
94
+ object ICsvProcessor . EmptyValue { get ; set ; }
87
95
88
96
/// <inheritdoc cref="ICsvProcessor.Field" />
89
97
public CsvProcessorDescriptor < T > Field ( Field field ) => Assign ( field , ( a , v ) => a . Field = v ) ;
@@ -110,5 +118,8 @@ public CsvProcessorDescriptor<T> TargetFields(Func<FieldsDescriptor<T>, IPromise
110
118
111
119
/// <inheritdoc cref="ICsvProcessor.Separator" />
112
120
public CsvProcessorDescriptor < T > Separator ( string separator ) => Assign ( separator , ( a , v ) => a . Separator = v ) ;
121
+
122
+ /// <inheritdoc cref="ICsvProcessor.EmptyValue" />
123
+ public CsvProcessorDescriptor < T > EmptyValue ( object value ) => Assign ( value , ( a , v ) => a . EmptyValue = v ) ;
113
124
}
114
125
}
0 commit comments