ical

package module
v0.0.0-...-b2cc14b Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2018 License: MIT Imports: 14 Imported by: 1

README

go-ical

Work with ical formatted data in Go

Build Status GoDoc

WARNING

This repository has been moved to github.com/lestrrat-go/ical. This repository exists so that libraries pointing to this URL will keep functioning, but this repository will NOT be updated in the future. Please use the new import path.

DESCRIPTION

This is partially a port of Data::ICal (perl5 module) to Go.

Parse an ics file:

import "github.com/lestrrat/go-ical"

// snip...
p := ical.NewParser()
c, err := p.ParseFile(file)

// snip
for e := range c.Entries() {
  ev, ok := e.(*ical.Event)
  if !ok {
    continue
  }

  // work with event.
}

Programatically generate a Calendar

import "github.com/lestrrat/go-ical"

// snip...
c := ical.New()
c.AddProperty("X-Foo-Bar-Baz", "value")
tz := ical.NewTimezone()
tz.AddProperty("TZID", "Asia/Tokyo")
c.AddEntry(tz)

ical.NewEncoder(os.Stdout).Encode(c)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calendar

type Calendar struct {
	// contains filtered or unexported fields
}

func New

func New(options ...Option) *Calendar

func NewCalendar

func NewCalendar() *Calendar

func (*Calendar) AddEntry

func (v *Calendar) AddEntry(e Entry) error

func (*Calendar) AddProperty

func (v *Calendar) AddProperty(key, value string, options ...PropertyOption) error

func (*Calendar) Entries

func (v *Calendar) Entries() <-chan Entry

func (*Calendar) GetProperty

func (v *Calendar) GetProperty(name string) (*Property, bool)

func (*Calendar) MarshalJSON

func (v *Calendar) MarshalJSON() ([]byte, error)

func (*Calendar) Properties

func (v *Calendar) Properties() <-chan *Property

func (*Calendar) String

func (v *Calendar) String() string

func (Calendar) Type

func (v Calendar) Type() string

type Daylight

type Daylight struct {
	// contains filtered or unexported fields
}

func NewDaylight

func NewDaylight() *Daylight

func (*Daylight) AddEntry

func (v *Daylight) AddEntry(e Entry) error

func (*Daylight) AddProperty

func (v *Daylight) AddProperty(key, value string, options ...PropertyOption) error

func (*Daylight) Entries

func (v *Daylight) Entries() <-chan Entry

func (*Daylight) GetProperty

func (v *Daylight) GetProperty(name string) (*Property, bool)

func (*Daylight) MarshalJSON

func (v *Daylight) MarshalJSON() ([]byte, error)

func (*Daylight) Properties

func (v *Daylight) Properties() <-chan *Property

func (*Daylight) String

func (v *Daylight) String() string

func (Daylight) Type

func (v Daylight) Type() string

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(dst io.Writer) *Encoder

func (*Encoder) Encode

func (enc *Encoder) Encode(e Entry) error

func (*Encoder) EncodeProperty

func (enc *Encoder) EncodeProperty(p *Property) error

type Entry

type Entry interface {
	AddEntry(Entry) error
	AddProperty(string, string, ...PropertyOption) error
	GetProperty(string) (*Property, bool)
	Entries() <-chan Entry
	Properties() <-chan *Property
	Type() string
}

type EntryList

type EntryList []Entry

func (*EntryList) Append

func (v *EntryList) Append(e Entry)

func (EntryList) Iterator

func (v EntryList) Iterator() <-chan Entry

type Event

type Event struct {
	// contains filtered or unexported fields
}

func NewEvent

func NewEvent() *Event

func (*Event) AddEntry

func (v *Event) AddEntry(e Entry) error

func (*Event) AddProperty

func (v *Event) AddProperty(key, value string, options ...PropertyOption) error

func (*Event) Entries

func (v *Event) Entries() <-chan Entry

func (*Event) GetProperty

func (v *Event) GetProperty(name string) (*Property, bool)

func (*Event) MarshalJSON

func (v *Event) MarshalJSON() ([]byte, error)

func (*Event) Properties

func (v *Event) Properties() <-chan *Property

func (*Event) String

func (v *Event) String() string

func (Event) Type

func (v Event) Type() string

type JSONEncoder

