(startAt: Date, stopAt: Date): ScheduleWindow
(id: string, startAt: Date, stopAt: Date): ScheduleWindowA bounded window (start + stop). The leading id is optional.
Process.window(gameStart, gameEnd) // nameless
Process.window("game-123", gameStart, gameEnd)export function function window(startAt: Date, stopAt: Date): ScheduleWindow (+1 overload)A bounded window (start + stop). The leading id is optional.
Process.window(gameStart, gameEnd) // nameless
Process.window("game-123", gameStart, gameEnd)
window(startAt: DatestartAt: Date, stopAt: DatestopAt: Date): ScheduleWindow;
export function function window(id: string, startAt: Date, stopAt: Date): ScheduleWindow (+1 overload)A bounded window (start + stop). The leading id is optional.
Process.window(gameStart, gameEnd) // nameless
Process.window("game-123", gameStart, gameEnd)
window(id: stringid: string, startAt: DatestartAt: Date, stopAt: DatestopAt: Date): ScheduleWindow;
export function function window(startAt: Date, stopAt: Date): ScheduleWindow (+1 overload)A bounded window (start + stop). The leading id is optional.
Process.window(gameStart, gameEnd) // nameless
Process.window("game-123", gameStart, gameEnd)
window(
idOrStartAt: string | DateidOrStartAt: string | Date,
startAtOrStopAt: DatestartAtOrStopAt: Date,
maybeStopAt: Date | undefinedmaybeStopAt?: Date,
): ScheduleWindow {
if (idOrStartAt: string | DateidOrStartAt instanceof var Date: DateConstructorEnables basic storage and retrieval of dates and times.
Date) {
return {
ScheduleWindow.id: Option.Option<string>id: import OptionOption.const none: <
string
>() => Option.Option<string>
Creates an Option representing the absence of a value.
When to use
Use to represent a missing or uninitialized value, such as returning "no
result" from a function.
Details
- Returns
Option<never>, which is a subtype of Option<A> for any A
- Always returns the same singleton instance
Example (Creating an empty Option)
import { Option } from "effect"
// ┌─── Option<never>
// ▼
const noValue = Option.none()
console.log(noValue)
// Output: { _id: 'Option', _tag: 'None' }
none(),
ScheduleWindow.startAt: DatestartAt: idOrStartAt: DateidOrStartAt,
ScheduleWindow.stopAt: Option.Option<Date>stopAt: import OptionOption.const some: <Date>(
value: Date
) => Option.Option<Date>
Wraps the given value into an Option to represent its presence.
When to use
Use to wrap a known present value as Option
- Returning a successful result from a partial function
Details
- Always returns
Some<A>
- Does not filter
null or undefined; use
fromNullishOr
for that
Example (Wrapping a value)
import { Option } from "effect"
// ┌─── Option<number>
// ▼
const value = Option.some(1)
console.log(value)
// Output: { _id: 'Option', _tag: 'Some', value: 1 }
some(startAtOrStopAt: DatestartAtOrStopAt),
};
}
if (maybeStopAt: Date | undefinedmaybeStopAt === var undefinedundefined) {
throw new var Error: ErrorConstructor
new (message?: string, options?: ErrorOptions) => Error (+1 overload)
Error("Process.window(id, startAt, stopAt): stopAt is required");
}
return {
ScheduleWindow.id: Option.Option<string>id: const toWindowId: (
id: string | undefined
) => Option.Option<string>
toWindowId(idOrStartAt: stringidOrStartAt),
ScheduleWindow.startAt: DatestartAt: startAtOrStopAt: DatestartAtOrStopAt,
ScheduleWindow.stopAt: Option.Option<Date>stopAt: import OptionOption.const some: <Date>(
value: Date
) => Option.Option<Date>
Wraps the given value into an Option to represent its presence.
When to use
Use to wrap a known present value as Option
- Returning a successful result from a partial function
Details
- Always returns
Some<A>
- Does not filter
null or undefined; use
fromNullishOr
for that
Example (Wrapping a value)
import { Option } from "effect"
// ┌─── Option<number>
// ▼
const value = Option.some(1)
console.log(value)
// Output: { _id: 'Option', _tag: 'Some', value: 1 }
some(maybeStopAt: DatemaybeStopAt),
};
}