STOR-519: Add db-connect, a SQL over HTTPS server

This commit is contained in:
Ashcon Partovi
2019-08-20 13:13:29 -05:00
parent 28f6c2ed7c
commit 5da2109811
410 changed files with 362649 additions and 666 deletions

View File

@@ -0,0 +1,43 @@
package column
import (
"github.com/kshvakov/clickhouse/lib/binary"
)
type UInt8 struct{ base }
func (UInt8) Read(decoder *binary.Decoder) (interface{}, error) {
v, err := decoder.UInt8()
if err != nil {
return uint8(0), err
}
return v, nil
}
func (u *UInt8) Write(encoder *binary.Encoder, v interface{}) error {
switch v := v.(type) {
case bool:
return encoder.Bool(v)
case uint8:
return encoder.UInt8(v)
case int64:
return encoder.UInt8(uint8(v))
case int:
return encoder.UInt8(uint8(v))
// this relies on Nullable never sending nil values through
case *bool:
return encoder.Bool(*v)
case *uint8:
return encoder.UInt8(*v)
case *int64:
return encoder.UInt8(uint8(*v))
case *int:
return encoder.UInt8(uint8(*v))
}
return &ErrUnexpectedType{
T: v,
Column: u,
}
}