forked from influxdata/influxdb-client-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefaultDomainObjectMapper.cs
32 lines (28 loc) · 999 Bytes
/
DefaultDomainObjectMapper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using InfluxDB.Client.Api.Domain;
using InfluxDB.Client.Core.Flux.Domain;
using InfluxDB.Client.Core.Flux.Internal;
using InfluxDB.Client.Writes;
namespace InfluxDB.Client.Internal
{
/// <summary>
/// Default implementation of DomainObject mapper.
/// </summary>
internal class DefaultDomainObjectMapper : IDomainObjectMapper
{
private readonly FluxResultMapper _resultMapper = new FluxResultMapper();
private readonly MeasurementMapper _measurementMapper = new MeasurementMapper();
public T ConvertToEntity<T>(FluxRecord fluxRecord)
{
return _resultMapper.ToPoco<T>(fluxRecord);
}
public object ConvertToEntity(FluxRecord fluxRecord, Type type)
{
return _resultMapper.ToPoco(fluxRecord, type);
}
public PointData ConvertToPointData<T>(T entity, WritePrecision precision)
{
return _measurementMapper.ToPoint(entity, precision);
}
}
}