Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

499 B
Raw Blame
package reminder

import (
	"strings"
	"time"
)

func encodeCursor(createdAt time.Time, id string) string {
	return createdAt.UTC().Format(time.RFC3339Nano) + "|" + id
}

func decodeCursor(cursor string) (time.Time, string, error) {
	createdAtRaw, id, found := strings.Cut(cursor, "|")
	if !found || id == "" {
		return time.Time{}, "", ErrInvalid
	}
	createdAt, err := time.Parse(time.RFC3339Nano, createdAtRaw)
	if err != nil {
		return time.Time{}, "", ErrInvalid
	}
	return createdAt, id, nil
}