ical

package module
v0.0.0-...-6a07f50 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: MIT Imports: 8 Imported by: 0

README

iCalendar lexer/parser

Build Status

Golang iCalendar lexer/parser implementing RFC 5545. This project is heavily inspired of the talk Lexical Scanning in Go by Rob Pike.

Usage

import (
    "github.com/iswangwenbin/ical"
)

// filename is an io.Reader
// second parameter is a *time.Location which defaults to system local
calendar, err := ical.Parse(filename, nil)

Components

Component Reference Status
VCALENDAR RFC5545.Section 3.4
VEVENT RFC5545.Section 3.6.1
VALARM RFC5545.Section 3.6.6
VTIMEZONE RFC5545.Section 3.6.5
STANDARD RFC5545.Section 3.6.5
DAYLIGHT RFC5545.Section 3.6.5
VTODO RFC5545.Section 3.6.2
VJOURNAL RFC5545.Section 3.6.3
VFREEBUSY RFC5545.Section 3.6.4

TODO

  • Implements VEVENT
  • Implements VALARM
  • Implements VTIMEZONE
  • Implements STANDARD
  • Implements DAYLIGHT
  • Implements VTODO
  • Implements VJOURNAL
  • Implements VFREEBUSY
  • Implements Missing Properties on VEVENT
  • Implements Missing Properties on VTIMEZONE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alarm

type Alarm struct {
	Properties []*Property
	Action     string
	Trigger    string
}

An Alarm represent a VALARM component in an iCalendar

func NewAlarm

func NewAlarm() *Alarm

NewAlarm creates an empty Alarm

type Calendar

type Calendar struct {
	Properties []*Property // Properties
	Events     []*Event    // Events
	Timezones  []*Timezone // Timezones
	Prodid     string      // Production Id
	Version    string      // iCalendar version
	Calscale   string      // Calscale: "GREGORIAN"
	Method     string      // Method
}

A Calendar represents the whole iCalendar

func NewCalendar

func NewCalendar() *Calendar

NewCalendar creates an empty Calendar

func Parse

func Parse(r io.Reader, l *time.Location) (*Calendar, error)

Parse transforms the raw iCalendar into a Calendar struct It's up to the caller to close the io.Reader if the time.Location parameter is not set, it will default to the system location

type Daylight

type Daylight struct {
	Properties []*Property
}

An Daylight represent a Daylight component in an iCalendar

func NewDaylight

func NewDaylight() *Daylight

NewDaylight creates an empty Daylight

type Event

type Event struct {
	Properties  []*Property
	Alarms      []*Alarm
	UID         string
	Timestamp   time.Time
	StartDate   time.Time
	EndDate     time.Time
	Summary     string
	Description string
}

An Event represent a VEVENT component in an iCalendar

func NewEvent

func NewEvent() *Event

NewEvent creates an empty Event

type Param

type Param struct {
	Values []string
}

A Param represent a list of param for a property

func NewParam

func NewParam() *Param

NewParam creates an empty Param

type Property

type Property struct {
	Name   string
	Params map[string]*Param
	Value  string
}

A Property represent an unparsed property in an iCalendar component

func NewProperty

func NewProperty() *Property

NewProperty creates an empty Property

type Standard

type Standard struct {
	Properties []*Property
}

An Standard represent a Standard component in an iCalendar

func NewStandard

func NewStandard() *Standard

NewStandard creates an empty Standard

type Timezone

type Timezone struct {
	Properties []*Property
	Standards  []*Standard
	Daylights  []*Daylight
}

An Timezone represent a VTimezone component in an iCalendar

func NewTimezone

func NewTimezone() *Timezone

NewTimezone creates an empty Timezone

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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