ical

package
v0.0.0-...-cde1c88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCalendar

func DecodeCalendar(icsData []byte) (*goical.Calendar, error)

DecodeCalendar parses iCalendar data into a Calendar object

func EncodeCalendar

func EncodeCalendar(cal *goical.Calendar) ([]byte, error)

EncodeCalendar encodes a Calendar object to bytes

func NewCalendar

func NewCalendar() *goical.Calendar

NewCalendar creates a new iCalendar object

func ValidateEvent

func ValidateEvent(rawIcalData []byte) error

TestEventDecodeAndEncode attempts to decode and re-encode the event to validate that it can be properly stored without errors

func ValidateUID

func ValidateUID(uid string) error

ValidateUID validates that a UID contains only valid characters and is within length limits. Common restrictions: - Maximum length of 255 characters (common CalDAV limitation) - Should contain only printable ASCII characters - Should not contain control characters or line breaks

Types

type Calendar

type Calendar = goical.Calendar

Calendar is the exported type for go-ical.Calendar

type ComparisonResult

type ComparisonResult int

ComparisonResult indicates the result of comparing two calendar events

const (
	// FirstEventNewer indicates the first event is newer than the second
	FirstEventNewer ComparisonResult = 1
	// SecondEventNewer indicates the second event is newer than the first
	SecondEventNewer ComparisonResult = -1
	// EventsEqual indicates the events have the same recency
	EventsEqual ComparisonResult = 0
)

func CompareEvents

func CompareEvents(event1, event2 *Event) (ComparisonResult, error)

CompareEvents compares two calendar events to determine which one is more recent and should take precedence. The comparison is based on: 1. Sequence number (higher wins) 2. DTSTAMP (more recent wins) if sequence numbers are equal

Returns:

  • FirstEventNewer (1) if event1 should take precedence
  • SecondEventNewer (-1) if event2 should take precedence
  • EventsEqual (0) if they have equal precedence

type Component

type Component = goical.Component

Component is the exported type for go-ical.Component

type Event

type Event struct {
	UID         string
	RawData     []byte // Raw iCalendar data
	Summary     string
	Start       time.Time
	End         time.Time
	Location    string
	Organizer   string
	Description string
	Method      string // Calendar method (REQUEST, REPLY, CANCEL, etc.)
	Sequence    int    // Sequence number for event updates
}

Event represents calendar event information

func ParseCalendarData

func ParseCalendarData(part *multipart.Part) (*Event, error)

ParseCalendarData parses calendar data from an email MIME part

func ParseCalendarReader

func ParseCalendarReader(r io.Reader, encoding string) (*Event, error)

ParseCalendarReader parses calendar data from an io.Reader with optional encoding

func ParseICalData

func ParseICalData(icsData []byte) (*Event, error)

ParseICalData parses iCalendar data and extracts basic event information

func (*Event) IsRecurringUpdate

func (e *Event) IsRecurringUpdate() bool

IsRecurringUpdate checks if an event is a recurring event update

type Prop

type Prop = goical.Prop

Prop is the exported type for go-ical.Prop

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL