CN114416778A - Function construction method and device, electronic equipment and readable storage medium - Google Patents

Function construction method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN114416778A
CN114416778A CN202210073744.0A CN202210073744A CN114416778A CN 114416778 A CN114416778 A CN 114416778A CN 202210073744 A CN202210073744 A CN 202210073744A CN 114416778 A CN114416778 A CN 114416778A
Authority
CN
China
Prior art keywords
function
lambda
sql
sql statement
service logic
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
Application number
CN202210073744.0A
Other languages
Chinese (zh)
Inventor
刘翔宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202210073744.0A priority Critical patent/CN114416778A/en
Publication of CN114416778A publication Critical patent/CN114416778A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a function construction method, a function construction device, electronic equipment and a readable storage medium, and relates to the technical field of computers, wherein the method comprises the following steps: acquiring a Structured Query Language (SQL) statement for realizing preset business logic; analyzing the SQL statement to obtain a plurality of SQL statement objects; generating a response type lambda function which has the same business logic with the SQL clause corresponding to each SQL statement object and is used as a lambda function to be processed; and combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic. Based on this, the use and maintenance costs of the system can be reduced.

Description

Function construction method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a function construction method and apparatus, an electronic device, and a readable storage medium.
Background
With the rapid development of computer technology, a system (e.g., an internet of things system) may receive an event input by a user (e.g., an event that the user triggers an air conditioner switch), and accordingly, the system may determine how to process the event according to a preset determination condition, and further, may execute a corresponding service process to obtain a processing result.
In the related art, in order to enable the system to implement the business logic in the above process, a technician may write code for implementing the business logic based on a scripting language (e.g., JavaScript, Lua). However, the use of scripting languages is more critical, and the requirements on technicians are relatively high, which in turn increases the cost of using and maintaining the system.
Disclosure of Invention
The embodiment of the invention aims to provide a function construction method, a function construction device, electronic equipment and a readable storage medium, which can reduce the use and maintenance cost of a system. The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a method for constructing a function, the method including:
acquiring an SQL (Structured Query Language) statement for realizing preset service logic;
analyzing the SQL statement to obtain a plurality of SQL statement objects;
generating a response type lambda function which has the same business logic with the SQL clause corresponding to each SQL statement object and is used as a lambda function to be processed;
and combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic.
Optionally, after the λ functions to be processed are combined to obtain a λ function chain for implementing the preset service logic, the method further includes:
and when receiving the data stream corresponding to the preset service logic, processing the data stream according to the lambda function chain to obtain a processing result.
Optionally, when receiving the data stream corresponding to the preset service logic, processing the data stream according to the λ function chain to obtain a processing result, where the processing result includes:
and when receiving the data stream corresponding to the preset service logic through the data receiving interface corresponding to the lambda function chain, calling the lambda function chain to process the data stream to obtain a processing result.
Optionally, the generating, for each SQL statement object, a responsive λ function having the same business logic as the SQL clause corresponding to the SQL statement object as the to-be-processed λ function includes:
acquiring a function template of a lambda function, which is constructed in advance based on a response function library and has the same business logic with an SQL clause corresponding to each SQL statement object;
generating a variable of a corresponding lambda function based on the parameters of the SQL statement object;
and filling the generated variables into the function template to obtain the corresponding lambda function to be processed.
Optionally, the combining the to-be-processed λ functions to obtain a λ function chain for implementing the preset service logic includes:
and combining the lambda functions to be processed according to the specified sequence of the corresponding SQL clauses to obtain a lambda function chain for realizing the preset service logic.
In a second aspect of the present invention, there is provided a function construction apparatus, comprising:
the system comprises a constructor and a service logic builder, wherein the constructor is used for acquiring a Structured Query Language (SQL) statement for realizing preset service logic;
the analyzer is used for analyzing the SQL statement to obtain a plurality of SQL statement objects;
the builder is also used for generating a response type lambda function which has the same business logic with the SQL clause corresponding to each SQL statement object and is used as a lambda function to be processed; and combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic.
Optionally, the apparatus further comprises:
and the central control core is used for combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic, and processing the data stream according to the lambda function chain when receiving the data stream corresponding to the preset service logic to obtain a processing result.
Optionally, the central control core is specifically configured to, when receiving the data stream corresponding to the preset service logic through the data receiving interface corresponding to the λ function chain, call the λ function chain to process the data stream, so as to obtain a processing result.
Optionally, the builder is specifically configured to, for each SQL statement object, obtain a function template of a λ function that is previously built based on a responsive function library and has the same business logic as the SQL clause corresponding to the SQL statement object;
generating a variable of a corresponding lambda function based on the parameters of the SQL statement object;
and filling the generated variables into the function template to obtain the corresponding lambda function to be processed.
Optionally, the builder is specifically configured to combine the λ functions to be processed according to a specified sequence of the corresponding SQL clause, so as to obtain a λ function chain for implementing the preset service logic.
The embodiment of the invention also provides electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
and a processor for implementing any one of the above function construction methods when executing the program stored in the memory.
The embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements any of the above function construction methods.
Embodiments of the present invention also provide a computer program product containing instructions, which when run on a computer, cause the computer to execute any one of the above function construction methods.
The embodiment of the invention has the following beneficial effects:
according to the function construction method provided by the embodiment of the invention, SQL sentences for realizing preset service logic are obtained; analyzing the SQL statement to obtain a plurality of SQL statement objects; generating a response type lambda function which has the same business logic with the SQL clause corresponding to each SQL statement object and is used as a lambda function to be processed; and combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic.
Based on the processing, a responsive lambda function chain with the same business logic as the SQL statement can be constructed, namely, a user can set the system to have the function of executing the preset business logic through the SQL statement. Compared with the scripting language, the use threshold of the SQL statement is low, and the use and maintenance cost of the system is reduced.
Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by referring to these drawings.
Fig. 1 is a flowchart of a function construction method provided in an embodiment of the present invention;
FIG. 2 is a flow chart of another method for constructing a function provided in an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a method for constructing a function according to an embodiment of the present invention;
fig. 4 is a structural diagram of a function building apparatus provided in an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived from the embodiments given herein by one of ordinary skill in the art, are within the scope of the invention.
In the related art, in order to enable a system (e.g., an internet of things system) to implement a corresponding service logic, a technician may write a code corresponding to the service logic based on a scripting language (e.g., JavaScript, Lua). However, the use of scripting languages is more critical, and the requirements on technicians are relatively high, which in turn increases the cost of using and maintaining the system.
In order to solve the above problem, an embodiment of the present invention provides a function building method, which can be applied to an electronic device. For example, in the technical field of internet of things, the electronic device may be a central control device in an intelligent home, and the central control device may receive an event triggered by a user operation (for example, an operation of pressing an air conditioner switch by the user, or an operation of turning off a bedroom lamp by the user), and process the event according to a corresponding service logic. For example, when it is determined that the user presses the air conditioner switch, all doors and windows are closed; alternatively, when it is determined that the user turns off the bedroom light, the curtain of the bedroom is turned on.
The service logic needs to be preset by a user/technician, that is, based on the method provided by the embodiment of the present invention, the user/technician can set the central control device to have a function of executing the preset service logic only by using an SQL statement, that is, generate a λ function chain having the preset service logic. Correspondingly, when a user triggers a certain operation to generate an event (i.e., a data stream) corresponding to the preset service logic, the central control device may process the event based on the λ function chain to respond to the operation of the user. Compared with the scripting language, the use threshold of the SQL statement is lower, and the use and maintenance cost of the system is reduced.
Referring to fig. 1, fig. 1 is a flowchart of a function building method according to an embodiment of the present invention, where the method may include the following steps:
s101: and acquiring a Structured Query Language (SQL) statement for realizing the preset service logic.
S102: and analyzing the SQL statement to obtain a plurality of SQL statement objects.
S103: and generating a response type lambda function which has the same business logic with the SQL clause corresponding to each SQL statement object and is used as the lambda function to be processed.
S104: and combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic.
The function construction method provided by the embodiment of the invention can construct the response type lambda function chain with the same business logic as the SQL statement, namely, a user can set the system to have the function of executing the preset business logic through the SQL statement. Compared with the scripting language, the use threshold of the SQL statement is low, and the use and maintenance cost of the system is reduced.
For step S101, the preset service logic is determined by the user according to a requirement, for example, for a central control device in an intelligent home, the preset service logic may indicate that all doors and windows are closed when it is determined that the user presses an air conditioner switch; alternatively, the preset service logic may also indicate that when it is determined that the user turns off the bedroom light, then the bedroom curtain is turned on.
SQL is a database query and programming language that is a high-level, non-procedural programming language that allows users to work on high-level data structures with high expressive power and low usage thresholds.
For step S102, in an implementation manner, the SQL statement may be parsed based on the SQL parser to obtain a corresponding abstract syntax tree, and nodes in the abstract syntax tree represent each SQL statement object, that is, a plurality of SQL statement objects included in the SQL statement may be obtained.
For example, for the SQL statement "Select Person From Dept Where agent > 30", after parsing, a Column object (corresponding to the Select Person part), a From object (corresponding to the From Dept part), and a Where object (corresponding to the Where agent >30 part) can be obtained.
For step S103, each SQL statement object corresponds to an SQL clause.
In an SQL statement, a commonly used SQL clause may include: select, From, Where, Group By, and Order By. The Select clause is used for selecting some data from the data table; the From clause is used for specifying a table participating in the query and can also be used for specifying a generated intermediate table; the Where clause is used for setting conditions for selecting data, so that the selected data meet preset conditions; the Group By clauses are used for grouping data; the Order By clause is used for sorting the screening results, and the default is ascending.
For the above example, the SQL clause corresponding to the Column object (corresponding to the Select Person part) is a Select clause; the SQL clause corresponding to the From object (corresponding to the From Dept part) is a From clause; the Where object (corresponding to Where Age >30 section) corresponds to the SQL clause.
Where based on function-responsive programming, functions can be received as input parameters and output return values, i.e., mapping from one function to another can be achieved.
That is, in the embodiment of the present invention, for each SQL clause in the SQL statement, a corresponding (i.e., having a corresponding business logic) responsive λ function may be generated, so as to implement the function of the SQL clause through the λ function.
For example, taking the Where clause as an example, the filter function semantics in the function-response programming are the same as it, both indicating that the data is filtered according to the condition, i.e., both have the same business logic. Thus, the business logic of the Where clause may be implemented using the filter function.
For step S104, after determining each to-be-processed λ function, each to-be-processed λ function may be combined to obtain a λ function chain. Because each lambda function to be processed and the corresponding SQL clause have the same business logic, the lambda function chain obtained by combining the lambda functions to be processed can realize the business logic of the whole SQL clause.
In one embodiment, after the step S104, the method may further include the steps of:
the method comprises the following steps: and when receiving a data stream corresponding to the preset service logic, processing the data stream according to the lambda function chain to obtain a processing result.
In the embodiment of the present invention, after the λ function chain of the preset service logic is generated, when a data stream corresponding to the preset service logic is received, the data stream may be processed based on the λ function chain.
In one implementation, a data flow corresponding to a preset service logic represents an event that triggers the preset service logic. For example, for a central control device in an intelligent home, the preset service logic indicates that all doors and windows are closed when it is determined that a user presses an air conditioner switch, and correspondingly, an event corresponding to the preset service logic is an event corresponding to the user pressing the air conditioner switch; or, the preset service logic indicates that when it is determined that the user turns off the bedroom lamp, the curtain of the bedroom is turned on, and correspondingly, the event corresponding to the preset service logic is the event corresponding to the user turning off the bedroom lamp.
In one embodiment, the first step may include the following steps:
and when receiving the data stream corresponding to the preset service logic through the data receiving interface corresponding to the lambda function chain, calling the lambda function chain to process the data stream to obtain a processing result.
In the embodiment of the present invention, a corresponding data receiving interface may be provided for each λ function chain, for example, an Accept interface may be provided. When the electronic device receives the data stream through the data receiving interface, the corresponding λ function chain may be called to process the received data stream. That is, the λ function chain may be bound to a data stream of a preset service logic through the data receiving interface.
In one embodiment, referring to fig. 2, on the basis of fig. 1, the step S103 may include the following steps:
s1031: and acquiring a function template of a lambda function, which is constructed in advance based on a response function library and has the same business logic with the SQL clause corresponding to each SQL statement object.
S1032: and generating a variable of a corresponding lambda function based on the parameters of the SQL statement object.
S1033: and filling the generated variables into a function template to obtain the corresponding lambda function to be processed.
In the implementation of the invention, for each SQL clause, a function template of a λ function having the same business logic as the SQL clause may be constructed in advance based on the responsive function library.
For example, for the Where clause, the function template of the corresponding λ function constructed may be:
value- > responsive function library filter when (ctx- > filter. apply (ctx))
Wherein, the filter represents the function of the response function library, and the filter represents the variable with the type of the function, which is equivalent to the conditional expression of the where clause.
It will be appreciated that the result is now a function template for the lambda function, which is not filled with the variables of the function. That is, the filter function has not yet been instantiated.
Then, parameters of the SQL statement object, that is, variables of the SQL clause corresponding to the SQL statement object, may be determined to obtain variables to be filled into the function template. After the variables are filled into the function template, that is, the function template is instantiated, the lambda function (that is, the lambda function to be processed) capable of running can be obtained.
In one embodiment, the step S104 may include the following steps:
and combining the lambda functions to be processed according to the specified sequence of the corresponding SQL clauses to obtain a lambda function chain for realizing the preset service logic.
In the embodiment of the invention, according to the implementation principle of the SQL sentences, the SQL clauses contained in the SQL sentences have a specified sequence, so that the obtained lambda functions to be processed can be combined according to the specified sequence of the corresponding SQL clauses to obtain the lambda function chain.
In one implementation, for an SQL statement, the specified order between SQL clauses may be: from- > Where- > Group By- > Order By.
For example, the SQL statement entered by the user is: a select value from source order by value; the input data stream sequence is: {10,5, 22,1}. The response code obtained by analyzing the SQL statement is as follows:
context->orderBy.apply(
column.apply(
row.apply(
from.apply(context))));
that is, each SQL clause (from, order by, select) is translated into a λ function of the same business logic. The output result after the code processing is as follows: {1,5, 10, 22}. As can be seen, the implemented business logic is the same as the SQL statement.
Referring to fig. 3, fig. 3 is a schematic diagram of a function construction method according to an embodiment of the present invention. With respect to fig. 3, the electronic device may contain a plurality of functional modules: a central control core, a builder, a parser, metadata, and functional properties.
And the central control core is used for managing the constructed lambda function chain and is responsible for providing an Application Programming Interface (API) for external interaction and realizing a main flow (including data stream processing). And the builder is used for acquiring the SQL statement, calling the resolver and building a responsive function chain (namely building a lambda function chain) based on the SQL statement object obtained by the resolver. And the analyzer is used for analyzing the SQL statement and generating a programmed SQL statement object. Metadata for managing functional characteristics (including function templates for the lambda function). And the functional characteristics are used for realizing specific functions, such as SQL clauses.
1. The builder receives the SQL statement.
2. The builder creates metadata, including: and 2.1, analyzing the SQL statement by using an analyzer to obtain an SQL statement object. And 2.2, adding functional characteristics, namely determining a function template of a lambda function with the same business logic as the SQL clause corresponding to the SQL statement object.
The functional characteristics include global functional characteristics and custom functional characteristics. The global functional characteristics correspond to a function template of a lambda function corresponding to a commonly-used SQL clause which is constructed in advance. The self-defined function characteristic corresponds to a function template of a lambda function self-defined by a user. Based on the method, functions and syntax which are not possessed by the native SQL statement can be realized, so that the personalized requirements of the user are met.
3. The builder builds a lambda function chain in the central control core with metadata, comprising: 3.1 for each SQL clause, obtaining a corresponding lambda function based on the corresponding SQL statement object and the added functional characteristics. And 3.2, combining the lambda functions according to the SQL execution sequence to obtain a lambda function chain.
Based on the same inventive concept, an embodiment of the present invention further provides a function building apparatus, referring to fig. 4, where fig. 4 is a structural diagram of the function building apparatus provided in the embodiment of the present invention, and the apparatus includes:
a builder 401, configured to obtain an SQL statement for implementing a preset service logic;
a parser 402, configured to parse the SQL statement to obtain a plurality of SQL statement objects;
the builder 401 is further configured to generate, for each SQL statement object, a responsive λ function having the same business logic as the SQL clause corresponding to the SQL statement object, as a λ function to be processed; and combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic.
In one embodiment, the apparatus further comprises:
and the central control core is used for combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic, and processing the data stream according to the lambda function chain when receiving the data stream corresponding to the preset service logic to obtain a processing result.
In an embodiment, the central control core is specifically configured to, when receiving a data stream corresponding to the preset service logic through a data receiving interface corresponding to the λ function chain, call the λ function chain to process the data stream, and obtain a processing result.
In an embodiment, the builder 401 is specifically configured to, for each SQL statement object, obtain a function template of a λ function that is built in advance based on a responsive function library and has the same business logic as SQL clauses corresponding to the SQL statement object;
generating a variable of a corresponding lambda function based on the parameters of the SQL statement object;
and filling the generated variables into the function template to obtain the corresponding lambda function to be processed.
In an embodiment, the builder 401 is specifically configured to combine the λ functions to be processed according to a specified sequence of the corresponding SQL clause, so as to obtain a λ function chain for implementing the preset service logic.
The function building device provided by the embodiment of the invention can build a response type lambda function chain with the same business logic as the SQL statement, namely, a user can set the system to have the function of executing the preset business logic through the SQL statement. Compared with the scripting language, the use threshold of the SQL statement is low, and the use and maintenance cost of the system is reduced.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, which includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, where the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501, when executing the program stored in the memory 503, implements the following steps:
acquiring a Structured Query Language (SQL) statement for realizing preset business logic;
analyzing the SQL statement to obtain a plurality of SQL statement objects;
generating a response type lambda function which has the same business logic with the SQL clause corresponding to each SQL statement object and is used as a lambda function to be processed;
and combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In still another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above function construction methods.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the function construction methods of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the electronic device, and the computer-readable storage medium, and the computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to them, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (12)

