Script generation methods, SDKs, processors, and electronic devices
By splitting the SDK resource configuration and generating logical and physical scripts, dynamic configuration and adaptation of SDK resources are achieved, solving the problems of high SDK configuration and maintenance costs and insufficient flexibility in existing technologies, and improving the applicability and maintenance efficiency of the SDK.
Patent Information
- Application Number
- CN202211697748.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2042-12-28
AI Technical Summary
In existing technologies, the same set of executable scripts cannot meet the needs of all services, resulting in high configuration and maintenance costs for the SDK and a lack of flexibility. In particular, when designing table partitioning, each independent service can only partition tables according to the same version of the SDK rules, which lacks flexibility.
By receiving service parameters and modifying request information, the MVN plugin is invoked to generate logic and physical scripts, splitting the SDK resource configuration, automatically generating physical scripts for independent services, and retaining logic scripts, thereby achieving dynamic configuration and adaptation of SDK resources.
This reduces the burden on the SDK, solves the problem that the same set of executable scripts cannot meet the needs of all services, and improves the SDK's flexibility and maintenance efficiency.
Smart Images

Figure CN116126955B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database technology, and more specifically, to a script generation method, SDK, computer-readable storage medium, processor, and electronic device. Background Technology
[0002] When the SDK (Software Development Kit) involves database operations, it will have its own resource (executable script) and SQL scripts under that resource. When a separate service depends on this SDK, the SDK configuration is pushed out independently of the separate service during application upgrades. The SDK configuration is maintained and upgraded by the SDK development team.
[0003] Currently, the SDK's resource configuration is pushed independently of individual services. This leads to increasingly higher maintenance and coordination costs for SDK developers as more and more independent services depend on the SDK. Furthermore, as each independent service requires a different SDK version, the number of configuration versions increases, making maintenance more complex. Moreover, when it comes to table partitioning, each independent service can only partition tables according to the same SDK version's rules, which lacks flexibility.
[0004] In the existing solution, multiple services depend on the same set of executable scripts. If a service needs to modify the parameters of an executable script, the same set of executable scripts will not be able to meet the needs of all services. Summary of the Invention
[0005] The main objective of this application is to provide a script generation method, SDK, computer-readable storage medium, processor, and electronic device to at least address the problem that a single set of executable scripts cannot meet the needs of all services.
[0006] To achieve the above objectives, according to one aspect of this application, a script generation method is provided. The method includes: receiving a first predetermined number of parameter modification request messages sent by a first predetermined number of services, wherein the parameter modification request messages characterize parameter information that needs to be modified in a target executable script, the first predetermined number of services correspond one-to-one with the first predetermined number of parameter modification request messages, the first predetermined number being greater than or equal to 1, the predetermined number of services being at least a portion of a plurality of services, and the plurality of services sharing the same group of target executable scripts in a database; and, based on the first predetermined number of parameter modification request messages, invoking an Mvn plugin to generate a logical script corresponding to the target executable script whose parameters need modification and a second predetermined number of physical scripts, wherein the logical script is the target executable script before parameter modification, and the physical script is the target executable script after modification based on the parameter modification request messages, the second predetermined number being less than or equal to the first predetermined number, and the second predetermined number being greater than or equal to 1.
[0007] Optionally, the parameter modification request message includes multiple template tables. Based on the first predetermined number of parameter modification request messages, the Maven plugin is invoked to generate the logic script corresponding to the target executable script whose parameters need to be modified and a second predetermined number of physical scripts. This includes: loading the target executable script to be modified based on the parameter modification request message; invoking the Maven plugin to update the parameters of the target executable script to one of the template tables to generate the logic script; modifying the parameters of the loaded corresponding target executable script based on the first predetermined number of parameter modification request messages to obtain the second predetermined number of modified target executable scripts; and invoking the Maven plugin to update the parameters of the second predetermined number of modified target executable scripts to one of the template tables to generate the second predetermined number of physical scripts.
[0008] Optionally, after generating the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, the method further includes: generating an independent service medium based on the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts; and sending the independent service medium to the service.
[0009] Optionally, after sending the independent service medium to the service, the method further includes: generating control instructions; and sending the control instructions to the service to control the service to execute the independent service medium.
[0010] Optionally, loading the target executable script that needs to be modified according to the parameter modification request message includes: determining the corresponding target executable script from all executable scripts in the database according to the parameter modification request message, wherein the target executable script is at least one set of executable scripts from all executable scripts in the database; and executing the target executable script.
[0011] Optionally, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, including: determining whether the first number of parameters include the same request information; if there is no identical request information, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is equal to the first predetermined number; if there is no identical request information, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is less than the first predetermined number.
[0012] According to another aspect of this application, an SDK is provided, comprising an acquisition unit and a generation unit. The acquisition unit is configured to receive a first predetermined number of parameter modification request messages sent by a first predetermined number of services, wherein the parameter modification request messages are used to characterize parameter information that needs to be modified in a target executable script, the first predetermined number of services correspond one-to-one with the first predetermined number of parameter modification request messages, the first predetermined number is greater than or equal to 1, the predetermined number of services are at least a portion of a plurality of services, and the plurality of services share the same group of target executable scripts in a database; the generation unit is configured to, according to the first predetermined number of parameter modification request messages, call an MVN plugin to generate a logical script corresponding to the target executable script whose parameters need to be modified and a second predetermined number of physical scripts, wherein the logical script is the target executable script before parameter modification, and the physical script is the target executable script after modification according to the parameter modification request messages, the second predetermined number is less than or equal to the first predetermined number, and the second predetermined number is greater than or equal to 1.
[0013] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to execute any of the script generation methods described above.
[0014] According to another aspect of this application, a processor is provided for running a program, wherein the program executes any of the script generation methods described above during runtime.
[0015] According to another aspect of this application, an electronic device is provided, the electronic device including one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including a method for generating any of the scripts described above.
[0016] By applying the technical solution of this application, by modifying the request information according to the first predetermined number of parameters, calling the MVN plugin, and generating the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, the SQL scripts involving database sharding and table partitioning in the SDK's resources can be separated into physical scripts and logical scripts. The logical scripts are retained in the SDK, while the physical scripts are automatically generated by each independent service. When an independent service is upgraded in the future, the resource configurations that the SDK depends on can be pushed up together, which greatly reduces the burden on the SDK and solves the problem that the same set of executable scripts cannot meet the needs of all services. Attached Figure Description
[0017] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 A hardware structure block diagram of a mobile terminal for a script generation method provided in an embodiment of this application is shown.
[0019] Figure 2 A flowchart of a script generation method according to an embodiment of this application is shown;
[0020] Figure 3 A schematic diagram of an SDK provided according to an embodiment of this application is shown.
[0021] The above figures include the following reference numerals:
[0022] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. Detailed Implementation
[0023] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] As described in the background section, existing solutions involve multiple services relying on the same set of executable scripts. If a service needs to modify the parameters of an executable script, the same set of executable scripts may not be able to meet the needs of all services. To solve the problem that the same set of executable scripts cannot meet the needs of all services, embodiments of this application provide a script generation method, an SDK, a computer-readable storage medium, a processor, and an electronic device.
[0027] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0028] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a script generation method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0029] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device information display method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0030] This embodiment provides a method for generating scripts that run on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0031] Figure 2 This is a flowchart illustrating a script generation method according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:
[0032] Step S201: Receive the first predetermined number of parameter modification request information sent by the first predetermined number of services. The parameter modification request information is used to characterize the parameter information that needs to be modified in the target executable script. The first predetermined number of services corresponds one-to-one with the first predetermined number of parameter modification request information. The first predetermined number is greater than or equal to 1. The predetermined number of services is at least a part of multiple services. Multiple services share the same group of target executable scripts in the database.
[0033] Step S202: Based on the first predetermined number of parameter modification request information, call the MVN plugin to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts. The logical script is the target executable script before parameter modification, and the physical script is the target executable script after modification based on the parameter modification request information. The second predetermined number is less than or equal to the first predetermined number and the second predetermined number is greater than or equal to 1.
[0034] Specifically, MVN plugins are tool JAR files that are loaded into MVN through dependencies, enabling pre-configured capabilities during the MVN compilation and packaging process.
[0035] In the above steps, by modifying the request information according to the first predetermined number of parameters, calling the MVN plugin, and generating the logical script corresponding to the target executable script whose parameters need to be modified, and the second predetermined number of physical scripts, the SQL scripts involving database sharding and table partitioning in the SDK's resources can be separated into physical scripts and logical scripts. The SDK retains the logical scripts, while the physical scripts are automatically generated by each independent service. When an independent service is upgraded later, the resource configurations that the SDK depends on can be pushed up together, greatly reducing the burden on the SDK and thus solving the problem that the same set of executable scripts cannot meet the needs of all services.
[0036] In one embodiment of this application, the parameter modification request message includes multiple template tables. Based on the first predetermined number of parameter modification request messages, an Mvn plugin is invoked to generate a logic script corresponding to the target executable script whose parameters need modification and a second predetermined number of physical scripts. This includes: loading the target executable script to be modified based on the parameter modification request message; invoking the Mvn plugin to update the parameters of the target executable script in one of the template tables, generating the logic script; modifying the parameters of the loaded target executable script based on the first predetermined number of parameter modification request messages to obtain the second predetermined number of modified target executable scripts; and invoking the Mvn plugin to update the parameters of the second predetermined number of modified target executable scripts in one of the template tables, generating the second predetermined number of physical scripts.
[0037] Specifically, the SQL scripts involved in database sharding and table partitioning in the SDK's resources can be separated into physical scripts and logical scripts. The logical scripts are retained in the SDK, while the physical scripts are automatically generated by each independent service. This ensures that the target executable scripts can meet the needs of all services.
[0038] In one embodiment of this application, after generating the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, the method further includes: generating an independent service medium based on the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts; and sending the independent service medium to the service. Dynamic configuration generation of the SDK allows the same SDK to adapt to different service scenarios, solving the problem of difficult configuration maintenance of multiple SDK versions.
[0039] In one embodiment of this application, after sending the independent service medium to the service, the method further includes: generating a control instruction; and sending the control instruction to the service to control the service to execute the independent service medium.
[0040] In one embodiment of this application, loading the target executable script that needs to be modified according to the above parameter modification request message includes: determining the corresponding target executable script from all executable scripts in the database according to the above parameter modification request message, wherein the target executable script is at least one set of executable scripts from all executable scripts in the database; and executing the target executable script. This allows for rapid locating of the target executable script.
[0041] In one embodiment of this application, based on the aforementioned first predetermined number of parameter modification request information, an MVN plugin is invoked to generate a logical script corresponding to the target executable script whose parameters need to be modified and a second predetermined number of physical scripts. This includes: determining whether the first number of parameters include the same request information; if no identical request information exists, based on the aforementioned first predetermined number of parameter modification request information, an MVN plugin is invoked to generate a logical script corresponding to the target executable script whose parameters need to be modified and a second predetermined number of physical scripts, where the second predetermined number is equal to the first predetermined number; if no identical request information exists, based on the aforementioned first predetermined number of parameter modification request information, an MVN plugin is invoked to generate a logical script corresponding to the target executable script whose parameters need to be modified and a second predetermined number of physical scripts, where the second predetermined number is less than the first predetermined number. The second predetermined number may be less than or equal to the first predetermined number.
[0042] Through the above embodiments, the SDK configuration resources are split into logic scripts. When independent services depend on the SDK, they have better control over the SDK resources. If the SDK resources involve SQL scripts for database sharding and table partitioning, the SDK only retains the logic scripts. When the physical scripts depend on the SDK logic scripts through independent services, they generate physical SQL according to their own table partitioning rules. Furthermore, when an independent service loads the dependent SDK, it also loads the resource configurations that the SDK depends on. When the independent service is upgraded later, the resource configurations that the SDK depends on can be pushed up together. The SDK resources are no longer maintained by the SDK personnel, but are maintained by the personnel of the independent services that depend on the SDK. When an SDK has more and more independent services, each independent service's SDK can use different versions. Independent services are no longer constrained by the SDK configuration, making them more flexible.
[0043] The standalone service loads the dependent SDK and its resource configurations. It adds its own configuration file for table partitioning rules and the dependency of the Maven plugin for multi-level dependent resource configurations in the distributed application. During Maven packaging, the plugin automatically searches for the table partitioning rule configuration file and searches for the logical table partitioning script in the SDK's resources. Based on the standalone service's configured table partitioning rules, the plugin converts the logical table partitioning SQL script into the physical table partitioning SQL script. During upgrade pushes, the standalone service upgrades its own resource configuration and the physical SQL scripts generated in the resources of the dependent SDKs.
[0044] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the script generation method of this application will be described in detail below with reference to specific embodiments.
[0045] This embodiment relates to a specific method for generating scripts, including the following steps:
[0046] Step S1: Receive a first predetermined number of parameter modification request messages sent by a first predetermined number of services. These parameter modification request messages represent parameter information in the target executable script that needs to be modified. The first predetermined number of services corresponds one-to-one with the first predetermined number of parameter modification request messages. The first predetermined number is greater than or equal to 1. The predetermined number of services represents at least a portion of multiple services, and these multiple services share the same group of target executable scripts in the database.
[0047] Step S2: Modify the request message according to the above parameters and load the executable script of the target to be modified.
[0048] Step S3: Call the above-mentioned mvn plugin to update the parameters of the target executable script into the above-mentioned template table, and generate the above-mentioned logic script;
[0049] Step S4: Based on the first predetermined number of parameter modification request information, modify the parameters of the corresponding target executable script to obtain the second predetermined number of modified target executable scripts.
[0050] Step S5: Call the above-mentioned mvn plugin to update the parameters of the above-mentioned second predetermined number of modified target executable scripts to a template table, and generate the above-mentioned second predetermined number of physical scripts. The above-mentioned logical script is the above-mentioned target executable script before parameter modification, and the above-mentioned physical script is the above-mentioned target executable script modified according to the above-mentioned parameter modification request information. The above-mentioned second predetermined number is less than or equal to the above-mentioned first predetermined number, and the above-mentioned second predetermined number is greater than or equal to 1.
[0051] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0052] This application also provides an SDK. It should be noted that the SDK of this application can be used to execute the script generation method provided in this application. This SDK is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the SDK described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0053] The SDK provided in the embodiments of this application will be described below.
[0054] Figure 3 This is a schematic diagram of an SDK provided according to an embodiment of this application. For example... Figure 3 As shown, the SDK includes an acquisition unit 31 and a generation unit 32. The acquisition unit 31 is used to receive a first predetermined number of parameter modification request messages sent by a first predetermined number of services. The parameter modification request messages are used to characterize the parameter information that needs to be modified in the target executable script. The first predetermined number of services corresponds one-to-one with the first predetermined number of parameter modification request messages. The first predetermined number is greater than or equal to 1. The predetermined number of services is at least a part of multiple services. Multiple services share the same group of target executable scripts in the database. The generation unit 32 is used to call the mvn plugin according to the first predetermined number of parameter modification request messages to generate a logical script and a second predetermined number of physical scripts corresponding to the target executable scripts that need to modify parameters. The logical script is the target executable script before parameter modification, and the physical script is the target executable script after modification according to the parameter modification request messages. The second predetermined number is less than or equal to the first predetermined number and the second predetermined number is greater than or equal to 1.
[0055] In the aforementioned SDK, by modifying the request information based on the first predetermined number of parameters, the MVN plugin is invoked to generate the logical scripts corresponding to the target executable scripts that need to modify parameters, and a second predetermined number of physical scripts. This allows the SDK's resources to separate the SQL scripts involved in database sharding and table partitioning into physical and logical scripts. The SDK retains the logical scripts, while the physical scripts are automatically generated by each independent service. When an independent service is upgraded, the resource configurations that the SDK depends on can be pushed up together, greatly reducing the burden on the SDK and thus solving the problem that the same set of executable scripts cannot meet the needs of all services.
[0056] In one embodiment of this application, the parameter modification request message includes multiple template tables, and the generation unit includes a loading module, a first calling module, a modification module, and a second calling module. The loading module is used to load the target executable script that needs to be modified according to the parameter modification request message. The first calling module is used to call the MVN plugin to update the parameters of the target executable script to one of the template tables and generate the logic script. The modification module is used to modify the parameters of the corresponding loaded target executable script according to the first predetermined number of parameter modification request messages to obtain the second predetermined number of modified target executable scripts. The second calling module is used to call the MVN plugin to update the parameters of the second predetermined number of modified target executable scripts to one of the template tables and generate the second predetermined number of physical scripts.
[0057] In one embodiment of this application, the SDK further includes a first processing unit and a second processing unit. After generating the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, the first processing unit is used to generate an independent service medium by generating the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts; the second processing unit is used to send the independent service medium to the service.
[0058] In one embodiment of this application, the SDK further includes a third processing unit and a fourth processing unit. After the independent service medium is sent to the service, the third processing unit generates control instructions; the fourth processing unit sends the control instructions to the service to control the service to execute the independent service medium.
[0059] In one embodiment of this application, the loading module includes a first processing submodule and a second processing submodule. The first processing submodule is used to modify the request message according to the above parameters and determine the corresponding target executable script from all executable scripts in the above database. The target executable script is at least one set of executable scripts from all executable scripts in the above database. The second processing submodule is used to execute the target executable script.
[0060] In one embodiment of this application, the generation unit includes a determining module, a third calling module, and a fourth calling module. The determining module is used to determine whether a first number of parameters include the same request information. The third calling module is used to modify the request information according to the first predetermined number of parameters if no identical request information exists, call the MVN plugin, and generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, where the second predetermined number is equal to the first predetermined number. The fourth calling module is used to modify the request information according to the first predetermined number of parameters if no identical request information exists, call the MVN plugin, and generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, where the second predetermined number is less than the first predetermined number.
[0061] The aforementioned SDK includes a processor and memory. The acquisition unit and generation unit, among others, are stored as program units in the memory. The processor executes these program units stored in memory to implement the corresponding functions. All of the aforementioned modules reside in the same processor; alternatively, the modules may be located in different processors in any combination.
[0062] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured; by adjusting kernel parameters, the problem of a single set of executable scripts not being able to meet the needs of all services can be solved.
[0063] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0064] This invention provides a computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to execute the script generation method.
[0065] Specifically, the methods for generating scripts include:
[0066] Step S201: Receive the first predetermined number of parameter modification request information sent by the first predetermined number of services. The parameter modification request information is used to characterize the parameter information that needs to be modified in the target executable script. The first predetermined number of services corresponds one-to-one with the first predetermined number of parameter modification request information. The first predetermined number is greater than or equal to 1. The predetermined number of services is at least a part of multiple services. Multiple services share the same group of target executable scripts in the database.
[0067] Step S202: Based on the first predetermined number of parameter modification request information, call the MVN plugin to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts. The logical script is the target executable script before parameter modification, and the physical script is the target executable script after modification based on the parameter modification request information. The second predetermined number is less than or equal to the first predetermined number and the second predetermined number is greater than or equal to 1.
[0068] In one embodiment of this application, the parameter modification request message includes multiple template tables. Based on the first predetermined number of parameter modification request messages, an Mvn plugin is invoked to generate a logic script corresponding to the target executable script whose parameters need modification and a second predetermined number of physical scripts. This includes: loading the target executable script to be modified based on the parameter modification request message; invoking the Mvn plugin to update the parameters of the target executable script in one of the template tables, generating the logic script; modifying the parameters of the loaded target executable script based on the first predetermined number of parameter modification request messages to obtain the second predetermined number of modified target executable scripts; and invoking the Mvn plugin to update the parameters of the second predetermined number of modified target executable scripts in one of the template tables, generating the second predetermined number of physical scripts.
[0069] In one embodiment of this application, after generating the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, the method further includes: generating an independent service medium based on the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts; and sending the independent service medium to the service.
[0070] In one embodiment of this application, after sending the independent service medium to the service, the method further includes: generating a control instruction; and sending the control instruction to the service to control the service to execute the independent service medium.
[0071] In one embodiment of this application, loading the target executable script that needs to be modified according to the above parameter modification request message includes: determining the corresponding target executable script from all executable scripts in the above database according to the above parameter modification request message, wherein the target executable script is at least one set of executable scripts from all executable scripts in the above database; and executing the target executable script.
[0072] In one embodiment of this application, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, including: determining whether the first number of parameters include the same request information; if no identical request information exists, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is equal to the first predetermined number; if no identical request information exists, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is less than the first predetermined number.
[0073] This invention provides a processor for running a program, wherein the program executes the script generation method during runtime.
[0074] Specifically, the methods for generating scripts include:
[0075] Step S201: Receive the first predetermined number of parameter modification request information sent by the first predetermined number of services. The parameter modification request information is used to characterize the parameter information that needs to be modified in the target executable script. The first predetermined number of services corresponds one-to-one with the first predetermined number of parameter modification request information. The first predetermined number is greater than or equal to 1. The predetermined number of services is at least a part of multiple services. Multiple services share the same group of target executable scripts in the database.
[0076] Step S202: Based on the first predetermined number of parameter modification request information, call the MVN plugin to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts. The logical script is the target executable script before parameter modification, and the physical script is the target executable script after modification based on the parameter modification request information. The second predetermined number is less than or equal to the first predetermined number and the second predetermined number is greater than or equal to 1.
[0077] In one embodiment of this application, the parameter modification request message includes multiple template tables. Based on the first predetermined number of parameter modification request messages, an Mvn plugin is invoked to generate a logic script corresponding to the target executable script whose parameters need modification and a second predetermined number of physical scripts. This includes: loading the target executable script to be modified based on the parameter modification request message; invoking the Mvn plugin to update the parameters of the target executable script in one of the template tables, generating the logic script; modifying the parameters of the loaded target executable script based on the first predetermined number of parameter modification request messages to obtain the second predetermined number of modified target executable scripts; and invoking the Mvn plugin to update the parameters of the second predetermined number of modified target executable scripts in one of the template tables, generating the second predetermined number of physical scripts.
[0078] In one embodiment of this application, after generating the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, the method further includes: generating an independent service medium based on the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts; and sending the independent service medium to the service.
[0079] In one embodiment of this application, after sending the independent service medium to the service, the method further includes: generating a control instruction; and sending the control instruction to the service to control the service to execute the independent service medium.
[0080] In one embodiment of this application, loading the target executable script that needs to be modified according to the above parameter modification request message includes: determining the corresponding target executable script from all executable scripts in the above database according to the above parameter modification request message, wherein the target executable script is at least one set of executable scripts from all executable scripts in the above database; and executing the target executable script.
[0081] In one embodiment of this application, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, including: determining whether the first number of parameters include the same request information; if no identical request information exists, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is equal to the first predetermined number; if no identical request information exists, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is less than the first predetermined number.
[0082] This invention provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs at least the following steps: receiving a first predetermined number of parameter modification request messages sent by a first predetermined number of services. These parameter modification request messages represent parameter information in a target executable script that needs to be modified. The first predetermined number of services corresponds one-to-one with the first predetermined number of parameter modification request messages. The first predetermined number is greater than or equal to 1, and the predetermined number of services is at least a portion of multiple services, which share the same group of target executable scripts in a database. Based on the first predetermined number of parameter modification request messages, an Mvn plugin is invoked to generate a logical script corresponding to the target executable script whose parameters need modification and a second predetermined number of physical scripts. The logical script is the target executable script before parameter modification, and the physical script is the target executable script after modification based on the parameter modification request messages. The second predetermined number is less than or equal to the first predetermined number and is greater than or equal to 1. The device described herein can be a server, PC, PAD, mobile phone, etc.
[0083] In one embodiment of this application, the parameter modification request message includes multiple template tables. Based on the first predetermined number of parameter modification request messages, an Mvn plugin is invoked to generate a logic script corresponding to the target executable script whose parameters need modification and a second predetermined number of physical scripts. This includes: loading the target executable script to be modified based on the parameter modification request message; invoking the Mvn plugin to update the parameters of the target executable script in one of the template tables, generating the logic script; modifying the parameters of the loaded target executable script based on the first predetermined number of parameter modification request messages to obtain the second predetermined number of modified target executable scripts; and invoking the Mvn plugin to update the parameters of the second predetermined number of modified target executable scripts in one of the template tables, generating the second predetermined number of physical scripts.
[0084] In one embodiment of this application, after generating the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, the method further includes: generating an independent service medium based on the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts; and sending the independent service medium to the service.
[0085] In one embodiment of this application, after sending the independent service medium to the service, the method further includes: generating a control instruction; and sending the control instruction to the service to control the service to execute the independent service medium.
[0086] In one embodiment of this application, loading the target executable script that needs to be modified according to the above parameter modification request message includes: determining the corresponding target executable script from all executable scripts in the above database according to the above parameter modification request message, wherein the target executable script is at least one set of executable scripts from all executable scripts in the above database; and executing the target executable script.
[0087] In one embodiment of this application, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, including: determining whether the first number of parameters include the same request information; if no identical request information exists, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is equal to the first predetermined number; if no identical request information exists, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is less than the first predetermined number.
[0088] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps: receiving a first predetermined number of parameter modification request messages sent by a first predetermined number of services, wherein the parameter modification request messages are used to characterize parameter information that needs to be modified in a target executable script, wherein the first predetermined number of services corresponds one-to-one with the first predetermined number of parameter modification request messages, wherein the first predetermined number is greater than or equal to 1, wherein the predetermined number of services is at least a portion of a plurality of services, and the plurality of services share the same group of target executable scripts in a database; and, based on the first predetermined number of parameter modification request messages, calling an MVN plugin to generate a logical script and a second predetermined number of physical scripts corresponding to the target executable script whose parameters need to be modified, wherein the logical script is the target executable script before parameter modification, and the physical script is the target executable script after modification based on the parameter modification request messages, wherein the second predetermined number is less than or equal to the first predetermined number, and the second predetermined number is greater than or equal to 1.
[0089] In one embodiment of this application, the parameter modification request message includes multiple template tables. Based on the first predetermined number of parameter modification request messages, an Mvn plugin is invoked to generate a logic script corresponding to the target executable script whose parameters need modification and a second predetermined number of physical scripts. This includes: loading the target executable script to be modified based on the parameter modification request message; invoking the Mvn plugin to update the parameters of the target executable script in one of the template tables, generating the logic script; modifying the parameters of the loaded target executable script based on the first predetermined number of parameter modification request messages to obtain the second predetermined number of modified target executable scripts; and invoking the Mvn plugin to update the parameters of the second predetermined number of modified target executable scripts in one of the template tables, generating the second predetermined number of physical scripts.
[0090] In one embodiment of this application, after generating the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, the method further includes: generating an independent service medium based on the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts; and sending the independent service medium to the service.
[0091] In one embodiment of this application, after sending the independent service medium to the service, the method further includes: generating a control instruction; and sending the control instruction to the service to control the service to execute the independent service medium.
[0092] In one embodiment of this application, loading the target executable script that needs to be modified according to the above parameter modification request message includes: determining the corresponding target executable script from all executable scripts in the above database according to the above parameter modification request message, wherein the target executable script is at least one set of executable scripts from all executable scripts in the above database; and executing the target executable script.
[0093] In one embodiment of this application, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, including: determining whether the first number of parameters include the same request information; if no identical request information exists, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is equal to the first predetermined number; if no identical request information exists, based on the first predetermined number of parameter modification request information, the MVN plugin is invoked to generate the logical script corresponding to the target executable script whose parameters need to be modified and the second predetermined number of physical scripts, wherein the second predetermined number is less than the first predetermined number.
[0094] This application also provides an electronic device including one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a method for generating any of the above-described scripts.
[0095] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0096] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0097] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0098] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0099] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0100] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0101] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0102] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0103] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0104] As can be seen from the above description, the embodiments of this application achieve the following technical effects:
[0105] 1) The script generation method of this application, by modifying the request information of the above-mentioned parameters according to the first predetermined number, calls the mvn plugin to generate the logical script corresponding to the above-mentioned target executable script that needs to be modified and the second predetermined number of physical scripts. It can separate the SQL scripts involving database sharding and table partitioning of the SDK resources into physical scripts and logical scripts. The logical scripts are retained in the SDK, and the physical scripts are automatically generated by each independent service. When the independent service is upgraded in the future, the resource configurations that the SDK depends on can be pushed up together, which greatly reduces the burden of the SDK and solves the problem that the same set of executable scripts cannot meet the needs of all services.
[0106] 2) The script generation method in this application splits the SDK configuration resources into logic scripts. When an independent service depends on the SDK, it has better control over the SDK resources. If the SDK resources involve SQL scripts for database sharding and table partitioning, the SDK only retains the logic scripts. When the physical scripts depend on your SDK logic scripts through an independent service, the physical SQL is generated according to its own table partitioning rules. Furthermore, when an independent service loads the dependent SDK, it also loads the resource configurations that the SDK depends on into the independent service. When the independent service is upgraded later, the resource configurations that the SDK depends on can be pushed up together. The SDK resources are no longer maintained by the SDK personnel, but are maintained by the personnel of the independent services that depend on the SDK. When an SDK has more and more independent services, each independent service's SDK can use different versions. Independent services are no longer constrained by the SDK configuration, making them more flexible.
[0107] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method of generating a script, characterized by, The method comprises: receiving a first predetermined number of parameter modification request information sent by a first predetermined number of services, the parameter modification request information being used to represent parameter information that needs to be modified in a target executable script, the first predetermined number of services corresponding to the first predetermined number of parameter modification request information one by one, the first predetermined number being greater than or equal to 1, the first predetermined number of services being at least part of a plurality of services, and a plurality of services sharing the same group of target executable scripts in a database; according to the first predetermined number of parameter modification request information, calling an mvn plug-in to generate a logic script corresponding to the target executable script that needs to modify parameters and a second predetermined number of physical scripts, the logic script being the target executable script before parameter modification, and the physical script being the target executable script after modification according to the parameter modification request information, the second predetermined number being less than or equal to the first predetermined number, and the second predetermined number being greater than or equal to 1.
2. The method of claim 1, wherein, The parameter modification request information comprises a plurality of template tables, and according to the first predetermined number of parameter modification request information, the mvn plug-in is called to generate a logic script corresponding to the target executable script that needs to modify parameters and a second predetermined number of physical scripts, comprising: loading the target executable script that needs to be modified according to the parameter modification request information; calling the mvn plug-in to update the parameters of the target executable script to a template table to generate the logic script; modifying the loaded parameters of the corresponding target executable script according to the first predetermined number of parameter modification request information to obtain the second predetermined number of modified target executable scripts; calling the mvn plug-in to update the parameters of the second predetermined number of modified target executable scripts to a template table to generate the second predetermined number of physical scripts.
3. The method of claim 1, wherein, After generating the logic script corresponding to the target executable script that needs to modify parameters and the second predetermined number of physical scripts, the method further comprises: generating an independent service medium according to the logic script corresponding to the target executable script that needs to modify parameters and the second predetermined number of physical scripts; sending the independent service medium to the service.
4. The method of claim 3, wherein, After sending the independent service medium to the service, the method further comprises: generating a control instruction; sending the control instruction to the service to control the service to execute the independent service medium.
5. The method of claim 2, wherein, According to the parameter modification request information, loading the target executable script that needs to be modified comprises: determining the corresponding target executable script from all executable scripts in the database according to the parameter modification request information, the target executable script being at least one group of executable scripts in all executable scripts in the database; executing the target executable script.
6. The method according to any one of claims 1 to 5, characterized in that, According to the first predetermined number of parameter modification request information, the mvn plug-in is called to generate the logic script corresponding to the target executable script which needs to modify parameters and the second predetermined number of physical scripts, including: Determine whether the first number of parameters includes the same request information; In the absence of the same request information, according to the first predetermined number of parameter modification request information, the mvn plug-in is called to generate the logic script corresponding to the target executable script which needs to modify parameters and the second predetermined number of the physical script, the second predetermined number is equal to the first predetermined number; In the absence of the same request information, according to the first predetermined number of parameter modification request information, the mvn plug-in is called to generate the logic script corresponding to the target executable script which needs to modify parameters and the second predetermined number of the physical script, the second predetermined number is less than the first predetermined number.
7. An SDK, characterized in that, Including: The acquisition unit is used for receiving the first predetermined number of parameter modification request information sent by the first predetermined number of services, the parameter modification request information is used to represent the parameter information which needs to be modified in the target executable script, the first predetermined number of services corresponds to the first predetermined number of parameter modification request information one by one, the first predetermined number is greater than or equal to 1, the first predetermined number of services is at least part of the plurality of services, and the plurality of services share the same group of target executable scripts in the database; The generation unit is used for calling the mvn plug-in according to the first predetermined number of parameter modification request information to generate the logic script corresponding to the target executable script which needs to modify parameters and the second predetermined number of physical scripts, the logic script is the target executable script before parameter modification, the physical script is the target executable script after modification according to the parameter modification request information, the second predetermined number is less than or equal to the first predetermined number, and the second predetermined number is greater than or equal to 1.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium includes a stored program, wherein the program controls the device where the computer readable storage medium executes the script generation method of any one of claims 1-6 when the program runs.
9. A processor, comprising: The processor is used for running the program, wherein the program executes the script generation method of any one of claims 1-6 when the program runs.
10. An electronic device, comprising: Including: One or more processors, memories, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a script generation method for executing any one of claims 1-6.
Citation Information
Patent Citations
Script generation method, device and apparatus and storage medium
CN112380239A
Automatic test method and device, and computer-readable storage medium
WO2018120965A1