0.1.54 • Published 3 months ago

uranio v0.1.54

Weekly downloads
2
License
UNLICENSED
Repository
github
Last release
3 months ago

Uranio

uranio logo

Uranio is the lightest Typescript Object Document Mapper (ODM) for MongoDB and Object Relational Mapping (ORM) for MySQL.\ It creates a client for querying collections/tabls in a database by just parsing the types in a repository.

It is the simplest and fastest way to query a database without the need to build a Data Access Layer (DAL) from the defined types.

Install

yarn add uranio

How it works

Run:

uranio generate -d mongodb
// or
uranio generate -d mysql

The above command search for all interfaces in your repository that extends the uranio.atom interface.\ For each of these interfaces it creates a method to query a collection with a name of the interface.

For example if in your code you have:

import uranio from 'uranio';

interface Product extends uranio.atom {
  title: string;
  description: string;
  price: number;
}

then Uranio generates a method for querying a collection named products:

import uranio from 'uranio';

const uri = process.env.MONGO_DATABASE_URI || '';
const db_name = process.env.MONGO_DATABASE_NAME || '';

const urn = uranio.MongoDBClient({uri, db_name});

// Get all products
const products = await urn.products.get_atoms({});

// Create a product
await urn.products.put_atom({
  title: 'Uranio mug',
  description: 'A radioactive mug for your coding breakfast',
  price: 4.99
});

Primary index _id for MongoDB

When extending an interface with uranio.atom (MongoDB) this add a primary index attribute _id to the interface, so there is no need to add it manually.

import uranio from 'uranio';

interface Product extends uranio.atom {
  title: string;
  description: string;
  price: number;
}
// It resolves in:
// {
//  _id: string;
//  title: string;
//  description: string;
//  price: number;
// }

Credits

Logo credits https://www.jacopotripodi.com/

0.1.54

3 months ago

0.1.53

3 months ago

0.1.52

3 months ago

0.1.50

3 months ago

0.1.51

3 months ago

0.1.49

4 months ago

0.1.45

4 months ago

0.1.46

4 months ago

0.1.47

4 months ago

0.1.48

4 months ago

0.1.41

4 months ago

0.1.42

4 months ago

0.1.43

4 months ago

0.1.44

4 months ago

0.1.40

4 months ago

0.1.38

4 months ago

0.1.39

4 months ago

0.1.32

4 months ago

0.1.33

4 months ago

0.1.34

4 months ago

0.1.35

4 months ago

0.1.36

4 months ago

0.1.37

4 months ago

0.1.30

4 months ago

0.1.31

4 months ago

0.1.27

4 months ago

0.1.28

4 months ago

0.1.29

4 months ago

0.1.20

4 months ago

0.1.21

4 months ago

0.1.22

4 months ago

0.1.23

4 months ago

0.1.24

4 months ago

0.1.25

4 months ago

0.1.26

4 months ago

0.1.18

4 months ago

0.1.19

4 months ago

0.1.13

4 months ago

0.1.14

4 months ago

0.1.15

4 months ago

0.1.16

4 months ago

0.1.17

4 months ago

0.1.10

4 months ago

0.1.11

4 months ago

0.1.12

4 months ago

0.1.8

4 months ago

0.1.7

4 months ago

0.1.5

5 months ago

0.1.4

5 months ago

0.1.3

5 months ago

0.0.106

11 months ago

0.0.105

11 months ago

0.0.108

10 months ago

0.0.107

11 months ago

0.0.104

1 year ago

0.0.103

1 year ago

0.0.102

2 years ago

0.0.101

2 years ago

0.0.99

2 years ago

0.0.100

2 years ago

0.0.84

2 years ago

0.0.62

2 years ago

0.0.85

2 years ago

0.0.63

2 years ago

0.0.86

2 years ago

0.0.64

2 years ago

0.0.87

2 years ago

0.0.65

2 years ago

0.0.88

2 years ago

0.0.66

2 years ago

0.0.89

2 years ago

0.0.67

2 years ago

0.0.68

2 years ago

0.0.69

2 years ago

0.0.80

2 years ago

0.0.81

2 years ago

0.0.82

2 years ago

0.0.83

2 years ago

0.0.95

2 years ago

0.0.73

2 years ago

0.0.96

2 years ago

0.0.74

2 years ago

0.0.97

2 years ago

0.0.75

2 years ago

0.0.98

2 years ago

0.0.76

2 years ago

0.0.77

2 years ago

0.0.78

2 years ago

0.0.79

2 years ago

0.0.90

2 years ago

0.0.91

2 years ago

0.0.92

2 years ago

0.0.70

2 years ago

0.0.93

2 years ago

0.0.71

2 years ago

0.0.94

2 years ago

0.0.72

2 years ago

0.0.0

5 years ago