Coder Social home page Coder Social logo

sequelize-webstorm-live-templates's Introduction

sequelize-webstorm-live-templates

WebStorm Live Templates for defining and flow typing Sequelize models

Installation

  1. Copy the text of templates.xml
  2. Open the WebStorm Preferences
  3. Go to Live Templates
  4. Select the JavaScript section
  5. Paste
  6. Install flow-typed definitions for sequelize

Templates

sequelize-model (Model class file template)

Creates an export default class $MODEL_NAME$ extends Model declaration.

Variables

  • $MODEL_NAME$: the name of the model class
  • $INIT_ATTRIBUTES$: the flow types for attributes required at creation time
  • $ATTRIBUTES$: the flow types for all other attributes

Associations

Make sure to import {Association} from 'sequelize' when using these.

sequelize-bt (BelongsTo association field declaration)

Expand this template inside of a Model class definition. Make sure use the sequelize-imports-bt template at top level to import the necessary flow types.

Variables

  • $TARGET$: the name of the association field
  • $SOURCE_MODEL$: the source model identifier
  • $TARGET_MODEL$: the target model identifier
  • $PRIMARY_KEY$: the flow type of the target model's primary key

sequelize-h1 (HasOne association field declaration)

Expand this template inside of a Model class definition. Make sure use the sequelize-imports-h1 template at top level to import the necessary flow types.

Variables

  • $TARGET$: the name of the association field
  • $SOURCE_MODEL$: the source model identifier
  • $TARGET_MODEL$: the target model identifier
  • $PRIMARY_KEY$: the flow type of the target model's primary key

sequelize-hm (HasMany association field declaration)

Expand this template inside of a Model class definition. Make sure use the sequelize-imports-hm template at top level to import the necessary flow types.

Variables

  • $TARGET_SINGULAR$: the singular name of the association field
  • $TARGET_PLURAL$: the plural name of the association field
  • $SOURCE_MODEL$: the source model identifier
  • $TARGET_MODEL$: the target model identifier
  • $PRIMARY_KEY$: the flow type of the target model's primary key

sequelize-btm (BelongsToMany association field declaration)

Expand this template inside of a Model class definition. Make sure use the sequelize-imports-btm template at top level to import the necessary flow types.

Variables

  • $TARGET_SINGULAR$: the singular name of the association field
  • $TARGET_PLURAL$: the plural name of the association field
  • $SOURCE_MODEL$: the source model identifier
  • $TARGET_MODEL$: the target model identifier
  • $THROUGH_MODEL$: the through model identifier
  • $PRIMARY_KEY$: the flow type of the target model's primary key

sequelize-webstorm-live-templates's People

Contributors

jedwards1211 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.