type JSONEncoder struct {
	// contains filtered or unexported fields
}

func NewJSONEncoder

func NewJSONEncoder(dst io.Writer) *JSONEncoder

func (*JSONEncoder) Encode

func (enc *JSONEncoder) Encode(e Entry) error

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithName

func WithName(s string) Option

func WithVCal10

func WithVCal10(v bool) Option

type Parameters

type Parameters map[string][]string

func (Parameters) Add

func (p Parameters) Add(name, value string)

func (Parameters) Get

func (p Parameters) Get(s string) (string, bool)

type Parser

type Parser struct{}

func NewParser

func NewParser() *Parser

func (*Parser) Parse

func (p *Parser) Parse(src io.Reader) (*Calendar, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(filename string) (*Calendar, error)

type Property

type Property struct {
	// contains filtered or unexported fields
}

func NewProperty

func NewProperty(name, value string, params Parameters) *Property

func (Property) Name

func (p Property) Name() string

func (Property) Parameters

func (p Property) Parameters() Parameters

func (Property) RawValue

func (p Property) RawValue() string

type PropertyOption

type PropertyOption interface {
	Name() string
	Get() interface{}
}

func WithForce

func WithForce(b bool) PropertyOption

func WithParameters

func WithParameters(p Parameters) PropertyOption

type PropertySet

type PropertySet struct {
	// contains filtered or unexported fields
}

func NewPropertySet

func NewPropertySet() *PropertySet

func (*PropertySet) Append

func (s *PropertySet) Append(p *Property)

func (*PropertySet) Get

func (s *PropertySet) Get(name string) ([]*Property, bool)

func (*PropertySet) GetFirst

func (s *PropertySet) GetFirst(name string) (*Property, bool)

func (*PropertySet) Iterator

func (s *PropertySet) Iterator() <-chan *Property

func (*PropertySet) Set

func (s *PropertySet) Set(p *Property)

type Standard

type Standard struct {
	// contains filtered or unexported fields
}

func NewStandard

func NewStandard() *Standard

func (*Standard) AddEntry

func (v *Standard) AddEntry(e Entry) error

func (*Standard) AddProperty

func (v *Standard) AddProperty(key, value string, options ...PropertyOption) error

func (*Standard) Entries

func (v *Standard) Entries() <-chan Entry

func (*Standard) GetProperty

func (v *Standard) GetProperty(name string) (*Property, bool)

func (*Standard) MarshalJSON

func (v *Standard) MarshalJSON() ([]byte, error)

func (*Standard) Properties

func (v *Standard) Properties() <-chan *Property

func (*Standard) String

func (v *Standard) String() string

func (Standard) Type

func (v Standard) Type() string

type Timezone

type Timezone struct {
	// contains filtered or unexported fields
}

func NewTimezone

func NewTimezone() *Timezone

func (*Timezone) AddEntry

func (v *Timezone) AddEntry(e Entry) error

func (*Timezone) AddProperty

func (v *Timezone) AddProperty(key, value string, options ...PropertyOption) error

func (*Timezone) Entries

func (v *Timezone) Entries() <-chan Entry

func (*Timezone) GetProperty

func (v *Timezone) GetProperty(name string) (*Property, bool)

func (*Timezone) MarshalJSON

func (v *Timezone) MarshalJSON() ([]byte, error)

func (*Timezone) Properties

func (v *Timezone) Properties() <-chan *Property

func (*Timezone) String

func (v *Timezone) String() string

func (Timezone) Type

func (v Timezone) Type() string

type Todo

type Todo struct {
	// contains filtered or unexported fields
}

func NewTodo

func NewTodo() *Todo

func (*Todo) AddEntry

func (v *Todo) AddEntry(e Entry) error

func (*Todo) AddProperty

func (v *Todo) AddProperty(key, value string, options ...PropertyOption) error

func (*Todo) Entries

func (v *Todo) Entries() <-chan Entry

func (*Todo) GetProperty

func (v *Todo) GetProperty(name string) (*Property, bool)

func (*Todo) MarshalJSON

func (v *Todo) MarshalJSON() ([]byte, error)

func (*Todo) Properties

func (v *Todo) Properties() <-chan *Property

func (*Todo) String

func (v *Todo) String() string

func (Todo) Type

func (v Todo) Type() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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