1. A method of function construction, the method comprising:
acquiring a Structured Query Language (SQL) statement for realizing preset business logic;
analyzing the SQL statement to obtain a plurality of SQL statement objects;
generating a response type lambda function which has the same business logic with the SQL clause corresponding to each SQL statement object and is used as a lambda function to be processed;
and combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic.
2. The method according to claim 1, wherein after said combining the to-be-processed λ functions to obtain a λ function chain for implementing the preset service logic, the method further comprises:
and when receiving the data stream corresponding to the preset service logic, processing the data stream according to the lambda function chain to obtain a processing result.
3. The method according to claim 2, wherein when receiving a data stream corresponding to the preset service logic, processing the data stream according to the λ function chain to obtain a processing result, includes:
and when receiving the data stream corresponding to the preset service logic through the data receiving interface corresponding to the lambda function chain, calling the lambda function chain to process the data stream to obtain a processing result.
4. The method according to claim 1, wherein the generating, for each SQL statement object, a responsive λ function having the same business logic as the SQL clause corresponding to the SQL statement object as the λ function to be processed includes:
acquiring a function template of a lambda function, which is constructed in advance based on a response function library and has the same business logic with an SQL clause corresponding to each SQL statement object;
generating a variable of a corresponding lambda function based on the parameters of the SQL statement object;
and filling the generated variables into the function template to obtain the corresponding lambda function to be processed.
5. The method according to claim 1, wherein said combining the to-be-processed λ functions to obtain a λ function chain for implementing the preset service logic comprises:
and combining the lambda functions to be processed according to the specified sequence of the corresponding SQL clauses to obtain a lambda function chain for realizing the preset service logic.
6. A function construction apparatus, characterized in that the apparatus comprises:
the system comprises a constructor and a service logic builder, wherein the constructor is used for acquiring a Structured Query Language (SQL) statement for realizing preset service logic;
the analyzer is used for analyzing the SQL statement to obtain a plurality of SQL statement objects;
the builder is also used for generating a response type lambda function which has the same business logic with the SQL clause corresponding to each SQL statement object and is used as a lambda function to be processed; and combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic.
7. The apparatus of claim 6, further comprising:
and the central control core is used for combining the lambda functions to be processed to obtain a lambda function chain for realizing the preset service logic, and processing the data stream according to the lambda function chain when receiving the data stream corresponding to the preset service logic to obtain a processing result.
8. The apparatus according to claim 7, wherein the central control core is specifically configured to, when receiving the data stream corresponding to the preset service logic through the data receiving interface corresponding to the λ function chain, call the λ function chain to process the data stream, so as to obtain a processing result.
9. The apparatus according to claim 6, wherein the builder is specifically configured to, for each SQL statement object, obtain a function template of a λ function that is previously built based on the responsive function library and has the same business logic as the SQL clause corresponding to the SQL statement object;
generating a variable of a corresponding lambda function based on the parameters of the SQL statement object;
and filling the generated variables into the function template to obtain the corresponding lambda function to be processed.
10. The apparatus according to claim 6, wherein the builder is specifically configured to combine the λ functions to be processed according to a specified order of the corresponding SQL clauses, so as to obtain a λ function chain for implementing the preset service logic.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-5.
CN202210073744.0A 2022-01-21 2022-01-21 Function construction method and device, electronic equipment and readable storage medium Pending CN114416778A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210073744.0A CN114416778A (en) 2022-01-21 2022-01-21 Function construction method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210073744.0A CN114416778A (en) 2022-01-21 2022-01-21 Function construction method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN114416778A true CN114416778A (en) 2022-04-29

