func (r *rowImpl) SetInt16(colName string, value int16) (err error) {
	return r.SetUint16(colName, uint16(value))
}
SetInt16 modifies a single int16 from the column with the given name.
package partition
import (
	"encoding/binary"
	"fmt"
	"math"
	"strings"
	time "time"
	"github.com/go-sif/sif"
	errors "github.com/go-sif/sif/errors"
)
const (
	colValueIsNilFlag = 1 << iota
)
type rowImpl struct {
	rowNum    int
	partition *partitionImpl
}
func CreateTempRow() sif.Row {
	return &rowImpl{}
}
func (r *rowImpl) GetPartID() string {
	return r.partition.ID()
}
func (r *rowImpl) GetKey() (uint64, error) {
	if !r.partition.IsKeyed() {
		return 0, fmt.Errorf("cannot fetch the key for a Row from an unkeyed Partition")
	}
	return r.partition.internalData.Keys[r.rowNum], nil
}
func (r *rowImpl) Schema() sif.Schema {
	return r.partition.schema.Clone()  
}
func (r *rowImpl) ToString() string {
	var res strings.Builder
	fmt.Fprint(&res, "{")
	r.partition.schema.ForEachColumn(func(name string, col sif.Column) error {
		var val string
		if r.IsNil(name) {
			val = "nil"
		} else {
			v, err := r.Get(name)
			if err != nil {
				return err
			}
			val = col.Type().ToString(v)
		}
		fmt.Fprintf(&res, "\"%s\": %s,", name, val)
		return nil
	})
	fmt.Fprint(&res, "}")
	return res.String()
}
func (r *rowImpl) CheckIsNil(colName string) error {
	if r.partition.internalData.ColData[colName].Meta[r.rowNum]&colValueIsNilFlag > 0 {
		return errors.NilValueError{Name: colName}
	}
	return nil
}
func (r *rowImpl) IsNil(colName string) bool {
	_, err := r.partition.schema.GetColumn(colName)
	if err != nil {
		return false
	}
	return r.CheckIsNil(colName) != nil
}
func (r *rowImpl) SetNil(colName string) error {
	col, err := r.partition.schema.GetColumn(colName)
	if err != nil {
		return err
	}
	defer r.partition.setColumnDirty(colName)
	r.partition.internalData.ColData[colName].Meta[r.rowNum] = r.partition.internalData.ColData[colName].Meta[r.rowNum] | colValueIsNilFlag
	if sif.IsVariableLength(col.Type()) {
		if data, ok := r.partition.activeVarLengthData[colName]; ok {
			data[r.rowNum] = nil
		}
	}
	return nil
}
func (r *rowImpl) SetNotNil(colName string) {
	defer r.partition.setColumnDirty(colName)
	r.partition.internalData.ColData[colName].Meta[r.rowNum] = r.partition.internalData.ColData[colName].Meta[r.rowNum] &^ colValueIsNilFlag
}
func (r *rowImpl) Get(colName string) (col interface{}, err error) {
	offset, err := r.Schema().GetColumn(colName)
	if err != nil {
		return nil, err
	} else if sif.IsVariableLength(offset.Type()) {
		switch offset.Type().(type) {
		case *sif.VarStringColumnType:
			return r.GetVarString(colName)
		case *sif.VarBytesColumnType:
			return r.GetVarBytes(colName)
		default:
			return r.GetVarCustomData(colName)
		}
	} else {
		switch offset.Type().(type) {
		case *sif.ByteColumnType:
			return r.GetByte(colName)
		case *sif.BytesColumnType:
			return r.GetBytes(colName)
		case *sif.BoolColumnType:
			return r.GetBool(colName)
		case *sif.Uint8ColumnType:
			return r.GetUint8(colName)
		case *sif.Uint16ColumnType:
			return r.GetUint16(colName)
		case *sif.Uint32ColumnType:
			return r.GetUint32(colName)
		case *sif.Uint64ColumnType:
			return r.GetUint64(colName)
		case *sif.Int8ColumnType:
			return r.GetInt8(colName)
		case *sif.Int16ColumnType:
			return r.GetInt16(colName)
		case *sif.Int32ColumnType:
			return r.GetInt32(colName)
		case *sif.Int64ColumnType:
			return r.GetInt64(colName)
		case *sif.Float32ColumnType:
			return r.GetFloat32(colName)
		case *sif.Float64ColumnType:
			return r.GetFloat64(colName)
		case *sif.TimeColumnType:
			return r.GetTime(colName)
		case *sif.StringColumnType:
			return r.GetString(colName)
		default:
			return nil, fmt.Errorf("cannot fetch value for unknown column type")
		}
	}
}
func (r *rowImpl) GetByte(colName string) (val byte, err error) {
	_, err = r.partition.schema.GetColumn(colName)
	if err != nil {
		return
	}
	err = r.CheckIsNil(colName)
	if err != nil {
		return
	}
	err = r.partition.deserializeColumn(colName)
	if err != nil {
		return
	}
	val = r.partition.activeColData[colName][r.rowNum]
	return
}
func (r *rowImpl) GetBytes(colName string) (val []byte, err error) {
	col, err := r.partition.schema.GetColumn(colName)
	if err != nil {
		return
	}
	err = r.CheckIsNil(colName)
	if err != nil {
		return
	}
	err = r.partition.deserializeColumn(colName)
	if err != nil {
		return
	}
	start := r.rowNum * col.Type().Size()
	end := start + col.Type().Size()
	val = r.partition.activeColData[colName][start:end]
	return
}
func (r *rowImpl) GetBool(colName string) (val bool, err error) {
	data, err := r.GetByte(colName)
	if err != nil {
		return
	}
	val = data > 0
	return
}
func (r *rowImpl) GetUint8(colName string) (val uint8, err error) {
	data, err := r.GetByte(colName)
	if err != nil {
		return
	}
	val = uint8(data)
	return
}
func (r *rowImpl) GetUint16(colName string) (val uint16, err error) {
	data, err := r.GetBytes(colName)
	if err != nil {
		return
	}
	val = binary.LittleEndian.Uint16(data)
	return
}
func (r *rowImpl) GetUint32(colName string) (val uint32, err error) {
	data, err := r.GetBytes(colName)
	if err != nil {
		return
	}
	val = binary.LittleEndian.Uint32(data)
	return
}
func (r *rowImpl) GetUint64(colName string) (val uint64, err error) {
	data, err := r.GetBytes(colName)
	if err != nil {
		return
	}
	val = binary.LittleEndian.Uint64(data)
	return
}
func (r *rowImpl) GetInt8(colName string) (val int8, err error) {
	data, err := r.GetByte(colName)
	if err != nil {
		return
	}
	val = int8(data)
	return
}
func (r *rowImpl) GetInt16(colName string) (col int16, err error) {
	result, err := r.GetUint16(colName)
	if err != nil {
		return
	}
	col = int16(result)
	return
}
func (r *rowImpl) GetInt32(colName string) (col int32, err error) {
	result, err := r.GetUint32(colName)
	if err != nil {
		return
	}
	col = int32(result)
	return
}
func (r *rowImpl) GetInt64(colName string) (col int64, err error) {
	result, err := r.GetUint64(colName)
	if err != nil {
		return
	}
	col = int64(result)
	return
}
func (r *rowImpl) GetFloat32(colName string) (col float32, err error) {
	bits, err := r.GetUint32(colName)
	if err != nil {
		return
	}
	col = math.Float32frombits(bits)
	return
}
func (r *rowImpl) GetFloat64(colName string) (col float64, err error) {
	bits, err := r.GetUint64(colName)
	if err != nil {
		return
	}
	col = math.Float64frombits(bits)
	return
}
func (r *rowImpl) GetTime(colName string) (col time.Time, err error) {
	bits, err := r.GetBytes(colName)
	if err != nil {
		return
	}
	col = time.Now()
	err = col.UnmarshalBinary(bits)
	if err != nil {
		return
	}
	return
}
func (r *rowImpl) GetString(colName string) (string, error) {
	bits, err := r.GetBytes(colName)
	if err != nil {
		return "", err
	}
	return string(bits), nil
}
func (r *rowImpl) GetVarCustomData(colName string) (interface{}, error) {
	col, err := r.partition.schema.GetColumn(colName)
	if err != nil {
		return nil, err
	}
	if !sif.IsVariableLength(col.Type()) {
		return nil, fmt.Errorf("column %s is not a VarColumnType", colName)
	}
	err = r.CheckIsNil(colName)
	if err != nil {
		return nil, err
	}
	err = r.partition.deserializeColumn(colName)
	if err != nil {
		return nil, err
	}
	return r.partition.activeVarLengthData[colName][r.rowNum], nil
}
func (r *rowImpl) GetVarBytes(colName string) (col []byte, err error) {
	val, err := r.GetVarCustomData(colName)
	if err != nil {
		return nil, err
	}
	return val.([]byte), nil
}
func (r *rowImpl) GetVarString(colName string) (col string, err error) {
	val, err := r.GetVarCustomData(colName)
	if err != nil {
		return "", err
	}
	return val.(string), nil
}
func (r *rowImpl) SetByte(colName string, value byte) (err error) {
	_, err = r.partition.schema.GetColumn(colName)
	if err != nil {
		return
	}
	err = r.partition.deserializeColumn(colName)
	if err != nil {
		return
	}
	r.SetNotNil(colName)  
	r.partition.activeColData[colName][r.rowNum] = value
	return
}
func (r *rowImpl) SetBytes(colName string, value []byte) (err error) {
	col, err := r.partition.schema.GetColumn(colName)
	if err != nil {
		return
	}
	err = r.partition.deserializeColumn(colName)
	if err != nil {
		return
	}
	if len(value) > col.Type().Size() {
		err = fmt.Errorf("value is wider than column: %d/%d", col.Type().Size(), len(value))
	}
	r.SetNotNil(colName)  
	start := r.rowNum * col.Type().Size()
	end := start + col.Type().Size()
	copy(r.partition.activeColData[colName][start:end], value)
	return
}
func (r *rowImpl) SetBool(colName string, value bool) error {
	var newVal byte
	if value {
		newVal = 1
	}
	return r.SetByte(colName, newVal)
}
func (r *rowImpl) SetUint8(colName string, value uint8) error {
	return r.SetByte(colName, value)
}
func (r *rowImpl) SetUint16(colName string, value uint16) (err error) {
	col, err := r.partition.schema.GetColumn(colName)
	if err != nil {
		return
	}
	err = r.partition.deserializeColumn(colName)
	if err != nil {
		return
	}
	r.SetNotNil(colName)  
	buff := make([]byte, col.Type().Size())
	binary.LittleEndian.PutUint16(buff, value)
	start := r.rowNum * col.Type().Size()
	end := start + col.Type().Size()
	copy(r.partition.activeColData[colName][start:end], buff)
	return
}
func (r *rowImpl) SetUint32(colName string, value uint32) (err error) {
	col, err := r.partition.schema.GetColumn(colName)
	if err != nil {
		return
	}
	err = r.partition.deserializeColumn(colName)
	if err != nil {
		return
	}
	r.SetNotNil(colName)  
	buff := make([]byte, col.Type().Size())
	binary.LittleEndian.PutUint32(buff, value)
	start := r.rowNum * col.Type().Size()
	end := start + col.Type().Size()
	copy(r.partition.activeColData[colName][start:end], buff)
	return
}
func (r *rowImpl) SetUint64(colName string, value uint64) (err error) {
	col, err := r.partition.schema.GetColumn(colName)
	if err != nil {
		return
	}
	err = r.partition.deserializeColumn(colName)
	if err != nil {
		return
	}
	r.SetNotNil(colName)  
	buff := make([]byte, col.Type().Size())
	binary.LittleEndian.PutUint64(buff, value)
	start := r.rowNum * col.Type().Size()
	end := start + col.Type().Size()
	copy(r.partition.activeColData[colName][start:end], buff)
	return
}
func (r *rowImpl) SetInt8(colName string, value int8) (err error) {
	return r.SetUint8(colName, uint8(value))
}