// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package arrow

import (
	

	
	
)

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")
}

// MonthInterval traits

const (
	// MonthIntervalSizeBytes specifies the number of bytes required to store a single MonthInterval in memory
	MonthIntervalSizeBytes = int(unsafe.Sizeof(MonthInterval(0)))
)

type monthTraits struct{}

// BytesRequired returns the number of bytes required to store n elements in memory.
func (monthTraits) ( int) int { return MonthIntervalSizeBytes *  }

// PutValue
func (monthTraits) ( []byte,  MonthInterval) {
	endian.Native.PutUint32(, uint32())
}

// CastFromBytes reinterprets the slice b to a slice of type MonthInterval.
//
// NOTE: len(b) must be a multiple of MonthIntervalSizeBytes.
func (monthTraits) ( []byte) []MonthInterval {
	return GetData[MonthInterval]()
}

// CastToBytes reinterprets the slice b to a slice of bytes.
func (monthTraits) ( []MonthInterval) []byte {
	return GetBytes()
}

// Copy copies src to dst.
func (monthTraits) (,  []MonthInterval) { copy(, ) }

// DayTimeInterval traits

const (
	// DayTimeIntervalSizeBytes specifies the number of bytes required to store a single DayTimeInterval in memory
	DayTimeIntervalSizeBytes = int(unsafe.Sizeof(DayTimeInterval{}))
)

type daytimeTraits struct{}

// BytesRequired returns the number of bytes required to store n elements in memory.
func (daytimeTraits) ( int) int { return DayTimeIntervalSizeBytes *  }

// PutValue
func (daytimeTraits) ( []byte,  DayTimeInterval) {
	endian.Native.PutUint32([0:4], uint32(.Days))
	endian.Native.PutUint32([4:8], uint32(.Milliseconds))
}

// CastFromBytes reinterprets the slice b to a slice of type DayTimeInterval.
//
// NOTE: len(b) must be a multiple of DayTimeIntervalSizeBytes.
func (daytimeTraits) ( []byte) []DayTimeInterval {
	return GetData[DayTimeInterval]()
}

// CastToBytes reinterprets the slice b to a slice of bytes.
func (daytimeTraits) ( []DayTimeInterval) []byte {
	return GetBytes()
}

// Copy copies src to dst.
func (daytimeTraits) (,  []DayTimeInterval) { copy(, ) }

// DayTimeInterval traits

const (
	// MonthDayNanoIntervalSizeBytes specifies the number of bytes required to store a single DayTimeInterval in memory
	MonthDayNanoIntervalSizeBytes = int(unsafe.Sizeof(MonthDayNanoInterval{}))
)

type monthDayNanoTraits struct{}

// BytesRequired returns the number of bytes required to store n elements in memory.
func (monthDayNanoTraits) ( int) int { return MonthDayNanoIntervalSizeBytes *  }

// PutValue
func (monthDayNanoTraits) ( []byte,  MonthDayNanoInterval) {
	endian.Native.PutUint32([0:4], uint32(.Months))
	endian.Native.PutUint32([4:8], uint32(.Days))
	endian.Native.PutUint64([8:], uint64(.Nanoseconds))
}

// CastFromBytes reinterprets the slice b to a slice of type MonthDayNanoInterval.
//
// NOTE: len(b) must be a multiple of MonthDayNanoIntervalSizeBytes.
func (monthDayNanoTraits) ( []byte) []MonthDayNanoInterval {
	return GetData[MonthDayNanoInterval]()
}

// CastToBytes reinterprets the slice b to a slice of bytes.
func (monthDayNanoTraits) ( []MonthDayNanoInterval) []byte {
	return GetBytes()
}

// Copy copies src to dst.
func (monthDayNanoTraits) (,  []MonthDayNanoInterval) { copy(, ) }