0.1.56 • Published 1 year ago

uranio v0.1.56

Weekly downloads
2
License
UNLICENSED
Repository
github
Last release
1 year 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.55

1 year ago

0.1.56

1 year ago

0.1.54

2 years ago

0.1.53

2 years ago

0.1.52

2 years ago

0.1.50

2 years ago

0.1.51

2 years ago

0.1.49

2 years ago

0.1.45

2 years ago

0.1.46

2 years ago

0.1.47

2 years ago

0.1.48

2 years ago

0.1.41

2 years ago

0.1.42

2 years ago

0.1.43

2 years ago

0.1.44

2 years ago

0.1.40

2 years ago

0.1.38

2 years ago

0.1.39

2 years ago

0.1.32

2 years ago

0.1.33

2 years ago

0.1.34

2 years ago

0.1.35

2 years ago

0.1.36

2 years ago

0.1.37

2 years ago

0.1.30

2 years ago

0.1.31

2 years ago

0.1.27

2 years ago

0.1.28

2 years ago

0.1.29

2 years ago

0.1.20

2 years ago

0.1.21

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.0.106

2 years ago

0.0.105

2 years ago

0.0.108

2 years ago

0.0.107

2 years ago

0.0.104

3 years ago

0.0.103

3 years ago

0.0.102

3 years ago

0.0.101

3 years ago

0.0.99

3 years ago

0.0.100

3 years ago

0.0.84

3 years ago

0.0.62

3 years ago

0.0.85

3 years ago

0.0.63

3 years ago

0.0.86

3 years ago

0.0.64

3 years ago

0.0.87

3 years ago

0.0.65

3 years ago

0.0.88

3 years ago

0.0.66

3 years ago

0.0.89

3 years ago

0.0.67

3 years ago

0.0.68

3 years ago

0.0.69

3 years ago

0.0.80

3 years ago

0.0.81

3 years ago

0.0.82

3 years ago

0.0.83

3 years ago

0.0.95

3 years ago

0.0.73

3 years ago

0.0.96

3 years ago

0.0.74

3 years ago

0.0.97

3 years ago

0.0.75

3 years ago

0.0.98

3 years ago

0.0.76

3 years ago

0.0.77

3 years ago

0.0.78

3 years ago

0.0.79

3 years ago

0.0.90

3 years ago

0.0.91

3 years ago

0.0.92

3 years ago

0.0.70

3 years ago

0.0.93

3 years ago

0.0.71

3 years ago

0.0.94

3 years ago

0.0.72

3 years ago

0.0.0

6 years ago