Skip to content

OIRedisAdapter

@tsed/adapters-ioredis

Usage ​

typescript
import { OIRedisAdapter } from "@tsed/adapters-ioredis";

See /packages/orm/adapters-ioredis/src/adapters/OIRedisAdapter.ts.

Overview ​

ts
class OIRedisAdapter<Model extends AdapterModel> extends Adapter<Model> {
    readonly hooks: Hooks;
    readonly connectionName: string;
    readonly connection: IORedis;
    readonly keyPrefix: string;
    protected useHash: boolean;
    constructor(options: OIRedisAdapterConstructorOptions);
    get db(): Redis;
    key(id: string): string;
    prefix(key: string): string;
    create(payload: Partial<Model>, expiresAt?: Date): Promise<Model>;
    upsert(id: string, payload: Model, expiresAt?: Date): Promise<Model>;
    update(id: string, payload: Model, expiresAt?: Date): Promise<Model | undefined>;
    updateOne(predicate: Partial<Model & any>, payload: Model, expiresAt?: Date): Promise<Model | undefined>;
    findOne(predicate: Partial<Model & any>): Promise<Model | undefined>;
    findById(_id: string): Promise<Model | undefined>;
    findAll(predicate?: Partial<Model & any>): Promise<Model[]>;
    deleteOne(predicate: Partial<Model & any>): Promise<Model | undefined>;
    deleteById(_id: string): Promise<Model | undefined>;
    deleteMany(predicate: Partial<Model>): Promise<Model[]>;
    protected extractIdFromIndexedKey(key: string): string | undefined;
    protected findKeys(props: any): Promise<string[]>;
    protected insert(payload: Partial<Model>, expiresAt?: Date): Promise<any>;
    protected getAllIndex(id: string): Promise<string[]>;
    protected getAllIndex(id: string, pipeline: ChainableCommander): ChainableCommander;
    protected getIndexedKey(id: string, propertyKey: string, value: any): string;
    protected getAll(): Promise<Model[]>;
    protected findAllBy(props: Partial<Model & any>): Promise<Model[]>;
}

readonly hooks ​

ts
readonly hooks: Hooks;

readonly connectionName ​

ts
readonly connectionName: string;

readonly connection ​

ts
readonly connection: IORedis;

readonly keyPrefix ​

ts
readonly keyPrefix: string;

protected useHash ​

ts
protected useHash: boolean;

get db ​

ts
get db(): Redis;

key ​

ts
key(id: string): string;

prefix ​

ts
prefix(key: string): string;

create ​

ts
create(payload: Partial<Model>, expiresAt?: Date): Promise<Model>;

upsert ​

ts
upsert(id: string, payload: Model, expiresAt?: Date): Promise<Model>;

update ​

ts
update(id: string, payload: Model, expiresAt?: Date): Promise<Model | undefined>;

updateOne ​

ts
updateOne(predicate: Partial<Model & any>, payload: Model, expiresAt?: Date): Promise<Model | undefined>;

findOne ​

ts
findOne(predicate: Partial<Model & any>): Promise<Model | undefined>;

findById ​

ts
findById(_id: string): Promise<Model | undefined>;

findAll ​

ts
findAll(predicate?: Partial<Model & any>): Promise<Model[]>;

deleteOne ​

ts
deleteOne(predicate: Partial<Model & any>): Promise<Model | undefined>;

deleteById ​

ts
deleteById(_id: string): Promise<Model | undefined>;

deleteMany ​

ts
deleteMany(predicate: Partial<Model>): Promise<Model[]>;

protected extractIdFromIndexedKey ​

ts
protected extractIdFromIndexedKey(key: string): string | undefined;

protected findKeys ​

ts
protected findKeys(props: any): Promise<string[]>;

protected insert ​

ts
protected insert(payload: Partial<Model>, expiresAt?: Date): Promise<any>;

protected getAllIndex ​

ts
protected getAllIndex(id: string): Promise<string[]>;

protected getAllIndex ​

ts
protected getAllIndex(id: string, pipeline: ChainableCommander): ChainableCommander;

protected getIndexedKey ​

ts
protected getIndexedKey(id: string, propertyKey: string, value: any): string;

protected getAll ​

ts
protected getAll(): Promise<Model[]>;

protected findAllBy ​

ts
protected findAllBy(props: Partial<Model & any>): Promise<Model[]>;

Released under the MIT License.