CN113467765A - Js-based database request modular processing method, equipment and storage medium - Google Patents
Js-based database request modular processing method, equipment and storage medium Download PDFInfo
- Publication number
- CN113467765A CN113467765A CN202111035466.1A CN202111035466A CN113467765A CN 113467765 A CN113467765 A CN 113467765A CN 202111035466 A CN202111035466 A CN 202111035466A CN 113467765 A CN113467765 A CN 113467765A
- Authority
- CN
- China
- Prior art keywords
- database
- node
- file
- request
- processing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a node.js-based database request modular processing method, equipment and a storage medium, wherein the node.js-based database request modular processing method comprises the following steps: creating project files for processing files as a modular database; encapsulating functions and methods, which are realized in advance, related to requesting a database, processing exception and returning correct information into the modularized database processing file; creating an access interface of the modularized database processing file, and exposing and exporting the modularized database processing file; when a background requests a database, the modularized database processing file is imported into the database request file through the access interface so as to realize the database request of the background. Therefore, the node.js developer can quickly develop corresponding codes, the workload of each node.js for requesting background data is reduced, the working efficiency of the node.js developer is improved, and errors of requesting database data in the node.js development process are avoided.
Description
Technical Field
The invention relates to the field of databases, in particular to a node.js-based database request modular processing method, node.js-based database request modular processing equipment and a computer-readable storage medium.
Background
In the background development of the current application software node. js, there is often a js function file which requests a database, and a situation of requesting data of a plurality of servers (for example, one node requests equipment information, whether a user has the equipment, requests user information, production line and equipment related information, requests factory floor and equipment related information, and the like), each node. js background request must ensure that a database statement is to be set, the database request statement of the request server is correct, a configuration error exception return mechanism is provided to export an error, and a correct request is returned to return correct interface data, otherwise, an error occurs. This causes the following major disadvantages: 1. error 2, inefficiency 3, code mashup 4, and code bloat, especially when a piece of software is slightly larger, the amount of code that needs to be written will increase explosively.
Disclosure of Invention
The invention mainly aims to provide a node.js-based database request modular processing method, and aims to solve the technical problems that node.js background development database requests cannot be uniformly managed and code is mixed in the prior art.
In order to achieve the above object, the present invention provides a node.js-based database request modular processing method, which includes:
a node.js project file is created and used as a modular database processing file;
encapsulating functions and methods, which are realized in advance, related to requesting a database, processing exception and returning correct information into the modularized database processing file;
creating an access interface of the modularized database processing file, and exposing and exporting the modularized database processing file;
when a background requests a database, the modularized database processing file is imported into the database request file through the access interface so as to realize the database request of the background.
Optionally, the step of creating a node.
Using an initialization package to create an entry file, an initialization code module, a configuration list, an entry viewing webpage and an abnormal viewing webpage;
and wrapping the log file and the core folder in the log folder to serve as a modularized database processing file, and writing the relevant information of success or failure of each database request into the log file.
Optionally, before the step of encapsulating functions and methods, which are implemented in advance, into the modular database processing file in association with requesting a database, processing an exception, and returning correct information, further includes:
and connecting the database by using the database connection parameters in the database configuration file.
Optionally, after the step of exposing and exporting the modular database processing file, the method further includes:
and coding the database statement by using a coding function so as to perform correct reading, and exposing and exporting the coding function after the database statement is successfully coded.
Optionally, after the step of importing the modular database processing file in a database request file through the access interface, the method further includes:
and taking the functions and methods which are realized in advance and are related to the request of the database, the exception handling and the correct information return as the public functions and public methods of the database request file.
Optionally, the step of implementing a database request in the background includes:
and in the request function of the database request file, calling the public function and the public method to respond to the background database request, and returning abnormal errors and normal data to realize the background database request.
Optionally, the node.js-based database modularization request solution further includes:
and using a promise asynchronous processing constructor in the modularized database processing file to process the abnormal error and normal condition of the database request.
Optionally, the step of processing the abnormal error and normal condition of the database request includes:
and (3) using a method in the premium asynchronous processing constructor, transmitting a resolve method and a reject method as callbacks, resolving a normal condition in the resolve method, and rejecting an abnormal error in the reject method so as to achieve asynchronous processing of the database request.
In addition, to achieve the above object, the present invention further provides a node.js-based modular processing apparatus for a database request, including: a memory, a processor, and a node.js-based database request modular handler stored on the memory and operable on the processor, the node.js-based database request modular handler when executed by the processor implementing the steps of the node.js-based database request modular processing method as described above.
In addition, to achieve the above object, the present invention further provides a computer readable storage medium, where a node.js-based database request modular handler is stored, and when being executed by a processor, the node.js-based database request modular handler implements the steps of the node.js-based database request modular processing method as described above.
The embodiment of the invention provides a node.js-based database request modular processing method, equipment and a computer-readable storage medium, wherein a project file is created to serve as a modular database processing file; encapsulating functions and methods, which are realized in advance, related to requesting a database, processing exception and returning correct information into the modularized database processing file; creating an access interface of the modularized database processing file, and exposing and exporting the modularized database processing file; when a background requests a database, the modularized database processing file is imported into the database request file through the access interface so as to realize the database request of the background. Therefore, the node.js developer can quickly develop corresponding codes, the workload of each node.js for requesting background data is reduced, the working efficiency of the node.js developer is improved, and errors of requesting database data in the node.js development process are avoided.
Drawings
Fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of an embodiment of a node.js-based database request modular processing method of the present invention;
fig. 3 is a schematic diagram of a project file in an embodiment of a node.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
As shown in fig. 1, fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention.
The operation equipment of the embodiment of the invention can be a PC, and can also be a mobile terminal equipment with a display function, such as a smart phone, a tablet computer, an electronic book reader, a portable computer and the like.
As shown in fig. 1, the operation device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Optionally, the operation device may further include a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WiFi module, and the like. Such as light sensors, motion sensors, and other sensors. In particular, the light sensor may include an ambient light sensor and a proximity sensor. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile device is stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration) for recognizing the attitude of the mobile device, and related functions (such as pedometer and tapping) for vibration recognition; of course, the mobile operation device may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, which are not described herein again.
Those skilled in the art will appreciate that the operational equipment configuration shown in FIG. 1 does not constitute a limitation of the operational equipment, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, the memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a node.
In the operating device shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call the node.js-based database request modular handler stored in the memory 1005 and perform the following operations:
a node.js project file is created and used as a modular database processing file;
encapsulating functions and methods, which are realized in advance, related to requesting a database, processing exception and returning correct information into the modularized database processing file;
creating an access interface of the modularized database processing file, and exposing and exporting the modularized database processing file;
when a background requests a database, the modularized database processing file is imported into the database request file through the access interface so as to realize the database request of the background.
Further, the processor 1001 may call the node.js-based database request modular handler stored in the memory 1005, and further perform the following operations:
using an initialization package to create an entry file, an initialization code module, a configuration list and an abnormal viewing webpage;
and wrapping the log file and the core folder in the log folder to serve as a modularized database processing file, and writing the relevant information of success or failure of each database request into the log file.
Further, the processor 1001 may call the node.js-based database request modular handler stored in the memory 1005, and further perform the following operations:
and connecting the database by using the database connection parameters in the database configuration file.
Further, the processor 1001 may call the node.js-based database request modular handler stored in the memory 1005, and further perform the following operations:
and coding the database statement by using a coding function so as to perform correct reading, and exposing and exporting the coding function after the database statement is successfully coded.
Further, the processor 1001 may call the node.js-based database request modular handler stored in the memory 1005, and further perform the following operations:
and taking the functions and methods which are realized in advance and are related to the request of the database, the exception handling and the correct information return as the public functions and public methods of the database request file.
Further, the processor 1001 may call the node.js-based database request modular handler stored in the memory 1005, and further perform the following operations:
and in the request function of the database request file, calling the public function and the public method to respond to the background database request, and returning abnormal errors and normal data to realize the background database request.
Further, the processor 1001 may call the node.js-based database request modular handler stored in the memory 1005, and further perform the following operations:
and using a promise asynchronous processing constructor in the modularized database processing file to process the abnormal error and normal condition of the database request.
Further, the processor 1001 may call the node.js-based database request modular handler stored in the memory 1005, and further perform the following operations:
and (3) using a method in the premium asynchronous processing constructor, transmitting a resolve method and a reject method as callbacks, resolving a normal condition in the resolve method, and rejecting an abnormal error in the reject method so as to achieve asynchronous processing of the database request.
Referring to fig. 2, the present invention provides a node.js-based database request modular processing method, and in a flow of the node.js-based database request modular processing method of the present invention, the flow includes:
in step S10, a node. js project file is created for use as a modular database process file.
Js is an open-source and cross-platform JavaScript running environment based on a Chrome V8 engine, a V8 JavaScript engine is run outside a browser, and simply, the node is JavaScript running at a server. Js uses an event-driven, non-blocking I/O model, making it lightweight and efficient. Js packet manager npm, the largest open source repository ecosystem around the world. In the beginning of the node.js-based database request modularization processing method of the present invention, a node.js project file is created, and the project file includes a necessary folder during operation, as shown in fig. 3, in an embodiment of the present invention, a project file blog-express includes a bin binary folder, a control configuration folder, a controller folder, a db database folder, a logs folder, a midleware middleware folder, a model folder, a public folder, a routes routing folder, a utilics folder, a views folder, and the like. In the embodiment of the invention, the names of the folders are not limited, and the method follows the principle of knowing names in the software development process. Codes for realizing database processing are compiled in different js files under all folders, and the whole project file is used as a modular database processing file after the codes are compiled. Optionally, in the subsequent development process, the node.js-based database request modular processing method of the present invention may be packaged and uploaded to npm for sharing.
Step S20, encapsulating the functions and methods implemented in advance, relating to requesting a database, handling exceptions, and returning correct information, into the modular database handling file.
In an embodiment of the present invention, a function is implemented in the mysql.js file in the db database folder shown in fig. 3, and parameters of the function are database statements, and whether the input database statements are normal or correct is determined by screening the received database statement parameters through a determination statement. And related functions and methods are created in the function in advance and used for realizing the functions of requesting a database, processing exception and returning correct information, and the functions and the methods are packaged into the function to form a modular database processing file. For incorrect database statements or incorrect grammars or wrong exceptions, processing the statements or the grammars through related functions and methods for processing exceptions in the functional functions, and returning related error information and/or error data to a database processing file for quoting and importing the functional functions; and processing the correct database statement or the correct grammar or the correct information through the related function and method which are normally processed in the functional function, and returning the related correct information and/or the correct data to a database processing file which refers to and imports the functional function.
And step S30, creating an access interface of the modularized database processing file, and exposing and exporting the modularized database processing file.
Js provides two objects of ports and require, wherein the ports are interfaces disclosed by the modules, and the require is used for acquiring the interface of one module from the outside, namely the ports object of the acquired module. After the function functions of requesting the database, processing the exception and returning the correct information are realized in the mysql.js file in the db database folder shown in fig. 3, the function functions of requesting the database, processing the exception and returning the correct information are taken as the access interfaces of the modules through the exports object, the modularized database processing file is exposed and exported, and the modularized database processing file can be called by introducing various realized functions and methods in the access interface calling function functions at the place where the background database data needs to be requested.
Step S40, when the background requests the database, importing the modular database processing file in the database request file through the access interface to implement the database request of the background.
At the place where the background database data is required to be requested, the function of requesting the database, processing the exception and returning the correct information is realized by loading the require object, and then the member functions of the exports object in the modularized database processing file can be directly accessed, namely the related functions and methods pre-established in the function functions can be directly accessed to realize the database request.
In the embodiment, the project file is created to be used as a modularized database processing file; encapsulating functions and methods, which are realized in advance, related to requesting a database, processing exception and returning correct information into the modularized database processing file; creating an access interface of the modularized database processing file, and exposing and exporting the modularized database processing file; when a background requests a database, the modularized database processing file is imported into the database request file through the access interface so as to realize the database request of the background. Therefore, by designing a modular processing solution capable of unifying database requests, only a database statement needs to be written, and a subsequent error check judgment code of the database statement, an abnormal feedback mechanism and a correct data feedback mechanism of the database statement are all integrated in a functional function and serve as a modular database processing file. In the database request file, the function is directly called to realize the function of requesting the database. Therefore, the problems that in the prior art, a developer needs to write database sentences independently for each database request, codes for error checking and judging corresponding to the written database sentences, an abnormal feedback mechanism and a correct data feedback mechanism for the database sentences are solved, the process is redundant, the codes are complicated and bloated, and especially when one piece of software is slightly larger, the amount of codes to be written can be increased explosively are solved. Therefore, the development burden of node.js developers is greatly reduced, the error generation probability is reduced, and the development speed and the accuracy of the node.js developers are improved.
Optionally, the step of creating a node.
Using an initialization package to create an entry file, an initialization code module, a configuration list, an entry viewing webpage and an abnormal viewing webpage;
and wrapping the log file and the core folder in the log folder to serve as a modularized database processing file, and writing the relevant information of success or failure of each database request into the log file.
As shown in fig. 3, in an embodiment of the present invention, in a project file blog-express, configuration of a basic operating environment is completed using an initialization packet "npm init-y", a new portal file app.js is created, an initialization code module init.js is created, a configuration list packet.json is created, a new portal view web page index.html and an abnormal view web page 404.html are created, a log file log is used to wrap a log file access.log and a core folder conf, and a db.js file in the core folder conf is used as a modular database file, and each database request, successful log information or failed log information is written into the log folder. In the embodiment of the invention, the names of the files are not limited, and the method follows the principle of knowing names in the software development process.
Optionally, before the step of encapsulating functions and methods, which are implemented in advance, into the modular database processing file in association with requesting a database, processing an exception, and returning correct information, further includes:
and connecting the database by using the database connection parameters in the database configuration file.
Js provides two objects of ports and require, wherein the ports are interfaces disclosed by the modules, and the require is used for acquiring the interface of one module from the outside, namely the ports object of the acquired module. Loading a database module by using a require object, and loading a db.js file in a conf folder under a current secondary directory as shown in fig. 3 by using the require object, namely loading a configuration file of a database to be connected by using the require object, then creating a connection object, and reading database connection parameters from the configuration file of the database to be connected for connection. The database connection parameters include, but are not limited to, host address, user username, password, port number (default: 3306), database name, charset connection character set, etc. The database operations after connecting the database include, but are not limited to, one or more combinations of querying data, inserting data, updating data, and deleting data.
Optionally, after the step of exposing and exporting the modular database processing file, the method further includes:
and coding the database statement by using a coding function so as to perform correct reading, and exposing and exporting the coding function after the database statement is successfully coded.
The JavaScript provided escape () encoding function can encode the character string so that the character string can be read on all computers. This method does not encode ASCII (American Standard Code for Information exchange) letters and numbers, nor does it encode the following ASCII punctuation symbols: @ - +/, all other characters are replaced by escape sequences. And coding the database statement character string by using a coding function so as to correctly read the database statement character string and avoid the input of an error database statement character string. Similarly, the encoding function after the database statement is successfully encoded is exposed and exported by using the exports object, so that the encoding function can be directly used in a file needing an escape () encoding function without repeating the following steps: and connecting the database by using the database connection parameters in the database configuration file, and calling a database escape () coding function by using the database instance.
Optionally, after the step of importing the modular database processing file in a database request file through the access interface, the method further includes:
and taking the functions and methods which are realized in advance and are related to the request of the database, the exception handling and the correct information return as the public functions and public methods of the database request file.
In the file which needs to request the database data, namely in the database request file, the database processing file which is exposed and exported is imported through the access interface, the functions and methods which are realized in advance in the function of the database processing file and are related to the request of the database, the processing exception and the return of correct information are used as the public functions and public methods of the database request file by public keywords so as to be directly called.
Optionally, the step of implementing a database request in the background includes:
and in the request function of the database request file, calling the public function and the public method to respond to the background database request, and returning abnormal errors and normal data to realize the background database request.
The function and method which are realized in advance in the function of the database processing file and are related to the request database, the processing exception and the return of correct information are directly used for responding to the background database request, returning the error information of the processing exception and normally processing data, thereby realizing the background database request
Optionally, the node.js-based database modularization request solution further includes:
and using a promise asynchronous processing constructor in the modularized database processing file to process the abnormal error and normal condition of the database request.
The plan object, i.e., the plan asynchronous processing constructor, is provided natively in ECMAScript6 (European Computer Manufacturers Association Script, 6 th generation Script design language specification). The Promise object represents an event that will occur in the future to deliver asynchronously operated messages. The Promise class includes three methods, namely then (), catch () and final (), wherein parameters of the three methods are all one function, the then () can add the function in the parameters to a normal execution sequence of the current Promise, the catch () is an exception processing sequence for setting the Promise, and the final () is a sequence which is executed in the last time the Promise is executed. the functions that they have come in are executed sequentially in order, and any exception will jump directly to the catch sequence. In an embodiment of the present invention, the determination logic is completed by implementing the method of the () of the then (), catch () and finally () in the Promise class, and in the database request file that needs to request the background database data is received, the data request of the database is completed by returning the Promise, so as to process the abnormal error and normal condition of the database request.
Optionally, the step of processing the abnormal error and normal condition of the database request includes:
and (3) using a method in the premium asynchronous processing constructor, transmitting a resolve method and a reject method as callbacks, resolving a normal condition in the resolve method, and rejecting an abnormal error in the reject method so as to achieve asynchronous processing of the database request.
In JavaScript, to avoid dead loops, the idea of asynchronous programming is generally used, and an asynchronous operation function often implements result processing of an asynchronous task through a callback function. In conventional single-threaded programming, the execution of programs is synchronous (synchronous does not mean that all steps are executed simultaneously, but means that the steps are executed sequentially in a control flow sequence). The asynchronous concept is a concept that does not guarantee synchronization, that is, the execution of an asynchronous process will not have a sequential relationship with the original sequence. The simple understanding is that: the synchronous execution is carried out according to the code sequence, the asynchronous execution is not carried out according to the code sequence, and the asynchronous execution efficiency is higher.
In an embodiment of the invention, abnormal errors and normal conditions of the database request are processed by using a promise asynchronous processing constructor in processing the file in the data. Specifically, after receiving a database statement returned by a database request file, selecting different methods of a premium class needing to process the database statement by using a logic judgment statement, implementing a resolve method in the then () method of the premium class to receive correct information, and analyzing a normal condition in the resolve method; a reject method is implemented in the catch () method of the Promise class to receive any error exception information, and exception errors are rejected in the reject method. I.e., pass the resolve and reject methods as callbacks to achieve asynchronous processing of database requests.
In addition, an embodiment of the present invention further provides a node.js-based modular processing device for a database request, where the node.js-based modular processing device for a database request includes: a memory, a processor, and a node.js-based database request modular handler stored on the memory and operable on the processor, the node.js-based database request modular handler when executed by the processor implementing the steps of the node.js-based database request modular processing method as described above.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, where a node.js-based database request modular handler is stored in the computer-readable storage medium, and when executed by a processor, the node.js-based database request modular handler implements the steps of the node.js-based database request modular processing method described above.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. A modular processing method for a database request based on node.js is characterized in that the modular processing method for the database request based on node.js comprises the following steps:
a node.js project file is created and used as a modular database processing file;
encapsulating functions and methods, which are realized in advance, related to requesting a database, processing exception and returning correct information into the modularized database processing file;
creating an access interface of the modularized database processing file, and exposing and exporting the modularized database processing file;
when a background requests a database, the modularized database processing file is imported into the database request file through the access interface so as to realize the database request of the background.
2. The node.js-based modular processing method for database requests as set forth in claim 1 wherein said step of creating a node.js project file comprises:
using an initialization package to create an entry file, an initialization code module, a configuration list, an entry viewing webpage and an abnormal viewing webpage;
and wrapping the log file and the core folder in the log folder to serve as a modularized database processing file, and writing the relevant information of success or failure of each database request into the log file.
3. A node.js-based modular processing method for database requests according to claim 1 wherein prior to said step of encapsulating functions and methods previously implemented in relation to requesting databases, handling exceptions and returning correct information into said modular database processing file, further comprising:
and connecting the database by using the database connection parameters in the database configuration file.
4. A node.js-based modular processing method for database requests according to claim 1 further comprising, after said step of exposing export of said modular database process files:
and coding the database statement by using a coding function so as to perform correct reading, and exposing and exporting the coding function after the database statement is successfully coded.
5. The node.js-based modular processing method for database requests as set forth in claim 1 wherein, after said step of importing said modular database processing file in a database request file through said access interface, further comprising:
and taking the functions and methods which are realized in advance and are related to the request of the database, the exception handling and the correct information return as the public functions and public methods of the database request file.
6. The node.js-based modular processing method for database requests as set forth in claim 5, wherein said step of implementing a background database request comprises:
and in the request function of the database request file, calling the public function and the public method to respond to the background database request, and returning abnormal errors and normal data to realize the background database request.
7. The node.js-based modular processing method for database requests as recited in claim 1, wherein said node.js-based modular request resolution method for databases further comprises:
and using a promise asynchronous processing constructor in the modularized database processing file to process the abnormal error and normal condition of the database request.
8. The node.js-based modular processing method for database requests as recited in claim 7, wherein said step of processing abnormal errors and normality of database requests comprises:
and (3) using a method in the premium asynchronous processing constructor, transmitting a resolve method and a reject method as callbacks, resolving a normal condition in the resolve method, and rejecting an abnormal error in the reject method so as to achieve asynchronous processing of the database request.
9. A node.js-based modular processing device for database requests, the node.js-based modular processing device for database requests comprising: a memory, a processor and a node.js-based database request modular handler stored on the memory and executable on the processor, the node.js-based database request modular handler when executed by the processor implementing the steps of the node.js-based database request modular processing method according to any of claims 1 to 8.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a node.js-based modular database request handler, which when executed by a processor implements the steps of the node.js-based modular database request handling method according to any of claims 1 to 8.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111035466.1A CN113467765A (en) | 2021-09-06 | 2021-09-06 | Js-based database request modular processing method, equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111035466.1A CN113467765A (en) | 2021-09-06 | 2021-09-06 | Js-based database request modular processing method, equipment and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN113467765A true CN113467765A (en) | 2021-10-01 |
Family
ID=77867545
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111035466.1A Pending CN113467765A (en) | 2021-09-06 | 2021-09-06 | Js-based database request modular processing method, equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN113467765A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119357265A (en) * | 2024-10-10 | 2025-01-24 | 山东浪潮智能生产技术有限公司 | Method, electronic device and storage medium for simulating background CRUD interface service based on node |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150242531A1 (en) * | 2014-02-25 | 2015-08-27 | International Business Machines Corporation | Database access control for multi-tier processing |
| CN109241037A (en) * | 2018-08-28 | 2019-01-18 | 郑州云海信息技术有限公司 | A kind of method, apparatus that realizing database processing, equipment and storage medium |
| CN109726313A (en) * | 2018-12-28 | 2019-05-07 | 中国银行股份有限公司 | The method and device of operating database |
| CN111666283A (en) * | 2020-05-12 | 2020-09-15 | 埃睿迪信息技术(北京)有限公司 | Method for unified data access in heterogeneous data storage environment of data lake |
-
2021
- 2021-09-06 CN CN202111035466.1A patent/CN113467765A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150242531A1 (en) * | 2014-02-25 | 2015-08-27 | International Business Machines Corporation | Database access control for multi-tier processing |
| CN109241037A (en) * | 2018-08-28 | 2019-01-18 | 郑州云海信息技术有限公司 | A kind of method, apparatus that realizing database processing, equipment and storage medium |
| CN109726313A (en) * | 2018-12-28 | 2019-05-07 | 中国银行股份有限公司 | The method and device of operating database |
| CN111666283A (en) * | 2020-05-12 | 2020-09-15 | 埃睿迪信息技术(北京)有限公司 | Method for unified data access in heterogeneous data storage environment of data lake |
Non-Patent Citations (2)
| Title |
|---|
| OLI ZHAO: "node mysql模块化_node.js当中模块化开发的基本流程及require加载文件的规则", 《CSDN: HTTPS://BLOG.CSDN.NET/WEIXIN_28950543/ARTICLE/DETAILS/114353626》 * |
| 雾横: "nodejs的模块化、路由、函数API封装", 《CSDN: HTTPS://BLOG.CSDN.NET/QQ_45228330/ARTICLE/DETAILS/109226062》 * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119357265A (en) * | 2024-10-10 | 2025-01-24 | 山东浪潮智能生产技术有限公司 | Method, electronic device and storage medium for simulating background CRUD interface service based on node |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112015430B (en) | JavaScript code translation method, device, computer equipment and storage medium | |
| CN106412086B (en) | Method and system for automatically generating communication code by using protocol description file | |
| CN105872083A (en) | Method and system supporting server access by different types of clients as well as server | |
| EP1723561A1 (en) | Method, data processing device, computer program product and arrangement for processing electronic data | |
| CN117033249B (en) | Test case generation method and device, computer equipment and storage medium | |
| CN110737631A (en) | data analysis method and device based on Flink engine | |
| WO2022054101A1 (en) | Method and system for automated software accessibility testing | |
| CN115599359A (en) | Code generation method, device, equipment and medium | |
| CN117111892A (en) | Front-end page processing method and device, computer equipment and storage medium | |
| CN113467765A (en) | Js-based database request modular processing method, equipment and storage medium | |
| CN116974929A (en) | Automatic test tool construction method, automatic test method and related equipment thereof | |
| CN111459810A (en) | Method of constructing application program, programming apparatus, and computer-readable storage medium | |
| CN116414689A (en) | Interface parameter verification method and system based on reflection mechanism | |
| CN110764746B (en) | Script generation method and device and computer readable storage medium | |
| CN117785181B (en) | A code execution method, device, equipment and storage medium thereof | |
| CN119127285A (en) | A software toolkit development method, device, computer equipment and storage medium | |
| CN113377377A (en) | Static code analysis method, analysis device, electronic device and readable storage medium | |
| CN114116683B (en) | Multi-language processing method and device for computing platform and readable storage medium | |
| CN111488286A (en) | Method and device for independently developing Android module | |
| CN115480771B (en) | Method and related device for deploying algorithms | |
| CN117094285A (en) | Method, system and computing device for executing instructions based on natural language | |
| CN117931156A (en) | Method, apparatus and storage medium for executing script command | |
| CN114998038A (en) | Abnormal policy processing method and system | |
| CN114385937A (en) | Page adaptation method, device, equipment and storage medium | |
| CN117075912B (en) | Method for program language conversion, compiling method and related equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20211001 |