package arrow
import (
"math"
"unsafe"
"github.com/apache/arrow-go/v18/arrow/endian"
)
var (
Int64Traits int64Traits
Uint64Traits uint64Traits
Float64Traits float64Traits
Int32Traits int32Traits
Uint32Traits uint32Traits
Float32Traits float32Traits
Int16Traits int16Traits
Uint16Traits uint16Traits
Int8Traits int8Traits
Uint8Traits uint8Traits
Time32Traits time32Traits
Time64Traits time64Traits
Date32Traits date32Traits
Date64Traits date64Traits
DurationTraits durationTraits
)
const (
Int64SizeBytes = int (unsafe .Sizeof (int64 (0 )))
)
type int64Traits struct {}
func (int64Traits ) BytesRequired (n int ) int { return Int64SizeBytes * n }
func (int64Traits ) PutValue (b []byte , v int64 ) {
endian .Native .PutUint64 (b , uint64 (v ))
}
func (int64Traits ) CastFromBytes (b []byte ) []int64 {
return GetData [int64 ](b )
}
func (int64Traits ) CastToBytes (b []int64 ) []byte {
return GetBytes (b )
}
func (int64Traits ) Copy (dst , src []int64 ) { copy (dst , src ) }
const (
Uint64SizeBytes = int (unsafe .Sizeof (uint64 (0 )))
)
type uint64Traits struct {}
func (uint64Traits ) BytesRequired (n int ) int { return Uint64SizeBytes * n }
func (uint64Traits ) PutValue (b []byte , v uint64 ) {
endian .Native .PutUint64 (b , uint64 (v ))
}
func (uint64Traits ) CastFromBytes (b []byte ) []uint64 {
return GetData [uint64 ](b )
}
func (uint64Traits ) CastToBytes (b []uint64 ) []byte {
return GetBytes (b )
}
func (uint64Traits ) Copy (dst , src []uint64 ) { copy (dst , src ) }
const (
Float64SizeBytes = int (unsafe .Sizeof (float64 (0 )))
)
type float64Traits struct {}
func (float64Traits ) BytesRequired (n int ) int { return Float64SizeBytes * n }
func (float64Traits ) PutValue (b []byte , v float64 ) {
endian .Native .PutUint64 (b , math .Float64bits (v ))
}
func (float64Traits ) CastFromBytes (b []byte ) []float64 {
return GetData [float64 ](b )
}
func (float64Traits ) CastToBytes (b []float64 ) []byte {
return GetBytes (b )
}
func (float64Traits ) Copy (dst , src []float64 ) { copy (dst , src ) }
const (
Int32SizeBytes = int (unsafe .Sizeof (int32 (0 )))
)
type int32Traits struct {}
func (int32Traits ) BytesRequired (n int ) int { return Int32SizeBytes * n }
func (int32Traits ) PutValue (b []byte , v int32 ) {
endian .Native .PutUint32 (b , uint32 (v ))
}
func (int32Traits ) CastFromBytes (b []byte ) []int32 {
return GetData [int32 ](b )
}
func (int32Traits ) CastToBytes (b []int32 ) []byte {
return GetBytes (b )
}
func (int32Traits ) Copy (dst , src []int32 ) { copy (dst , src ) }
const (
Uint32SizeBytes = int (unsafe .Sizeof (uint32 (0 )))
)
type uint32Traits struct {}
func (uint32Traits ) BytesRequired (n int ) int { return Uint32SizeBytes * n }
func (uint32Traits ) PutValue (b []byte , v uint32 ) {
endian .Native .PutUint32 (b , uint32 (v ))
}
func (uint32Traits ) CastFromBytes (b []byte ) []uint32 {
return GetData [uint32 ](b )
}
func (uint32Traits ) CastToBytes (b []uint32 ) []byte {
return GetBytes (b )
}
func (uint32Traits ) Copy (dst , src []uint32 ) { copy (dst , src ) }
const (
Float32SizeBytes = int (unsafe .Sizeof (float32 (0 )))
)
type float32Traits struct {}
func (float32Traits ) BytesRequired (n int ) int { return Float32SizeBytes * n }
func (float32Traits ) PutValue (b []byte , v float32 ) {
endian .Native .PutUint32 (b , math .Float32bits (v ))
}
func (float32Traits ) CastFromBytes (b []byte ) []float32 {
return GetData [float32 ](b )
}
func (float32Traits ) CastToBytes (b []float32 ) []byte {
return GetBytes (b )
}
func (float32Traits ) Copy (dst , src []float32 ) { copy (dst , src ) }
const (
Int16SizeBytes = int (unsafe .Sizeof (int16 (0 )))
)
type int16Traits struct {}
func (int16Traits ) BytesRequired (n int ) int { return Int16SizeBytes * n }
func (int16Traits ) PutValue (b []byte , v int16 ) {
endian .Native .PutUint16 (b , uint16 (v ))
}
func (int16Traits ) CastFromBytes (b []byte ) []int16 {
return GetData [int16 ](b )
}
func (int16Traits ) CastToBytes (b []int16 ) []byte {
return GetBytes (b )
}
func (int16Traits ) Copy (dst , src []int16 ) { copy (dst , src ) }
const (
Uint16SizeBytes = int (unsafe .Sizeof (uint16 (0 )))
)
type uint16Traits struct {}
func (uint16Traits ) BytesRequired (n int ) int { return Uint16SizeBytes * n }
func (uint16Traits ) PutValue (b []byte , v uint16 ) {
endian .Native .PutUint16 (b , uint16 (v ))
}
func (uint16Traits ) CastFromBytes (b []byte ) []uint16 {
return GetData [uint16 ](b )
}
func (uint16Traits ) CastToBytes (b []uint16 ) []byte {
return GetBytes (b )
}
func (uint16Traits ) Copy (dst , src []uint16 ) { copy (dst , src ) }
const (
Int8SizeBytes = int (unsafe .Sizeof (int8 (0 )))
)
type int8Traits struct {}
func (int8Traits ) BytesRequired (n int ) int { return Int8SizeBytes * n }
func (int8Traits ) PutValue (b []byte , v int8 ) {
b [0 ] = byte (v )
}
func (int8Traits ) CastFromBytes (b []byte ) []int8 {
return GetData [int8 ](b )
}
func (int8Traits ) CastToBytes (b []int8 ) []byte {
return GetBytes (b )
}
func (int8Traits ) Copy (dst , src []int8 ) { copy (dst , src ) }
const (
Uint8SizeBytes = int (unsafe .Sizeof (uint8 (0 )))
)
type uint8Traits struct {}
func (uint8Traits ) BytesRequired (n int ) int { return Uint8SizeBytes * n }
func (uint8Traits ) PutValue (b []byte , v uint8 ) {
b [0 ] = byte (v )
}
func (uint8Traits ) CastFromBytes (b []byte ) []uint8 {
return GetData [uint8 ](b )
}
func (uint8Traits ) CastToBytes (b []uint8 ) []byte {
return GetBytes (b )
}
func (uint8Traits ) Copy (dst , src []uint8 ) { copy (dst , src ) }
const (
Time32SizeBytes = int (unsafe .Sizeof (Time32 (0 )))
)
type time32Traits struct {}
func (time32Traits ) BytesRequired (n int ) int { return Time32SizeBytes * n }
func (time32Traits ) PutValue (b []byte , v Time32 ) {
endian .Native .PutUint32 (b , uint32 (v ))
}
func (time32Traits ) CastFromBytes (b []byte ) []Time32 {
return GetData [Time32 ](b )
}
func (time32Traits ) CastToBytes (b []Time32 ) []byte {
return GetBytes (b )
}
func (time32Traits ) Copy (dst , src []Time32 ) { copy (dst , src ) }
const (
Time64SizeBytes = int (unsafe .Sizeof (Time64 (0 )))
)
type time64Traits struct {}
func (time64Traits ) BytesRequired (n int ) int { return Time64SizeBytes * n }
func (time64Traits ) PutValue (b []byte , v Time64 ) {
endian .Native .PutUint64 (b , uint64 (v ))
}
func (time64Traits ) CastFromBytes (b []byte ) []Time64 {
return GetData [Time64 ](b )
}
func (time64Traits ) CastToBytes (b []Time64 ) []byte {
return GetBytes (b )
}
func (time64Traits ) Copy (dst , src []Time64 ) { copy (dst , src ) }
const (
Date32SizeBytes = int (unsafe .Sizeof (Date32 (0 )))
)
type date32Traits struct {}
func (date32Traits ) BytesRequired (n int ) int { return Date32SizeBytes * n }
func (date32Traits ) PutValue (b []byte , v Date32 ) {
endian .Native .PutUint32 (b , uint32 (v ))
}
func (date32Traits ) CastFromBytes (b []byte ) []Date32 {
return GetData [Date32 ](b )
}
func (date32Traits ) CastToBytes (b []Date32 ) []byte {
return GetBytes (b )
}
func (date32Traits ) Copy (dst , src []Date32 ) { copy (dst , src ) }
const (
Date64SizeBytes = int (unsafe .Sizeof (Date64 (0 )))
)
type date64Traits struct {}
func (date64Traits ) BytesRequired (n int ) int { return Date64SizeBytes * n }
func (date64Traits ) PutValue (b []byte , v Date64 ) {
endian .Native .PutUint64 (b , uint64 (v ))
}
func (date64Traits ) CastFromBytes (b []byte ) []Date64 {
return GetData [Date64 ](b )
}
func (date64Traits ) CastToBytes (b []Date64 ) []byte {
return GetBytes (b )
}
func (date64Traits ) Copy (dst , src []Date64 ) { copy (dst , src ) }
const (
DurationSizeBytes = int (unsafe .Sizeof (Duration (0 )))
)
type durationTraits struct {}
func (durationTraits ) BytesRequired (n int ) int { return DurationSizeBytes * n }
func (durationTraits ) PutValue (b []byte , v Duration ) {
endian .Native .PutUint64 (b , uint64 (v ))
}
func (durationTraits ) CastFromBytes (b []byte ) []Duration {
return GetData [Duration ](b )
}
func (durationTraits ) CastToBytes (b []Duration ) []byte {
return GetBytes (b )
}
func (durationTraits ) Copy (dst , src []Duration ) { copy (dst , src ) }
The pages are generated with Golds v0.8.4 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .