1.4.28 • Published 3 years ago

asorm v1.4.28

Weekly downloads
120
License
-
Repository
github
Last release
3 years ago

AS-ORM

The AS-ORM provides a beautiful, simple ActiveRecord implementation for working with your pouchdb database. Each database table has a corresponding "Entity" which is used to interact with that table with its dao.

Installation

``` npm i asorm ```

Basic Usage

To get started, create an ASORM Entity

```
@Entity()
class User {
    _id:string;
    name:string;
}
```

Once the entity is defined, now we must define its dao

```
@Dao(User)
class UserDao {

}
 ```

Put, Delete , UpdateWhere , Where

To create a new record in the database from an Entity, simply create a new entity instance and call the put method.

put

    put create a new item if not exist else update it

```
    const user = new User();
    user._id= "123";
    user.name = "asorm_user";
    const dao = new  Userdao();
    dao.put(user)
 ```

UpdateWhere

```
  const rest = await dao.updateWhere('_id', user._id, '');

 ```

delete

 ```
    const deleteRes = await dao.delete(user);
 ```

or with where clause

 ```
  const deleteRes = await dao.deleteWhere('name', 'asmorm_user', '=');
 ```

return the an array has the responses

Where

Take 3 params the field , value and the logic operator in this example we will get the users that name equal to "asorm"

```
    const users = await dao.where('name', 'asrom', '=').apply();
```

where operators

//todo

1.4.28

3 years ago

1.4.27

4 years ago

1.4.26

4 years ago

1.4.24

4 years ago

1.4.23

4 years ago

1.4.25

4 years ago

1.4.22

4 years ago

1.4.21

4 years ago

1.4.20

4 years ago

1.4.19

4 years ago

1.4.18

4 years ago

1.4.17

4 years ago

1.4.16

4 years ago

1.4.15

4 years ago

1.4.14

4 years ago

1.4.13

4 years ago

1.4.12

4 years ago

1.4.11

4 years ago

1.4.9

4 years ago

1.4.10

4 years ago

1.4.8

4 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

0.0.1

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago