Skip to content

myyrakle/express-mybatis-mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-mybatis-mapper

GitHub license

mybatis-mapper express middleware

It can be installed as follows:

npm install --save express-mybatis-mapper

Middleware registration is as follows.
Pass the path of mybatis files to be registered as an array.

const express = require("express");
const app = express();
......
const mybatis = require("express-mybatis-mapper");
app.use(mybatis(["./example.xml", "./example2.xml"]));
......

After that, you will have a mybatisMapper field in your request object.
If you pass mybatis namespace, id, and context object in order to the getStatement method, the query text is generated and returned.

...
router.get("/", (req, res, next)=>{
    ...
    //generate query text
    const query = req.mybatisMapper.getStatement("example", "SELECT.001", {foo:"bar"});
    ...
});
...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published