schedule

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package schedule finds meeting slots across many people, each of whom may carry busy time merged from any number of calendars.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDuration = errors.New("schedule: request needs a positive Duration")
	ErrNoWindow   = errors.New("schedule: request needs a non-empty Window")
)

Functions

This section is empty.

Types

type Person

type Person struct {
	Name string
	Busy interval.Set
}

Person is an attendee. Busy is the union of every calendar they live by — personal, work, volunteer — merged into one normalized set.

func Merge

func Merge(name string, calendars ...interval.Set) Person

Merge folds any number of busy sets (one per calendar) into a single Person.

type Request

type Request struct {
	Duration time.Duration  // meeting length (required)
	Window   interval.Span  // search window (required)
	Location *time.Location // wall-clock zone for Hours/Days; default UTC
	HourFrom time.Duration  // earliest start within a day, e.g. 9h; default 9h
	HourTo   time.Duration  // latest end within a day, e.g. 17h; default 17h
	Days     []time.Weekday // allowed days; default Mon–Fri
	Step     time.Duration  // candidate granularity; default 30m
	Travel   time.Duration  // drive-time padding before and after, for in-person meetings
	Required []Person       // everyone here must be free
	Optional []Person       // scored: more of these free is better
	Limit    int            // max slots returned; default 10
}

Request describes the meeting being scheduled.

type Slot

type Slot struct {
	interval.Span
	Attending []string // optional attendees who can make it (required are implied)
	Missing   []string // optional attendees who cannot
}

Slot is one candidate meeting time.

func Find

func Find(req Request) ([]Slot, error)

Find returns up to Limit candidate slots, best first: most optional attendees, then earliest. All required attendees fit every returned slot, including Travel padding on both sides.

func (Slot) Score

func (s Slot) Score() int

Score ranks a slot: every optional attendee present counts.

Jump to

Keyboard shortcuts

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