Production-grade availability and scheduling logic for Go.
- Zero-dependency scheduling primitives
- Immutable-style slot and collection operations
- Weekly schedules with exception handling
- Provider-level booking, buffers, and constraints
- Multi-provider conflict detection
- RRULE subset recurrence support
- iCal import/export helpers
go get github.com/Melpic13/timeslotpackage main
import (
"fmt"
"time"
"github.com/Melpic13/timeslot/availability"
"github.com/Melpic13/timeslot/provider"
"github.com/Melpic13/timeslot/query"
)
func main() {
weekly := availability.NewWeeklySchedule(time.UTC).
SetDay(time.Tuesday, availability.TimeRange{
Start: availability.NewTimeOfDay(9, 0, 0),
End: availability.NewTimeOfDay(17, 0, 0),
})
p := provider.NewProvider("stylist-1", provider.WithWeeklySchedule(weekly))
now := time.Now().UTC()
q := query.NewQuery().
Duration(time.Hour).
Between(now, now.Add(7*24*time.Hour)).
Limit(5).
Build()
slots, _ := p.FindSlots(q)
fmt.Println("slots:", len(slots))
}go test -race ./...must pass- Coverage must stay at or above
90%(make coverage-check) - CI enforces
go mod tidy,go vet, lint, and gosec
slot.TimeSlot: one concrete time windowslot.SlotCollection: immutable collection operationsavailability.WeeklySchedule: recurring weekly windowsavailability.Availability: weekly schedule + exceptions + bookingsprovider.Provider: bookable resource with optionsquery.Query: fluent API for slot searches
examples/basic/main.goexamples/multi-provider/main.goexamples/recurring-availability/main.goexamples/booking-system/main.go
Use pkg.go.dev/github.com/Melpic13/timeslot.
Benchmark stubs are included in test files. Run with:
go test -bench=. -benchmem ./...See CONTRIBUTING.md.
MIT