value

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MINUTELY = "MINUTELY"
	HOURLY   = "HOURLY"
	DAILY    = "DAILY"
	WEEKLY   = "WEEKLY"
	MONTHLY  = "MONTHLY"
	YEARLY   = "YEARLY"
)

Variables

View Source
var FR = WeekDayNum{WeekDay: Friday}
View Source
var MO = WeekDayNum{WeekDay: Monday}
View Source
var SA = WeekDayNum{WeekDay: Saturday}
View Source
var SU = WeekDayNum{WeekDay: Sunday}
View Source
var TH = WeekDayNum{WeekDay: Thursday}
View Source
var TU = WeekDayNum{WeekDay: Tuesday}
View Source
var WE = WeekDayNum{WeekDay: Wednesday}

Functions

This section is empty.

Types

type Attachable

type Attachable interface {
	ics.Valuer
	IsAttachable()
}

Attachable marks values that are attachable.

func Attachables added in v0.8.0

func Attachables(vv ...Attachable) []Attachable

Attachables is a short-hand for composing URIValues and Binary values as a list.

type BinaryValue

type BinaryValue struct {
	Parameters parameter.Parameters
	Value      []byte
}

BinaryValue holds binary data, such as an inline image.

func Binary

func Binary(data []byte) BinaryValue

Binary returns a new BinaryValue.

func (BinaryValue) IsAttachable

func (v BinaryValue) IsAttachable()

IsAttachable indicates that binary values can be used as images or attachments.

func (BinaryValue) IsDefined

