Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@rajuvais03/mysql-orm
Advanced tools
Readme
ORM is a easy way to build query for Mysql, Sqlite, PostgresSQL. compatible, Supportable for Node v10+ Version
Markdown is a lightweight markup language based on the formatting conventions
And of course mysql orm is open source with a [public repository][dill] on GitHub.
mysql ORM requires Node.js v10+ to run. for NPM
npm install @rajuvais03/mysql-orm
for YARN
yarn install @rajuvais03/mysql-orm
Install the dependencies and devDependencies and start the server.
dependencies need here for database connectivity. This is most important when you use [mysql-orm][dill]
npm install dotenv --save
DB_TYPE=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASS=root
DB_NAME=abc
connectionLimit=
DB_TYPE=sqlite
DB_NAME=abc.db
DB_TYPE=postgres
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASS=root
DB_NAME=abc
connectionLimit=
"make-migration": "node node_modules/@rajuvais03/mysql-orm/lib/create_migration.js",
"migrate": "node node_modules/@rajuvais03/mysql-orm/lib/Migrate.js",
"make-controller": "node node_modules//@rajuvais03/mysql-orm/lib/controller.js",
"make-model": "node node_modules//@rajuvais03/mysql-orm/lib/model.js"
"make-route": "node node_modules//@rajuvais03/mysql-orm/lib/route.js"
[For Migrations][dill], you have run below command for making tables
npm run make-migration create_table_tableName
After that edit migration file from migration folder, Then run command for migrate
npm run migrate
[For Model][dill], You have to run command given below
npm run make-model modelName
[For Controller][dill], You have to run command given below
npm run make-controller controllerName
[For Routes][dill], You have to run command given below
npm run make-route routeName
await model.find();
await model.findOne({uid:uid});
await model.sortBy({"uid":"asc","name":"desc"}).find();
await model.sortBy(["uid","name"]).find();
await model.sortBy(["uid","name"],"desc").find();
await model.sortBy("uid","desc").find();
await model.sortBy(["uid","name"],"desc").limit(10).offset(0).find();
await model.select(["uid","desc"]).limit(10).offset(0).find();
await model.select(["uid","desc"]).limit(10).offset(0).findOne({uid:uid});
await model.find({"name":"raju"});
await model.find({"name":"raju","email":"raju@ril.com"});
await model.find({"name":{$eq:"raju"}}); // for Equal check
await model.find({"uid":{$gt:5}}); // for Greater check
await model.find({"uid":{$gte:5}}); // for Greater Equal check
await model.find({"uid":{$lt:5}}); // for Lesser check
await model.find({"uid":{$lte:5}}); // for Lesser Equal check
await model.find({"uid":{$ne:5}}); // for not equal check
await model.find({"uid":{$btw:[5,10]}}); // for between check
await model.find({"uid":{$in:[5,10]}}); // for checking data available into array using $in
await model.find({"uid":{$nin:[5,10]}}); // for checking data not available into array using $in
await model.find({"name":{$like:"raju"}}); // for searching data using $like
await model.find({$and:[{"name":"raju"},{"name":"rahul"}]}); // using $and operator
await model.find({$or:[{"name":{$eq:"raju"}},{"name":{$eq:"rahul"}}]}); // same as $and operator
await model.find({$nor:[{"name":"raju"},{"name":"rahul"}]}); // using $nor operator
await model.find({$not:[{"name":"raju"},{"name":"rahul"}]}); // using $not operator
await model.find({ "Age": { $ngt:"25"} }); // using $ngt not greater than operator
await model.find({$or: [{"by": "tutorials point"},{"title": "MongoDB Overview"}],$and: [{"by": "tutorials point"},{"title": "MongoDB Overview"}] } ); // using $or and $and operator
await model.find({"likes": {$gt:10}, $or: [{"by": "tutorials point"},{"title": "MongoDB Overview"}]}); // mixed operator
await model.join("user_roles","user_roles.user_id","=","users.uid").join("roles","roles.uid","=","user_roles.role_id").select(["users.name","users.email","users.uid","roles.name AS role"]).find();
await model.leftJoin("user_roles","user_roles.user_id","=","users.uid").leftJoin("roles","roles.uid","=","user_roles.role_id").select(["users.name","users.email","users.uid","roles.name AS role"]).find();
await model.rightJoin("user_roles","user_roles.user_id","=","users.uid").rightJoin("roles","roles.uid","=","user_roles.role_id").select(["users.name","users.email","users.uid","roles.name AS role"]).find();
await model.fullJoin("user_roles","user_roles.user_id","=","users.uid").fullJoin("roles","roles.uid","=","user_roles.role_id").select(["users.name","users.email","users.uid","roles.name AS role"]).find();
await model.leftJoin("user_roles","user_roles.user_id","=","users.uid").leftJoin("roles","roles.uid","=","user_roles.role_id").select(["users.name","users.email","users.uid","roles.name AS role"]).groupBy("role").find();
await model.leftJoin("user_roles","user_roles.user_id","=","users.uid").leftJoin("roles","roles.uid","=","user_roles.role_id").select(["users.name","users.email","users.uid","roles.name AS role"]).groupBy(["role","users.name"]).find();
await model.select(["uid","sum(status) AS status"]).find()
await model.select(["uid","avg(status) AS status"]).find();
await model.select(["uid","count(status) AS status"]).find();
await model.select(["uid","min(status) AS status"]).find();
await model.select(["uid","max(status) AS status"]).find();
await model.select(["uid","CASE WHEN emailON = 1 THEN 'true' ELSE 'false' END AS status"]).find();
await model.count();
await model.where("city","jabalpur").count();
const { DB } = require('@rajuvais03/mysql-orm')
await DB('raw query').exec()
await model.insertOne({uid:"heladjlfaksdfka",name:"raju",email:"abc@gmail.com"});
await model.insertMany([{uid:"heladjlfaksdfka",name:"raju",email:"abc@gmail.com"},{uid:"heladjlfaksdfkf",name:"raju1",email:"raju.vais@ril.com"},{uid:"heladjlfaksdfk1",name:"raju2",email:"abc@gmail.com"}]);
await model.inser({uid:"heladjlfaksdfka",name:"raju",email:"abc@gmail.com"});
{uid:"heladjlfaksdfkf"}
await model.updateOne(condtion, {uid:"heladjlfaksdfka",name:"raju",email:"abc@gmail.com"});
await model.updateMany(condition,[{uid:"heladjlfaksdfka",name:"raju",email:"abc@gmail.com"},{uid:"heladjlfaksdfkf",name:"raju1",email:"abc@gmail.com"},{uid:"heladjlfaksdfk1",name:"raju2",email:"abc@gmail.com"}]);
await model.deleteOne({"uid":"how are you"});
await model.deleteMany({"uid":"how are you"});
await model.delete({"uid":"how are you"});
mysql-orm uses for fast developing. Make a change in your file and instantaneously see your updates!
MIT
FAQs
you can use easy way db queries with this mysql_orm with db mysql, sqlite, postgress
The npm package @rajuvais03/mysql-orm receives a total of 6 weekly downloads. As such, @rajuvais03/mysql-orm popularity was classified as not popular.
We found that @rajuvais03/mysql-orm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.