models

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(s string) uint64

func IsSameEvent

func IsSameEvent(a, b Event) bool

This implementation evalutes the differences after event transformation rather than comparing the content versions

func NewEventID

func NewEventID(seed string) string

func TimeFromConfig

func TimeFromConfig(syncTime config.SyncTime) (time.Time, error)

Types

type Attendee

type Attendee struct {
	Email       string
	DisplayName string
}

func (Attendee) Equal

func (a Attendee) Equal(value Attendee) bool

type Attendees

type Attendees []Attendee

func (Attendees) Len

func (a Attendees) Len() int

func (Attendees) Less

func (a Attendees) Less(i, j int) bool

func (Attendees) Swap

func (a Attendees) Swap(i, j int)

type Calendar

type Calendar struct {
	ID          string
	Title       string
	Description string
}

type Event

type Event struct {
	ICalUID     string // RFC5545 iCal UID which is valid across calendaring-systems
	ID          string // a unique ID which is calculated from source event-data. Provides a common ID between original and synced event(s)
	Title       string
	Description string
	Location    string
	StartTime   time.Time
	EndTime     time.Time
	AllDay      bool
	Metadata    *Metadata
	Attendees   Attendees
	Reminders   Reminders
	MeetingLink string
	Accepted    bool
}

Event describes a calendar event which can be processed in a Controller via Transformer funcs.

TODO: Is Event an interface or a concrete type? @ljarosch: I think for the time being, it is fine going with a struct.

But in the future it might be very handy to create different events
(maybe because the source provides more/less capabilities).

func NewSyncEvent

func NewSyncEvent(origin Event) Event

NewSyncEvent derives a new Event from a given source Event. The derived event is as bare as possible, it only contains required metadata and the event times. It can be aggregated by Transformers with additional data if desired.

func (*Event) Overwrite

func (e *Event) Overwrite(source Event) Event

func (*Event) ShortTitle

func (e *Event) ShortTitle() string

ShortTitle returns the title with a capped max length of maxLen. If the title is too long, the string is cut to maxLen and '...' is added

func (*Event) SyncID

func (e *Event) SyncID() string

SyncID returns the event-unique ID, RFC5545 compliant. Every event has its own ID and additionally an UID. The difference is that, while the UID is the same for every event-series event, the ID differs. Additionally, the ID is platform-specific (e.g. Google Calendar).

type Metadata

type Metadata struct {
	// SyncID is a unique ID which links the original event with the synced copy/copies
	SyncID string `json:"SyncID"`
	// OriginalEventUri is an URI which points to the original event which was synced. This is usually an URL.
	OriginalEventUri string `json:"OriginalEventUri"`
	// SourceID contains the ID of the source which this event was imported from
	SourceID string `json:"SourceID"`
}

Metadata describes the metadata which is added to events read from the source. The data is either calculated from the original event or given in the config file.

func NewEventMetadata

func NewEventMetadata(syncId, originalEventUri, sourceID string) *Metadata

type Reminder

type Reminder struct {
	Actions ReminderActions
	Trigger ReminderTrigger
}

func (*Reminder) Equal

func (r *Reminder) Equal(value Reminder) bool

type ReminderActions

type ReminderActions int
const (
	ReminderActionDisplay ReminderActions = iota
)

type ReminderTrigger

type ReminderTrigger struct {
	PointInTime time.Time
}

type Reminders

type Reminders []Reminder

func (Reminders) Len

func (r Reminders) Len() int

func (Reminders) Less

func (r Reminders) Less(i, j int) bool

func (Reminders) Swap

func (r Reminders) Swap(i, j int)

type TimeIdentifier

type TimeIdentifier string
const (
	MonthStart TimeIdentifier = "MonthStart"
	MonthEnd   TimeIdentifier = "MonthEnd"
)

Jump to

Keyboard shortcuts

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