@storehouse/redis - v0.1.0
    Preparing search index...

    Class Schema<TSchema>

    Represents a schema for JSON Documents stored in Redis.

    Type Parameters

    • TSchema extends StandardSchemaV1
    Index
    • Creates a new schema for JSON Documents stored in Redis.

      Type Parameters

      • TSchema extends StandardSchemaV1<unknown, unknown>

      Parameters

      • prefix: string

        the prefix to use for Redis keys

      • schema: TSchema

        the TypeScript schema definition for the JSON Documents

      • searchSchema: RediSearchSchema

        the RediSearch schema definition for the JSON Documents

      • Optionaloptions: SanitizedCreateIndexOptions

        additional options for creating the index

      Returns Schema<TSchema>

    • get searchSchema(): Readonly<RediSearchSchema>

      Returns Readonly<RediSearchSchema>

    • Creates a new repository instance for the schema.

      Type Parameters

      • M extends RedisModules
      • F extends RedisFunctions
      • S extends RedisScripts
      • R extends RespVersions
      • T extends TypeMapping

      Parameters

      • client: RedisClientType<M, F, S, R, T> | RedisClientPoolType<M, F, S, R, T>

        the Redis client to use for the repository

      • Optionalguard: OperationGuard

        an optional operation guard to control Redis operations

      Returns Repository<TSchema>

      a new repository instance for the schema

    • Validates a value against the schema.

      Parameters

      • value: unknown

        the value to validate against the schema

      • Optionaloptions: Options

        optional validation options

      Returns Promise<Result<unknown>>

      the result of the validation, including any errors if validation fails