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

mysql-invoker

v0.0.3

Published

Mysql invoker is used to call stored procedure or function in the database

Downloads

6

Readme

Mysql Invoker

Still in Development

Introduction Installation Getting Started MIT License


Introduction

This module enables you to invoke stored procedure and function that was defined explicitly in your mysql database. At runtime mysql invoker will automatically format the arguments for your stored procedure and function using the object that was pass to it.

Installation

This is done using (NPM) node package manager just copy and past in your terminal and npm will manage the rest.

npm i mysql-invoker --save

Getting Started

To get started with the module, after installation just import the module and then use the destructuring construct to access the implementated class.

import { MysqlInvoker } from 'mysql-invoker';

The Invoker instance

Create a new instance of mysql invoker and pass at least the minimum required configuration options as object, see config options for more information

const mysql = new MysqlInvoker( { /** Config Options **/ } );

Basic Connection Configuration options

Each instance will require a set of configuration options, these options will use when connecting to the database.

| Properties | Type | Required | Description |----------------- | ---------| ---------:|---------------------------------- | host | string | Yes | The host name of the database | user | string | Yes | The user name used by the user | database | string | Yes | The database to establish connection to | password | string | Yes | The password used by the user | multipleStatements | boolean | Optional | Allow for multiple statement to be excecute. Visit mysql github page for more information

Invoking a stored procedure

When invoking a stored procedure or function you need to first create the argument object model. This model will contain all the arguments needed to carry out the excecution process.

Create the store procedure argument model

const createUserArg: any = {

    name: 'Wycliffe Peart'
}

Please note that the order of the arguments in the model must match the order of the stored procedure and function argument list.


async function createUser(createUserArg: object): Promise<any[]>{

    const mysql = new MysqlInvoker( { /** Config Options **/ } );

    return await mysql.invokeProcedure<any[]>('createUser', createUserArg);
}

MIT License

Copyright (c) 2018 Wycliffe Peart

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.