aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ClickHouse/ch-go/proto/col_date.go
blob: 5bf75b3b73fd5032487e45ad39c22e4dfe860fe9 (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package proto

import "time"

func (c *ColDate) Append(v time.Time) {
	*c = append(*c, ToDate(v))
}

func (c *ColDate) AppendArr(vs []time.Time) {
	var dates = make([]Date, len(vs))

	for i, v := range vs {
		dates[i] = ToDate(v)
	}

	*c = append(*c, dates...)
}

func (c ColDate) Row(i int) time.Time {
	return c[i].Time()
}

// LowCardinality returns LowCardinality for Enum8 .
func (c *ColDate) LowCardinality() *ColLowCardinality[time.Time] {
	return &ColLowCardinality[time.Time]{
		index: c,
	}
}

// Array is helper that creates Array of Enum8.
func (c *ColDate) Array() *ColArr[time.Time] {
	return &ColArr[time.Time]{
		Data: c,
	}
}

// Nullable is helper that creates Nullable(Enum8).
func (c *ColDate) Nullable() *ColNullable[time.Time] {
	return &ColNullable[time.Time]{
		Values: c,
	}
}

// NewArrDate returns new Array(Date).
func NewArrDate() *ColArr[time.Time] {
	return &ColArr[time.Time]{
		Data: new(ColDate),
	}
}