@gradii/fedaco
TypeScript icon, indicating that this package has built-in type declarations

1.1.14 • Public • Published

Fedaco Orm

can visit document via site

How To Use It

  • setup a connection
    const db = new DatabaseConfig();
    db.addConnection({
      'driver'  : 'sqlite',
      'database': ':memory:'
    });
    db.bootFedaco();
    db.setAsGlobal();
  • define a model
    @Table({
      tableName: 'user'
    })
    class User extends Model {
      @PrimaryColumn
      id;
      
      @Column()
      email;
    
      @Column()
      name;
    
      @Column()
      age;
    
      @CreatedAtColumn()
      created_at;
    
      @UpdateAtColumn()
      updated_at;
    }
  • fetch data
    const list = await User.createQuery().get();

Create Table

create a user table.

const schemaBuilder = schema(connectionName);

await schemaBuilder().create('users', table => {
  table.increments('id');
  table.string('email').withUnique();
  table.string('name');
  table.string('age');
});

Features

  • wrapped driver. unify all driver query api
  • compile query builder to sql
  • decorate to define model
  • soft delete
  • use relationship to link model
  • relation can set dynamic constrain
  • sqlite and mysql support

Readme

Keywords

none

Package Sidebar

Install

npm i @gradii/fedaco

Weekly Downloads

6

Version

1.1.14

License

MIT

Unpacked Size

1.98 MB

Total Files

836

Last publish

Collaborators

  • xsilen