kiwimix/pkg/calendarops/boolean_intersect.go

23 lines
740 B
Go
Raw Normal View History

2023-06-20 21:44:50 +00:00
package calendarops
import (
"errors"
basetypes "code.apps.glenux.net/glenux/kiwimix/pkg/basetypes"
)
// IntersectCalendarOperation is an operation that intersects a calendar with
// another
type IntersectCalendarOperation struct{}
// Ensure IntersectCalendarOperation implements CalendarOperation
var _ CalendarOperation = (*IntersectCalendarOperation)(nil)
func (op IntersectCalendarOperation) Execute(calendars ...basetypes.Calendar) (basetypes.Calendar, error) {
if len(calendars) != 2 {
return basetypes.Calendar{}, errors.New("Difference operation requires exactly two calendars")
}
// Do your union operation here and return the new union basetypes.
return calendars[0], nil // Replace this with actual implementation
}