0.2.1 • Published 5 years ago

spgen v0.2.1

Weekly downloads
6
License
ISC
Repository
-
Last release
5 years ago

spgen - A Stored Procedure Generater to write like JavaScript

Spgen is a tool for creating stored procedures like Javascript.


Example

// type.jssp
type IdentifierUser varchar(8);
// queries.jssp
query selectUser(userId) {
    select count(*) from user
    where user_id = :userId;
}
// import.jssp
import "./type.jssp"
import "./queries.jssp"

use test;

func demoimport(userId IdentifierUser) : int
{
    selectUser('primespace');

    return 0;
}
// generate stored procedure.
spgen generate import.jssp;
use test;

DELIMITER $$


DROP FUNCTION IF EXISTS demoimport;

CREATE FUNCTION demoimport(userId VARCHAR(8)) RETURNS INT
BEGIN

    select count(*) from user
    where user_id = 'primespace';

    return 0;
END 

$$

DELIMITER ;

Install

$ npm install -g spgen

spgen depends on Node.js and npm.

Usage

Usage: spgen <command>

where <command> is one of:
    generate, get, version

spgen generate sample.jssp [-out <path>]
    Converts the sample.jssp into the <path> directory

spgen get samples
    Copy all sample files to the current directory.

spgen version
    Output the version.
// Copy all sample files to the current directory.
$ spgen get samples

Generate stored procedure

// Converts the cursor.jssp into the output directory
$ spgen generate cursor.jssp -out ./output
0.2.1

5 years ago

0.2.0

5 years ago

0.1.51

5 years ago

0.1.50

5 years ago

0.1.40

5 years ago

0.1.39

5 years ago

0.1.38

6 years ago

0.1.37

6 years ago

0.1.36

7 years ago

0.1.35

8 years ago

0.1.34

8 years ago

0.1.33

8 years ago

0.1.31

8 years ago

0.1.30

8 years ago

0.1.29

8 years ago

0.1.28

8 years ago

0.1.27

8 years ago

0.1.26

8 years ago

0.1.25

8 years ago

0.1.24

8 years ago

0.1.23

8 years ago

0.1.22

8 years ago

0.1.21

8 years ago

0.1.20

8 years ago

0.1.19

8 years ago

0.1.18

8 years ago

0.1.17

8 years ago

0.1.16

8 years ago

0.1.15

8 years ago

0.1.14

8 years ago

0.1.13

8 years ago

0.1.12

8 years ago

0.1.11

8 years ago

0.1.10

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago