Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ioredis-type

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ioredis-type

redis type orm

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ioredis-type

redis type orm

Installation

npm install ioredis-type

Usage

client

const Redis = require('ioredis-type');

const redis = new Redis({
  // host: '127.0.0.1',
  // password: '',
  // port: 6379,
  // db: 0,
});

Number

async function main() {
  const number = redis.root.Number('number');

  await number.set(10);
  
  await number.get(); // 10
  
  await number.inc(-1); // 9
}

main().finally(() => redis.close())

test example

List

async function main() {
  const list = redis.root.List('list');

  await list.push('a', 'b', 'c', 'd');
  
  await list.pop(2);
  
  await list.slice(1);
  await list.slice(1, 3, true);
  await list.slice(1, undefined, true);
  
  await list.index(-4);
}

main().finally(() => redis.close())

test example

ZSet

async function main() {
  const zset = redis.root.ZSet('zset');

  await zset.push('a', 'b', 'c', 'd');
  
  await zset.set('a', 1);
  await zset.set('c', 3);
  await zset.set('b', 2);
  await zset.set('d', 3);
  
  await zset.slice(1);
  await zset.slice(1, 3, true);
  await zset.slice(1, undefined, true);
  
  await zset.index(-4);
}

main().finally(() => redis.close())

test example

Table

async function main() {
  const table = redis.root.Table('table');

  await table.insert({
      t: true,
      f: false,
      u: undefined,
      n: null,
      s: '',
      i: 0,
      a: ['A', 'B,C'],
    });
  
  await table.select();
}

main().finally(() => redis.close())

test example

Dir

async function main() {
  const dirA = redis.root.Dir('A');
  const dirAa = dirA.Dir('a');
  
  await dirA.Number('num').set(10);
  await dirAa.Number('num').set(100);
}

main().finally(() => redis.close())

test example

Keywords

FAQs

Package last updated on 14 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc