Socket
Socket
Sign inDemoInstall

orma

Package Overview
Dependencies
0
Maintainers
2
Versions
232
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    orma

A declarative relational syncronous orm


Version published
Weekly downloads
17
increased by88.89%
Maintainers
2
Install size
245 kB
Created
Weekly downloads
 

Readme

Source

Orma

Update read format, ----------🚧 THIS PROJECT IS A WORK IN PROGRESS 🚧----------

Orma is a declarative, syncronous, dependency free ORM.

Orma provides introspection, validation, query construction and mutations. The package uses json format to represent sql queries and mutations.

When the database is instrospected a declarative schema is generated as a json object. Typescript types are also generated.

The orma schema can be diffed by the user and validated using runtime schema validation functions.

To construct orma queries, pass a json object with columns to include or subqueries similar to graphql. Reserved sql keywords can be accessed with the $ prefix and snake case. (eg $group_by, $limit, $where)

To construct orma mutations, pass a json object with nested objects and the schema. Orma will use a single pass toposort algorithm to decompose into the minimum number of batch insert requests and run them in parallel ensuring parents get created before children, and foreign key references are inserted into children tables.

Key Advantages

Disadvantages Supports sql databases only

Installation

npm i orma  // Or yarn add orma

Intospect a mysql database

This is where we describe what introspection means What is the syntax What are the limitations

import { ... } from 'orma'
// here is a code snippet

Construct queries

The query generates nested json by...

// This is how you construct queries
// This is how you execute queries

Construct Mutations

Mutation format is the same as from the read uil... Operations are nested in as meta on each level... Here is where we explain what recursive op hierarchy alternative to graphql

// Another snippet

Examples

// How to run a long lived transaction
// How to batch insert nested tables
// How to query for table1 where table2 matches a criteria
// How to query all table1 including table2 when table2 matches a criteria
// How to use any/all for hierarcy queries eg permissions
// How to use $op cascading

Power user examples

Keywords

FAQs

Last updated on 29 Jul 2021

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc