npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nyffels/mynodeorm

v1.0.0-alpha63

Published

A full-fledged ORM framework for NodeJS and MySQL with develop friendly code aimed to handle database migrations, MySQL Query builder / helper and property mapping.

Downloads

66

Readme

MyNodeORM

A full-fledged ORM framework for NodeJS and MySQL with develop friendly code aimed to handle database migrations, MySQL Query builder / helper and property mapping.

Installation

Use the npm package manager to install "MySQL Query Builder" by running the command

npm install @nyffels/mynodeorm

Usage

Map a class to a MySQL table

You need to map your class to a MySQL table and columns to use them in the QueryBuilder function. A mapping happens partial on class level and partial on property level. \

Class decorators

The @id decorator will allow the developer to fetch the class by it's id.
Key: string: This parameter is the ID used to link the string to a class
Class: object: this Object is the class itself declared under this decorator
@id(Key, Class)

The @table decorator contains the name of the table that is linked to this class.
mySqlTableName: string: This includes the MySQL table name linked to this class and will be used in the QueryBuilder
@table(mySqlTableName)

Property decorators

The @column decorator contains the name of the column that is linked to this property.
mySqlColumnName: string: This includes the MySQL column name linked to this property and will be used in the QueryBuidler
@column(mySqlColumnName)

The @type decorator contains the type of the column. If @type is missing of invalid the type will default to a string.
propertyType: number | boolean | date | datetime | string: The decorator contains information about the column type. For all the non-string values it is best practice to declare the types to be 100% certain on SQL generation. @type(propertyType)

Example:

Query Builder

TODO documentation

Standalone functions

MySQL Connections

setConnection()
TODO documentation

getConnection(skipNoConnectionError = true)
TODO documentation

endConnection()
TODO documentation

Query handling

doMutation(sqlQuery: string, options: QueryOptions | null = null)
TODO documentation

doQuery<T = any>(sqlQuery: string, options: QueryOptions | null = null)
TODO documentation

queryResultToObject<T = any>(classObject: Object, results: any[])
TODO documentation

Value parsers

parseString(value: string)
TODO documentation

parseNumber(value: number)
TODO documentation

parseBoolean(value: boolean, canBeNull = false)
TODO documentation

parseDate(date: Date, time = false)
TODO documentation

parseValue(sourceClass: any, property: string, value: any)
TODO documentation

Database Migration

Currently not available in the framework. This function will be released in a newer version.

Progress

  • [X] Property mapping
  • [X] Query helpers
  • [X] Query builders
  • [ ] Database migration tool

Contributing

Pull requests are welcome but open an issue first to discuss what you would like to change.
For major changes, please open an issue first to discuss what you would like to change.

License

MIT - Copyright (c) 2023-2024 Nyffels BV

Links

github (https://github.com/Nyffels-Open-Source/mysql-query-builder)
npmjs (https://www.npmjs.com/package/@nyffels/mysql-query-builder)

Dependencies

  • NodeJS
  • MySQL2 (https://www.npmjs.com/package/mysql2)
  • Lodash (https://www.npmjs.com/package/lodash)

Release notes

Currently in Alpha development with possible breaking changes. Use this software at your own risk. Nyffels doesn't provide Release notes or changelogs at this stage of development.