seq

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DayOf

func DayOf(t time.Time) time.Time

DayOf returns the start of the day (00:00:00) for the given time in UTC.

func FormatDate

func FormatDate(t time.Time) string

FormatDate returns the date string in YYYY-MM-DD format for S3 key prefixes.

func TimeOf

func TimeOf(sequenceID uint32, dayStart time.Time) time.Time

TimeOf reconstructs a timestamp from a sequence ID and day start.

Types

type Sequence

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

Sequence generates unique Sequence IDs for a specific day. Sequence ID Format: (minutes_from_day_start << 20) | atomic_counter

func NewSequence

func NewSequence(dayStart time.Time) *Sequence

NewSequence creates a new sequence generator for the given day.

func (*Sequence) Day

func (sg *Sequence) Day() time.Time

Day returns the current day start time.

func (*Sequence) Next

func (sg *Sequence) Next(now time.Time) uint32

Next creates a unique sequence ID for the given timestamp.

Jump to

Keyboard shortcuts

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