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

Giorgi / DuckDB.NET / 9095397334

15 May 2024 12:10PM UTC coverage: 89.5% (-0.3%) from 89.79%
9095397334

push

github

Giorgi
Merge branch 'Appender-Data-Chunk' (early part) into develop

663 of 770 branches covered (86.1%)

Branch coverage included in aggregate %.

262 of 293 new or added lines in 22 files covered. (89.42%)

9 existing lines in 2 files now uncovered.

1485 of 1630 relevant lines covered (91.1%)

11521.31 hits per line

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

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

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

6
internal sealed unsafe class DateTimeVectorDataWriter(IntPtr vector, void* vectorData, DuckDBType columnType) : VectorDataWriterBase(vector, vectorData, columnType)
36✔
7
{
8
    internal override bool AppendDateTime(DateTime value, int rowIndex)
9
    {
10
        if (ColumnType == DuckDBType.Date)
330!
11
        {
NEW
12
            return AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToDate((DuckDBDateOnly)value.Date), rowIndex);
×
13
        }
14

15
        var timestamp = NativeMethods.DateTimeHelpers.DuckDBToTimestamp(DuckDBTimestamp.FromDateTime(value));
330✔
16

17
        if (ColumnType == DuckDBType.TimestampNs)
330✔
18
        {
19
            timestamp.Micros *= 1000;
60✔
20
        }
21

22
        if (ColumnType == DuckDBType.TimestampMs)
330✔
23
        {
24
            timestamp.Micros /= 1000;
60✔
25
        }
26

27
        if (ColumnType == DuckDBType.TimestampS)
330✔
28
        {
29
            timestamp.Micros /= 1000000;
60✔
30
        }
31

32
        return AppendValueInternal(timestamp, rowIndex);
330✔
33
    }
34

35
    internal override bool AppendDateTimeOffset(DateTimeOffset value, int rowIndex)
36
    {
37
        var time = NativeMethods.DateTimeHelpers.DuckDBToTime((DuckDBTimeOnly)value.DateTime);
60✔
38
        var timeTz = NativeMethods.DateTimeHelpers.DuckDBCreateTimeTz(time.Micros, (int)value.Offset.TotalSeconds);
60✔
39

40
        return AppendValueInternal(timeTz, rowIndex);
60✔
41
    }
42

43
#if NET6_0_OR_GREATER
44
    internal override bool AppendDateOnly(DateOnly value, int rowIndex) => AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToDate(value), rowIndex);
60✔
45

46
    internal override bool AppendTimeOnly(TimeOnly value, int rowIndex) => AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToTime(value), rowIndex);
60✔
47
#endif
48

NEW
49
    internal override bool AppendDateOnly(DuckDBDateOnly value, int rowIndex) => AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToDate(value), rowIndex);
×
50

NEW
51
    internal override bool AppendTimeOnly(DuckDBTimeOnly value, int rowIndex) => AppendValueInternal(NativeMethods.DateTimeHelpers.DuckDBToTime(value), rowIndex);
×
52
}
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

© 2025 Coveralls, Inc