func (v BinaryValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (BinaryValue) With

func (v BinaryValue) With(params ...parameter.Parameter) BinaryValue

With appends parameters to the value.

func (BinaryValue) WriteTo

func (v BinaryValue) WriteTo(w ics.StringWriter) error

WriteTo writes the value to the writer. This is part of the Writable interface.

type DateTimeValue

type DateTimeValue struct {
	Parameters parameter.Parameters
	Value      time.Time
	Others     []time.Time
	// contains filtered or unexported fields
}

DateTimeValue holds a date/time and its formatting decision. See https://tools.ietf.org/html/rfc5545#section-3.3.5

func Date

func Date(t time.Time, others ...time.Time) DateTimeValue

Date constructs a new date value, i.e. without time.

If more than one time value is provided, they are represented as a comma-separated list.

The property has VALUE=DATE-TIME.

func DateTime

func DateTime(t time.Time, others ...time.Time) DateTimeValue

DateTime constructs a new date-time value. If the time parameter(s) is UTC, it is represented using the Zulu "Z" suffix. Otherwise, it is represented as a "floating" local time; however the TZID parameter can be used to steer this.

If more than one time value is provided, they are represented as a comma-separated list.

The property has VALUE=DATE-TIME.

func TStamp

func TStamp(t time.Time) DateTimeValue

TStamp constructs a date-time value using UTC. It has no VALUE parameter; the type is the default and is obvious from the rendered value.

func (DateTimeValue) AsDate

func (v DateTimeValue) AsDate() DateTimeValue

AsDate converts a date-time value to a date-only value.

func (DateTimeValue) IsDefined

func (v DateTimeValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (DateTimeValue) IsTemporal

func (v DateTimeValue) IsTemporal()

IsTemporal allows date-time to be used for temporal use-cases.

func (DateTimeValue) IsTrigger

func (v DateTimeValue) IsTrigger()

IsTrigger allows date-time to be used for triggers.

func (DateTimeValue) With

func (v DateTimeValue) With(params ...parameter.Parameter) DateTimeValue

With appends parameters to the value.

func (DateTimeValue) WriteTo

func (v DateTimeValue) WriteTo(w ics.StringWriter) (err error)

WriteTo writes the value to the writer. This is part of the Valuer interface.

type DurationValue

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

DurationValue holds a time duration. This should be in ISO-8601 form (https://en.wikipedia.org/wiki/ISO_8601#Durations); see github.com/rickb777/date/period for a compatible duration API.

func Duration

func Duration(d string) DurationValue

Duration returns a new DurationValue. It has VALUE=DURATION.

func (DurationValue) IsDefined

func (v DurationValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (DurationValue) IsTrigger

func (v DurationValue) IsTrigger()

IsTrigger allows duration to be used for triggers.

func (DurationValue) With

func (v DurationValue) With(params ...parameter.Parameter) DurationValue

With appends parameters to the value.

func (DurationValue) WriteTo

func (v DurationValue) WriteTo(w ics.StringWriter) error

WriteTo writes the value to the writer. This is part of the Valuer interface.

type GeoValue

type GeoValue struct {
	Parameters parameter.Parameters
	Lat, Lon   float64
	// contains filtered or unexported fields
}

GeoValue holds an integer.

func Geo

func Geo(lat, lon float64) GeoValue

Geo returns a new GeoValue. Values for latitude and longitude are expressed as decimal fractions of degrees. Whole degrees of latitude are represented by a decimal number ranging from 0 through 90. Whole degrees of longitude are represented by a decimal number ranging from 0 through 180. Each can be positive or negative.

It has VALUE=FLOAT.

See https://tools.ietf.org/html/rfc5545#section-3.8.1.6

func (GeoValue) IsDefined

func (v GeoValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (GeoValue) With

func (v GeoValue) With(params ...parameter.Parameter) GeoValue

With appends parameters to the value.

func (GeoValue) WriteTo

func (v GeoValue) WriteTo(w ics.StringWriter) error

WriteTo writes the value to the writer. This is part of the Valuer interface.

type IntegerValue

type IntegerValue struct {
	Parameters parameter.Parameters
	Value      int
	// contains filtered or unexported fields
}

IntegerValue holds an integer.

func Integer

func Integer(number int) IntegerValue

Integer returns a new IntegerValue. It has VALUE=INTEGER.

func (IntegerValue) IsDefined

func (v IntegerValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (IntegerValue) With

func (v IntegerValue) With(params ...parameter.Parameter) IntegerValue

With appends parameters to the value.

func (IntegerValue) WriteTo

func (v IntegerValue) WriteTo(w ics.StringWriter) error

WriteTo writes the value to the writer. This is part of the Valuer interface.

type ListValue

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

ListValue holds a list of one or more text values.

func List

func List(v ...string) ListValue

List constructs a new list value.

Recommended categories values include "ANNIVERSARY", "APPOINTMENT", "BUSINESS", "EDUCATION", "HOLIDAY", "MEETING", "MISCELLANEOUS", "NON-WORKING HOURS", "NOT IN OFFICE", "PERSONAL", "PHONE CALL", "SICK DAY", "SPECIAL OCCASION", "TRAVEL", "VACATION".

Recommended resources values include "CATERING", "CHAIRS", "COMPUTER PROJECTOR", "EASEL", "OVERHEAD PROJECTOR", "SPEAKER PHONE", "TABLE", "TV", "VCR", "VIDEO PHONE", "VEHICLE".

func Lists added in v0.8.0

func Lists(v ...string) []ListValue

Lists constructs one or more list values, grouping the strings provided so that they span across multiple lines rather than using the line folding algorithm.

func (ListValue) IsDefined

func (v ListValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (ListValue) WriteTo

func (v ListValue) WriteTo(w ics.StringWriter) (err error)

WriteTo writes the value to the writer. This is part of the Valuer interface.

type PeriodValue

type PeriodValue struct {
	Parameters parameter.Parameters
	Value      timespan.TimeSpan
}

PeriodValue holds a date/time and its formatting decision. See https://tools.ietf.org/html/rfc5545#section-3.3.5

func Period

func Period(ts timespan.TimeSpan) PeriodValue

Period constructs a new timespan value. The time should be UTC. It has VALUE=PERIOD.

func PeriodOf

func PeriodOf(t time.Time, d time.Duration) PeriodValue

PeriodOf constructs a new timespan value. The time should be UTC. It has VALUE=PERIOD.

func (PeriodValue) IsDefined

func (v PeriodValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (PeriodValue) IsTemporal

func (v PeriodValue) IsTemporal()

IsTemporal allows period to be used for temporal use-cases.

func (PeriodValue) With

func (v PeriodValue) With(params ...parameter.Parameter) PeriodValue

With appends parameters to the value.

func (PeriodValue) WriteTo

func (v PeriodValue) WriteTo(w ics.StringWriter) error

WriteTo writes the value to the writer. This is part of the Valuer interface.

type RecurrenceValue

type RecurrenceValue struct {
	Parameters parameter.Parameters
	Freq       string
	Interval   uint
	Count      uint
	Until      time.Time
	ByWeekNo   []int
	ByMonth    []uint
	ByHour     []uint
	ByMinute   []uint
	BySecond   []uint
	ByDay      []WeekDayNum
	ByMonthDay []int
	ByYearDay  []int
	BySetPos   []int
	WeekStart  Weekday
}

RecurrenceValue holds an integer.

func Recurrence

func Recurrence(freq string) RecurrenceValue

Recurrence returns a new RecurrenceValue. It has VALUE=INTEGER.

func (RecurrenceValue) IsDefined

func (v RecurrenceValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (RecurrenceValue) Validate

func (v RecurrenceValue) Validate() (err error)

Validate confirms that the recurrence parameters are within valid ranges.

func (RecurrenceValue) With

With appends parameters to the value.

func (RecurrenceValue) WriteTo

func (v RecurrenceValue) WriteTo(w ics.StringWriter) (err error)

WriteTo writes the value to the writer. This is part of the Valuer interface.

type Temporal

type Temporal interface {
	ics.Valuer
	IsTemporal()
}

Temporal marks values that are date-time or period.

type TextValue

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

TextValue holds a value that is a string and which will be escaped when written out.

func Cancelled added in v0.8.0

func Cancelled() TextValue

Cancelled specifies an event, a to-do or a journal with cancelled status. Use this for the Status.

func Completed added in v0.8.0

func Completed() TextValue

Completed specifies a to-do with COMPLETED status. Use this for the Status.

func Confidential

func Confidential() TextValue

Confidential is a CONFIDENTIAL event. Use this for the Class.

func Confirmed added in v0.8.0

func Confirmed() TextValue

Confirmed specifies an event with confirmed status. Use this for the Status.

func Draft added in v0.8.0

func Draft() TextValue

Draft specifies a journal with DRAFT status. Use this for the Status.

func Final added in v0.8.0

func Final() TextValue

Final specifies a journal with FINAL status. Use this for the Status.

func InProcess added in v0.8.0

func InProcess() TextValue

InProcess specifies a to-do with IN-PROCESS status. Use this for the Status.

func NeedsAction added in v0.8.0

func NeedsAction() TextValue

NeedsAction specifies a to-do with NEEDS-ACTION status. Use this for the Status.

func Opaque

func Opaque() TextValue

Opaque specifies event is OPAQUE, i.e. when the event blocks other events.

func Private

func Private() TextValue

Private is a PRIVATE event. Use this for the Class.

func Public

func Public() TextValue

Public is a PUBLIC event. Use this for the Class.

func Publish

func Publish() TextValue

Publish specifies a PUBLISH event. Use this for the Method.

func Request

func Request() TextValue

Request specifies an event that is a REQUEST to attend. Use this for the Method.

func Tentative added in v0.8.0

func Tentative() TextValue

Tentative specifies an event with TENTATIVE status. Use this for the Status.

func Text

func Text(v string) TextValue

Text constructs a new text value.

func Texts added in v0.8.0

func Texts(vv ...string) []TextValue

Texts constructs a new []TextValue slice. These will be rendered on separate lines.

func Transparent

func Transparent() TextValue

Transparent specifies event is TRANSPARENT, i.e. when the event does not block other events.

func (TextValue) IsDefined

func (v TextValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (TextValue) With

func (v TextValue) With(params ...parameter.Parameter) TextValue

With appends parameters to the value.

func (TextValue) WriteTo

func (v TextValue) WriteTo(w ics.StringWriter) (err error)

WriteTo writes the value to the writer. This is part of the Valuer interface.

type Trigger

type Trigger interface {
	ics.Valuer
	IsTrigger()
}

Trigger marks values that can be used as alarm triggers: date-time or duration before/after the event start.

type URIValue

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

URIValue holds a URI.

func CalAddress

func CalAddress(mailto string) URIValue

CalAddress returns a new CalAddressValue.

func URI

func URI(uri string) URIValue

URI returns a new URIValue.

func URIs added in v0.8.0

func URIs(vv ...string) []URIValue

URIs constructs a new []URIValue slice. These will be rendered on separate lines.

func (URIValue) IsAttachable

func (v URIValue) IsAttachable()

IsAttachable indicates that URI values can be used as images or attachments.

func (URIValue) IsDefined

func (v URIValue) IsDefined() bool

IsDefined tests whether the value has been explicitly defined or is default.

func (URIValue) With

func (v URIValue) With(params ...parameter.Parameter) URIValue

With appends parameters to the value.

func (URIValue) WriteTo

func (v URIValue) WriteTo(w ics.StringWriter) (err error)

WriteTo writes the value to the writer. This is part of the Valuer interface.

type WeekDayNum

type WeekDayNum struct {
	OrdWk   int
	WeekDay Weekday
}

func (WeekDayNum) InRange

func (wdn WeekDayNum) InRange() bool

func (WeekDayNum) String

func (wdn WeekDayNum) String() string

type Weekday

type Weekday time.Weekday
const (
	Undefined Weekday = iota
	Sunday
	Monday
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
)

func (Weekday) String

func (d Weekday) String() string

String returns abbreviated English name of the day ("SU", "MO", ...).

Jump to

Keyboard shortcuts

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