Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wonderpanda/nosequel
A modern TypeScript empowered ORM for NoSQL databases.
https://github.com/wonderpanda/nosequel
cassandra cosmosdb css gremlin javascript nosql orm tinkerpop typescript
Last synced: 2 months ago
JSON representation
A modern TypeScript empowered ORM for NoSQL databases.
- Host: GitHub
- URL: https://github.com/wonderpanda/nosequel
- Owner: WonderPanda
- License: mit
- Created: 2018-04-23T20:14:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-11T13:15:36.000Z (over 1 year ago)
- Last Synced: 2024-10-12T19:03:49.266Z (2 months ago)
- Topics: cassandra, cosmosdb, css, gremlin, javascript, nosql, orm, tinkerpop, typescript
- Language: TypeScript
- Homepage:
- Size: 188 KB
- Stars: 16
- Watchers: 5
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
```javascript
@Entity({
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(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'
});
```