aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ClickHouse/ch-go/proto/col_bool.go
blob: 0974e53c06d0b23b18676323fd5aa877add47039 (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
50
51
52
53
package proto

// ColBool is Bool column.
type ColBool []bool

// Compile-time assertions for ColBool.
var (
	_ ColInput       = ColBool{}
	_ ColResult      = (*ColBool)(nil)
	_ Column         = (*ColBool)(nil)
	_ ColumnOf[bool] = (*ColBool)(nil)
)

func (c ColBool) Row(i int) bool {
	return c[i]
}

func (c *ColBool) Append(v bool) {
	*c = append(*c, v)
}

func (c *ColBool) AppendArr(vs []bool) {
	*c = append(*c, vs...)
}

// Type returns ColumnType of Bool.
func (ColBool) Type() ColumnType {
	return ColumnTypeBool
}

// Rows returns count of rows in column.
func (c ColBool) Rows() int {
	return len(c)
}

// Reset resets data in row, preserving capacity for efficiency.
func (c *ColBool) Reset() {
	*c = (*c)[:0]
}

// Array is helper that creates Array(Bool).
func (c *ColBool) Array() *ColArr[bool] {
	return &ColArr[bool]{
		Data: c,
	}
}

// Nullable is helper that creates Nullable(Bool).
func (c *ColBool) Nullable() *ColNullable[bool] {
	return &ColNullable[bool]{
		Values: c,
	}
}