KeyValueStore
Combinators
Constructors
Signature
declare const make: (impl: Omit<KeyValueStore, typeof TypeId | "has" | "modify" | "modifyUint8Array" | "isEmpty" | "forSchema"> & Partial<KeyValueStore>) => KeyValueStoremakeStringOnly
Added in v1.0.0
Source
Signature
declare const makeStringOnly: (impl: Pick<KeyValueStore, "get" | "remove" | "clear" | "size"> & Partial<Omit<KeyValueStore, "set">> & { readonly set: (key: string, value: string) => Effect.Effect<void, PlatformError.PlatformError>;}) => KeyValueStoreLayers
layerFileSystem
Added in v1.0.0
Source
Provides a file-backed key-value store in the specified directory.
Keys are percent-encoded as single file names. Empty keys, . and .. are
rejected. Keys are only guaranteed to be distinct on case-sensitive file
systems.
clear removes the directory recursively, so it must not be shared with
unrelated data.
Signature
declare const layerFileSystem: (directory: string) => Layer.Layer<KeyValueStore, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>layerMemory
Added in v1.0.0
Source
Signature
declare const layerMemory: Layer.Layer<KeyValueStore>layerSchema
Added in v1.0.0
Source
Signature
declare const layerSchema: <A, I, R>(schema: Schema.Schema<A, I, R>, tagIdentifier: string) => { readonly layer: Layer.Layer<SchemaStore<A, R>, never, KeyValueStore>; readonly tag: Context.Tag<SchemaStore<A, R>, SchemaStore<A, R>>;}layerStorage
Added in v1.0.0
Source
Creates an KeyValueStorage from an instance of the Storage api.
See
Signature
declare const layerStorage: (evaluate: LazyArg<Storage>) => Layer.Layer<KeyValueStore>Models
KeyValueStore interface
Added in v1.0.0
Source
Signature
interface KeyValueStore { readonly [TypeId]: typeof TypeId; readonly clear: Effect<void, PlatformError>; readonly forSchema: <A, I, R>(schema: any) => SchemaStore<A, R>; readonly get: (key: string) => Effect<Option<string>, PlatformError>; readonly getUint8Array: (key: string) => Effect<Option<Uint8Array<ArrayBufferLike>>, PlatformError>; readonly has: (key: string) => Effect<boolean, PlatformError>; readonly isEmpty: Effect<boolean, PlatformError>; readonly modify: (key: string, f: (value: string) => string) => Effect<Option<string>, PlatformError>; readonly modifyUint8Array: (key: string, f: (value: Uint8Array) => Uint8Array) => Effect<Option<Uint8Array<ArrayBufferLike>>, PlatformError>; readonly remove: (key: string) => Effect<void, PlatformError>; readonly set: (key: string, value: string | Uint8Array<ArrayBufferLike>) => Effect<void, PlatformError>; readonly size: Effect<number, PlatformError>;}SchemaStore interface
Added in v1.0.0
Source
Signature
interface SchemaStore<A, R> { readonly [SchemaStoreTypeId]: typeof SchemaStoreTypeId; readonly clear: Effect<void, PlatformError>; readonly get: (key: string) => Effect<Option<A>, any, R>; readonly has: (key: string) => Effect<boolean, PlatformError>; readonly isEmpty: Effect<boolean, PlatformError>; readonly modify: (key: string, f: (value: A) => A) => Effect<Option<A>, any, R>; readonly remove: (key: string) => Effect<void, PlatformError>; readonly set: (key: string, value: A) => Effect<void, any, R>; readonly size: Effect<number, PlatformError>;}Other
KeyValueStore
Added in v1.0.0
Source
Type Id
SchemaStoreTypeId
Added in v1.0.0
Source
Signature
declare const SchemaStoreTypeId: unique symbolSchemaStoreTypeId type
Added in v1.0.0
Source
Signature
type SchemaStoreTypeId = typeof SchemaStoreTypeIdSignature
declare const TypeId: unique symbolSignature
type TypeId = typeof TypeId