8000 Core data types added · Issue #58 · anchovycation/metronom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Core data types added #58
Open
Open
@saracalihan

Description

@saracalihan

Motivation

When we set out, we had planned to save objects with Redis only with hash type, but now I think that integrating other types of Redis into our system will make our project even stronger.

Currently, Model type using embeded hash function and flow. All Model functions and ModelInstance should be free from hashing and models should be written to return ModelInstance for each type.

All types has internal _write, _read functions and use it on that's business logic's. All models has to have common metronom datas like redisClient so i thing all models should extends on IModel interface and this interface include that datas.

// example usage
import { Hash, String, List } from 'metronom';

let user = Hash(schema, keyPrefix, modelOptions);
let token = String(key, 'value');
let ids = List(key);

user.isAdmin = true; // hSet
token.set('new-value'); // set
ids.push(102); // lPush
ids.unshift(205); // rPush
// ...

await user.save();
await token.save()
await ids.save();

await token.destroy()

Implementation

  • IModel interface(common function like find, getByPk, getAll, destroy ) added and Model abstructed from hash type
  • HashModel implemented
  • StringModel implemented
  • ListModel implemented
  • SetModel implemented
  • GeospatialIndexesModel implemented
  • BitmapModel implemented
  • BitFieldModel implemented

more detail for Redis types

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0