@aloxide/model-sequelize
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

Table of content

Package @aloxide/model-sequelize

A model builder for Sequelize

Usage

sample

import { ModelBuilder } from '@aloxide/model-sequelize';

// create model builder from an Aloxide configuration
const modelBuilder = new ModelBuilder({
  aloxideConfig,
  logger: Logger.createLogger({
    level: 'debug',
    name: 'models',
  }),
});

// using mapField
import { indexStateSchema } from '@aloxide/demux';
const typeInterpreter = new SequelizeTypeInterpreter();

const indexStateSequelizeFields = ModelBuilder.mapField(
  typeInterpreter,
  indexStateSchema.fields,
  indexStateSchema.key,
);

// use the model builder
import { Sequelize } from 'sequelize';
const sequelize = new Sequelize('sqlite::memory:');
const models = modelBuilder.build(sequelize);

models.push(sequelize.define(name, indexStateSequelizeFields));

Readme

Keywords

none

Package Sidebar

Install

npm i @aloxide/model-sequelize

Weekly Downloads

0

Version

0.6.0

License

Apache-2.0

Unpacked Size

14.4 kB

Total Files

15

Last publish

Collaborators

  • flowersinthesand
  • manhvu