Skip to main content Link Search Menu Expand Document (external link)

Persistence.ts overview

Since v1.0.0


Exports Grouped by Category


errors

PersistenceBackingError (class)

Signature

declare class PersistenceBackingError

Source

Since v1.0.0

make (static method)

Signature

declare const make: (method: string, cause: unknown) => PersistenceBackingError

Source

Since v1.0.0

PersistenceError (type alias)

Signature

type PersistenceError = PersistenceParseError | PersistenceBackingError

Source

Since v1.0.0

PersistenceParseError (class)

Signature

declare class PersistenceParseError

Source

Since v1.0.0

make (static method)

Signature

declare const make: (method: string, error: ParseResult.ParseError["issue"]) => PersistenceParseError

Source

Since v1.0.0

layers

layerKeyValueStore

Signature

declare const layerKeyValueStore: Layer.Layer<BackingPersistence, never, KeyValueStore.KeyValueStore>

Source

Since v1.0.0

layerMemory

Signature

declare const layerMemory: Layer.Layer<BackingPersistence>

Source

Since v1.0.0

layerResult

Signature

declare const layerResult: any

Source

Since v1.0.0

layerResultKeyValueStore

Signature

declare const layerResultKeyValueStore: Layer.Layer<ResultPersistence, never, KeyValueStore.KeyValueStore>

Source

Since v1.0.0

layerResultMemory

Signature

declare const layerResultMemory: Layer.Layer<ResultPersistence>

Source

Since v1.0.0

models

BackingPersistence (interface)

Signature

export interface BackingPersistence {
  readonly [BackingPersistenceTypeId]: BackingPersistenceTypeId
  readonly make: (storeId: string) => Effect.Effect<BackingPersistenceStore, never, Scope.Scope>
}

Source

Since v1.0.0

BackingPersistenceStore (interface)

Signature

export interface BackingPersistenceStore {
  readonly get: (key: string) => Effect.Effect<Option.Option<unknown>, PersistenceError>
  readonly getMany: (key: Array<string>) => Effect.Effect<Array<Option.Option<unknown>>, PersistenceError>
  readonly set: (
    key: string,
    value: unknown,
    ttl: Option.Option<Duration.Duration>
  ) => Effect.Effect<void, PersistenceError>
  readonly remove: (key: string) => Effect.Effect<void, PersistenceError>
  readonly clear: Effect.Effect<void, PersistenceError>
}

Source

Since v1.0.0

ResultPersistence (interface)

Signature

export interface ResultPersistence {
  readonly [ResultPersistenceTypeId]: ResultPersistenceTypeId
  readonly make: (options: {
    readonly storeId: string
    readonly timeToLive?: (key: ResultPersistence.KeyAny, exit: Exit.Exit<unknown, unknown>) => Duration.DurationInput
  }) => Effect.Effect<ResultPersistenceStore, never, Scope.Scope>
}

Source

Since v1.0.0

ResultPersistence (namespace)

Source

Since v1.0.0

Key (interface)

Signature

export interface Key<R, IE, E, IA, A> extends Schema.WithResult<A, IA, E, IE, R>, PrimaryKey.PrimaryKey {}

Source

Since v1.0.0

KeyAny (type alias)

Signature

type KeyAny = Key<any, any, any, any, any> | Key<any, never, never, any, any>

Source

Since v1.0.0

TimeToLiveArgs (type alias)

Signature

type TimeToLiveArgs<A> = A extends infer K
  ? K extends Key<infer _R, infer _IE, infer _E, infer _IA, infer _A>
    ? [request: K, exit: Exit.Exit<_A, _E>]
    : never
  : never

Source

Since v1.0.0

ResultPersistenceStore (interface)

Signature

export interface ResultPersistenceStore {
  readonly get: <R, IE, E, IA, A>(
    key: ResultPersistence.Key<R, IE, E, IA, A>
  ) => Effect.Effect<Option.Option<Exit.Exit<A, E>>, PersistenceError, R>
  readonly getMany: <R, IE, E, IA, A>(
    key: ReadonlyArray<ResultPersistence.Key<R, IE, E, IA, A>>
  ) => Effect.Effect<Array<Option.Option<Exit.Exit<A, E>>>, PersistenceError, R>
  readonly set: <R, IE, E, IA, A>(
    key: ResultPersistence.Key<R, IE, E, IA, A>,
    value: Exit.Exit<A, E>
  ) => Effect.Effect<void, PersistenceError, R>
  readonly remove: <R, IE, E, IA, A>(
    key: ResultPersistence.Key<R, IE, E, IA, A>
  ) => Effect.Effect<void, PersistenceError>
  readonly clear: Effect.Effect<void, PersistenceError>
}

Source

Since v1.0.0

tags

BackingPersistence

Signature

declare const BackingPersistence: Context.Tag<BackingPersistence, BackingPersistence>

Source

Since v1.0.0

ResultPersistence

Signature

declare const ResultPersistence: Context.Tag<ResultPersistence, ResultPersistence>

Source

Since v1.0.0

type ids

BackingPersistenceTypeId

Signature

declare const BackingPersistenceTypeId: unique symbol

Source

Since v1.0.0

BackingPersistenceTypeId (type alias)

Signature

type BackingPersistenceTypeId = typeof BackingPersistenceTypeId

Source

Since v1.0.0

ErrorTypeId

Signature

declare const ErrorTypeId: unique symbol

Source

Since v1.0.0

ErrorTypeId (type alias)

Signature

type ErrorTypeId = typeof ErrorTypeId

Source

Since v1.0.0

ResultPersistenceTypeId

Signature

declare const ResultPersistenceTypeId: unique symbol

Source

Since v1.0.0

ResultPersistenceTypeId (type alias)

Signature

type ResultPersistenceTypeId = typeof ResultPersistenceTypeId

Source

Since v1.0.0

utils

unsafeTtlToExpires

Signature

declare const unsafeTtlToExpires: (clock: Clock.Clock, ttl: Option.Option<Duration.Duration>) => number | null

Source

Since v1.0.0