-
Notifications
You must be signed in to change notification settings - Fork 12
/
nothing.go
58 lines (46 loc) · 1.13 KB
/
nothing.go
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
54
55
56
57
58
package column
import (
"github.com/bytehouse-cloud/driver-go/driver/lib/bytepool"
"github.com/bytehouse-cloud/driver-go/driver/lib/ch_encoding"
)
type NothingColumnData struct {
raw []byte
isClosed bool
}
func (n *NothingColumnData) ReadFromValues(values []interface{}) (int, error) {
return 0, nil
}
func (n *NothingColumnData) ReadFromTexts(texts []string) (int, error) {
return 0, nil
}
func (n *NothingColumnData) ReadFromDecoder(decoder *ch_encoding.Decoder) error {
_, err := decoder.Read(n.raw)
return err
}
func (n *NothingColumnData) WriteToEncoder(encoder *ch_encoding.Encoder) error {
_, err := encoder.Write(n.raw)
return err
}
func (n *NothingColumnData) GetValue(row int) interface{} {
return nil
}
func (n *NothingColumnData) GetString(row int) string {
return emptyString
}
func (n *NothingColumnData) Zero() interface{} {
return nil
}
func (n *NothingColumnData) ZeroString() string {
return emptyString
}
func (n *NothingColumnData) Len() int {
return len(n.raw)
}
func (n *NothingColumnData) Close() error {
if n.isClosed {
return nil
}
n.isClosed = true
bytepool.PutBytes(n.raw)
return nil
}