iperlink insert
Table of Contents
Install
$ npm install ilink_insert
Introduction
This is a module that get a raw insert object from a queue, it makes the mysql query and turns it into an object ready to be inserted to the db using sql_queue_processor module. Once it the object is transformed it puts it into a queue for that module to consume.
Input_object
Single table insert
var obj = //the params depend on the db table params based on the query definitions made using query_builder_module name: 'this is the name ' description: 'this is the description' tags: 'test|test2' ; var Ins=client:1//the id of the client obj:obj query_name:"test_query"//name of query_definition ;
Table insert with child
var obj = parent_name :"parent_name" parent_desc: "parent_desc" child_table: //as many child table objects as nedded child_name: "parent_name" child_desc: "parent_desc" // as many diferent child tables as needed ; var Ins=client:1//the id of the client obj:obj query_name:"test_query_with_child"//name of query_definition ;
Output_object
Single table insert
var out= db_name: 'test_db'//name of the client db query_name: 'test_query'//name of query_definition Q_arr: //as many as there where inserted objects has_childs: false //it object has child table (see next example) object: Object// see description below, tags: 'test|test2' mysql_host: '127.0.0.1' make_cache: 'test_cache' type: 'insert' //////// var object= table_name: name: 'table_name' query: 'insert into test_db.table_name set ?' inserted_obj: name: 'the name ' description: 'the description' tags: 'test|test2'
Table insert with child
var obj= db_name: 'test_db' query_name: "test_query_with_child" Q_arr: has_childs: true object: Object make_cache: 'cache_parent' mongo_host: '127.0.0.1' type: 'insert' var obj= worker: name: 'worker' query: 'insert into test_db.child () values ?' multi: true values: Object
the parent table is inserted direct