• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Giorgi / DuckDB.NET / 12297337260

12 Dec 2024 01:24PM UTC coverage: 89.839% (-0.2%) from 90.009%
12297337260

push

github

Giorgi
Append DateTimeOffset to TIMESTAMPTZ column, refactor code

1078 of 1233 branches covered (87.43%)

Branch coverage included in aggregate %.

10 of 14 new or added lines in 3 files covered. (71.43%)

2096 of 2300 relevant lines covered (91.13%)

762422.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.09
/DuckDB.NET.Data/Internal/Writer/DateTimeVectorDataWriter.cs
1
using System;
2
using DuckDB.NET.Data.Extensions;
3
using DuckDB.NET.Native;
4

5
namespace DuckDB.NET.Data.Internal.Writer;
6

7
internal sealed unsafe class DateTimeVectorDataWriter(IntPtr vector, void* vectorData, DuckDBType columnType) : VectorDataWriterBase(vector, vectorData, columnType)
66✔
8
{
9
    internal override bool AppendDateTime(DateTime value, ulong rowIndex)
10
    {
11
        if (ColumnType == DuckDBType.Date)
759,039✔
12
        {
13
            return AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToDate((DuckDBDateOnly)value.Date), rowIndex);
743,616✔
14
        }
15

16
        var timestamp = value.ToTimestampStruct(ColumnType);
15,423✔
17

18
        return AppendValueInternal(timestamp, rowIndex);
15,423✔
19
    }
20

21
    internal override bool AppendDateTimeOffset(DateTimeOffset value, ulong rowIndex)
22
    {
23
        if (ColumnType == DuckDBType.TimeTz)
60!
24
        {
25
            var timeTz = value.ToTimeTzStruct();
60✔
26

27
            return AppendValueInternal(timeTz, rowIndex);
60✔
28
        }
29

NEW
30
        if (ColumnType == DuckDBType.TimestampTz)
×
31
        {
NEW
32
            var timestamp = value.ToTimestampStruct();
×
33

NEW
34
            return AppendValueInternal(timestamp, rowIndex);
×
35
        }
36

NEW
37
        return base.AppendDateTimeOffset(value, rowIndex);
×
38
    }
39

40
#if NET6_0_OR_GREATER
41
    internal override bool AppendDateOnly(DateOnly value, ulong rowIndex) => AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToDate(value), rowIndex);
120✔
42

43
    internal override bool AppendTimeOnly(TimeOnly value, ulong rowIndex) => AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToTime(value), rowIndex);
60✔
44
#endif
45

46
    internal override bool AppendDateOnly(DuckDBDateOnly value, ulong rowIndex) => AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToDate(value), rowIndex);
×
47

48
    internal override bool AppendTimeOnly(DuckDBTimeOnly value, ulong rowIndex) => AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToTime(value), rowIndex);
×
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc