UNPKG

ilink_updater

Version:

69 lines (44 loc) 1.66 kB
# iperlink insert ## Table of Contents - [Install](#install) - [Introduction](#introduction) - [Input_object](#Input_object) - [Output_object](#Output_object) ## Install ```sh $ 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 ```js 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', id: 1 };//object must have an id this is the id of the row of the updated table var Ins={client:1,//the id of the client obj:obj, query_name:"test_query"//name of query_definition }; ``` ## Output_object ```js 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' } ], make_cache: [ 'test_cache' ], type: 'update' } //////// var object={ table_name: { name: 'table_name', update_id: 1, query: 'update test_db.table_name set ? where id in (1) ', inserted_obj: { name: 'the name ', description: 'the description', tags: 'test|test2' } } } ```