Family

ID=81275912

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210073744.0A Pending CN114416778A (en) 2022-01-21 2022-01-21 Function construction method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114416778A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115686845A (en) * 2022-10-31 2023-02-03 中科驭数(北京)科技有限公司 Data calculation acceleration method, device, equipment and computer readable storage medium
CN116185495A (en) * 2022-12-13 2023-05-30 易保网络技术(上海)有限公司 Computing function construction method, computing engine, electronic device and readable storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115686845A (en) * 2022-10-31 2023-02-03 中科驭数(北京)科技有限公司 Data calculation acceleration method, device, equipment and computer readable storage medium
CN116185495A (en) * 2022-12-13 2023-05-30 易保网络技术(上海)有限公司 Computing function construction method, computing engine, electronic device and readable storage medium
CN116185495B (en) * 2022-12-13 2023-10-13 易保网络技术(上海)有限公司 Computing function construction method, computing engine, electronic device and readable storage medium

Similar Documents

Publication Publication Date Title
CN114416778A (en) Function construction method and device, electronic equipment and readable storage medium
CN107644323B (en) Intelligent auditing system for business flow
US9953639B2 (en) Voice recognition system and construction method thereof
CN110209700B (en) Data stream association method and device, electronic equipment and storage medium
CN110673854A (en) SAS language compiling method, device, equipment and readable storage medium
CN110609906A (en) Knowledge graph construction method and device, storage medium and electronic terminal
CN112328226B (en) Embedded system automatic test code generation method and device
US10474435B2 (en) Configuration model parsing for constraint-based systems
CN114138748A (en) Database mapping file generation method, device, equipment and storage medium
JP6263858B2 (en) Method, apparatus and computer program for processing knowledge and information
CN109634569B (en) Method, device and equipment for realizing flow based on annotation and readable storage medium
CN108766507A (en) A kind of clinical quality index calculating method based on CQL Yu standard information model openEHR
CN116483850A (en) Data processing method, device, equipment and medium
CN112000690B (en) Method and device for analyzing structured operation statement
CN112182637A (en) Safety control system, method, device and storage medium
US10719424B1 (en) Compositional string analysis
CN110879710B (en) Method for automatically converting RPG program into JAVA program
CN111309301A (en) Program language conversion method, device and conversion equipment
CN114398178A (en) Task execution method and device and electronic equipment
CN114896269A (en) Structured query statement detection method and device, electronic equipment and storage medium
CN114691197A (en) Code analysis method and device, electronic equipment and storage medium
CN112130860A (en) JSON object analysis method and device, electronic device and storage medium
CN113312880B (en) Text form conversion method and device and electronic equipment
CN116756184B (en) Database instance processing method, device, equipment, storage medium and program product
CN114138425B (en) Method and device for generating form based on formula

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