Git Product home page Git Product logo

nosequel's Introduction

NoSequel

This library leverages cutting edge Javsascript and Typescript features such as Symbols, Decorators and Conditional and Mapped Types to provide a modern and powerful ORM for NoSQL database systems.

Cassandra support is currently under active development and should be ready for beta testing in the very near future. Support for CosmosDB DocumentDB API and Graph with the Gremlin API will follow shortly.

Basic Usage

Simply decorate your entity classes with the required table metadata and then obtain a Repository instance for your type in order to interact with the database.

Note that through the magic of TypeScript Conditional and Mapped types only key names that match your entity properties are valid for selection as partition or clustering keys.

@Entity<ParkingLotEvent>({
  keyspace: 'parking',
  table: 'lot_events_by_franchisee',
  partitionKeys: ['franchiseeNumber', 'lotId'],
  clusteringKeys: [ 'timeStamp' ]
})
export class ParkingLotEvent {
  @Column({ colType: 'text' })
  public franchiseeNumber!: string;
  
  @Column({ colType: 'text' })
  public lotId!: string;
  
  @Column({ colType: 'timeuuid' })
  public timeStamp!: Date;
}

const repository = new Repository<ParkingLotEvent>(client, ParkingLotEvent);

// execute operations against this table using repository

Other Features

Generate valid CQL schema definitions for tables based on your entity metadata. In the future it may be possible to extend this functionality to allow for automatic schema migrations that reflect changes to models over time (similar to ORMs like Entity Framework and TypeORM).

Query Patterns Considerations

Partition Keys

NoSequel currently enforces that when retrieving data, the full partition key must be specified. This means that for tables with composite parition keys values must be provided for all keys. ie. for the ParkingLotEvent repository:

const events = await repository.get({
  franchiseeNumber: '123',
  lotId: 'abc'
});

nosequel's People

Contributors

wonderpanda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nosequel's Issues

Column Type Serializers

The library needs the ability to seamlessly map between the Javascript property types on decorated classes and the underlying CQL column type specified on the column.

It should be able to use intelligent defaults based on the combination of the two types. For example, a JS property with a type of object and a column definition of type text should be serialized using JSON.stringify().

Date <-> TimeUuid, etc

Configure TsLint and Prettier

Enforce sane standards for these to ensure code style is consistent across the repository and various user contributions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.