package arrow
import (
"unsafe"
"github.com/apache/arrow-go/v18/arrow/endian"
"github.com/apache/arrow-go/v18/arrow/internal/debug"
)
var (
MonthIntervalTraits monthTraits
DayTimeIntervalTraits daytimeTraits
MonthDayNanoIntervalTraits monthDayNanoTraits
)
func init() {
debug .Assert (MonthIntervalSizeBytes == 4 , "MonthIntervalSizeBytes should be 4" )
debug .Assert (DayTimeIntervalSizeBytes == 8 , "DayTimeIntervalSizeBytes should be 8" )
debug .Assert (MonthDayNanoIntervalSizeBytes == 16 , "MonthDayNanoIntervalSizeBytes should be 16" )
}
const (
MonthIntervalSizeBytes = int (unsafe .Sizeof (MonthInterval (0 )))
)
type monthTraits struct {}
func (monthTraits ) BytesRequired (n int ) int { return MonthIntervalSizeBytes * n }
func (monthTraits ) PutValue (b []byte , v MonthInterval ) {
endian .Native .PutUint32 (b , uint32 (v ))
}
func (monthTraits ) CastFromBytes (b []byte ) []MonthInterval {
return GetData [MonthInterval ](b )
}
func (monthTraits ) CastToBytes (b []MonthInterval ) []byte {
return GetBytes (b )
}
func (monthTraits ) Copy (dst , src []MonthInterval ) { copy (dst , src ) }
const (
DayTimeIntervalSizeBytes = int (unsafe .Sizeof (DayTimeInterval {}))
)
type daytimeTraits struct {}
func (daytimeTraits ) BytesRequired (n int ) int { return DayTimeIntervalSizeBytes * n }
func (daytimeTraits ) PutValue (b []byte , v DayTimeInterval ) {
endian .Native .PutUint32 (b [0 :4 ], uint32 (v .Days ))
endian .Native .PutUint32 (b [4 :8 ], uint32 (v .Milliseconds ))
}
func (daytimeTraits ) CastFromBytes (b []byte ) []DayTimeInterval {
return GetData [DayTimeInterval ](b )
}
func (daytimeTraits ) CastToBytes (b []DayTimeInterval ) []byte {
return GetBytes (b )
}
func (daytimeTraits ) Copy (dst , src []DayTimeInterval ) { copy (dst , src ) }
const (
MonthDayNanoIntervalSizeBytes = int (unsafe .Sizeof (MonthDayNanoInterval {}))
)
type monthDayNanoTraits struct {}
func (monthDayNanoTraits ) BytesRequired (n int ) int { return MonthDayNanoIntervalSizeBytes * n }
func (monthDayNanoTraits ) PutValue (b []byte , v MonthDayNanoInterval ) {
endian .Native .PutUint32 (b [0 :4 ], uint32 (v .Months ))
endian .Native .PutUint32 (b [4 :8 ], uint32 (v .Days ))
endian .Native .PutUint64 (b [8 :], uint64 (v .Nanoseconds ))
}
func (monthDayNanoTraits ) CastFromBytes (b []byte ) []MonthDayNanoInterval {
return GetData [MonthDayNanoInterval ](b )
}
func (monthDayNanoTraits ) CastToBytes (b []MonthDayNanoInterval ) []byte {
return GetBytes (b )
}
func (monthDayNanoTraits ) Copy (dst , src []MonthDayNanoInterval ) { 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 .