CN115495442B - Database operation file generation method, device, equipment and storage medium - Google Patents

Database operation file generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN115495442B
CN115495442B CN202211430791.2A CN202211430791A CN115495442B CN 115495442 B CN115495442 B CN 115495442B CN 202211430791 A CN202211430791 A CN 202211430791A CN 115495442 B CN115495442 B CN 115495442B
Authority
CN
China
Prior art keywords
database
name
database table
operation file
field
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.)
Active
Application number
CN202211430791.2A
Other languages
Chinese (zh)
Other versions
CN115495442A (en
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.)
Shenzhen Mingyuanyun Procurement Technology Co ltd
Original Assignee
Shenzhen Mingyuanyun Procurement 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 Shenzhen Mingyuanyun Procurement Technology Co ltd filed Critical Shenzhen Mingyuanyun Procurement Technology Co ltd
Priority to CN202211430791.2A priority Critical patent/CN115495442B/en
Publication of CN115495442A publication Critical patent/CN115495442A/en
Application granted granted Critical
Publication of CN115495442B publication Critical patent/CN115495442B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/21Design, administration or maintenance of databases
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • 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/23Updating
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a database operation file generation method, a device, equipment and a storage medium, and belongs to the technical field of code conversion. The method comprises the steps of: determining database table information of a database table corresponding to the current micro-service item; generating a database table structure body according to the database table information; and generating a database operation file according to the database table structure body and a preset database operation code template, wherein the database operation file is used for managing the database table. The invention greatly improves the generation efficiency of the database operation files, avoids various errors caused by manually writing codes, unifies the code writing style specifications, and greatly reduces the maintenance cost of each database operation file in the later period.

Description

Database operation file generation method, device, equipment and storage medium
Technical Field
The present invention relates to the field of transcoding technologies, and in particular, to a method, an apparatus, a device, and a computer readable storage medium for generating a database operation file.
Background
The micro-service is to divide the whole application program to be completely developed into individual servlets for relatively independent development, and the development of each micro-service can be completed through the GO programming language. In the GO program development process, if various operations on the database are to be realized, a structural body model corresponding to the database table structure needs to be written first, and then method codes for operations such as adding, deleting, searching, modifying and the like on the database table are written, so that a database operation file capable of realizing various operations on the database is finally obtained.
In the current data operation file generation mode, the generation is completed by manual writing, which causes the following problems: in the stage of manually writing the structural body model, when the database table has more fields, the structural body model needs to be written in a one-to-one correspondence mode, and the method has the advantages of large workload, low efficiency, high repeatability and easiness in error; the above problems also exist in the stage of manually writing the code of the operation method of adding, deleting, checking and changing the database. That is, the manual writing is not only inefficient but also prone to error during the entire database operation file generation process.
Disclosure of Invention
The invention mainly aims to provide a database operation file generation method, device and equipment and a computer readable storage medium, and aims to solve the technical problems that a mode of manually writing a database operation file is low in efficiency and easy to make mistakes.
In order to achieve the above object, the present invention provides a database operation file generation method, including the steps of:
determining database table information of a database table corresponding to the current micro-service item;
generating a database table structure body according to the database table information;
and generating a database operation file according to the database table structure body and a preset database operation code template, wherein the database operation file is used for managing the database table.
Optionally, the step of determining database table information of the database table corresponding to the current micro service item includes:
acquiring command parameters of the current microservice item;
determining a database identifier and a data table identifier corresponding to the command parameters;
and determining database table information of the database table corresponding to the current micro service item according to the database identifier and the data table identifier.
Optionally, the step of determining database table information of the database table corresponding to the current micro service item includes:
determining a field list of a database table corresponding to the current micro-service item;
sequentially acquiring field names, field types and field descriptions of the database table according to the arrangement sequence of the field list;
and specifying the field name, the field type and the field as database table information of the database table.
Optionally, the step of generating a database table structure body according to the database table information includes:
determining all table structure placeholders in a preset database table structure code template;
determining target table structure placeholders corresponding to the field names, the field types and the field descriptions in the all table structure placeholders;
and replacing the field names, the field types and the field descriptions with the corresponding target table structure placeholders respectively to generate a database table structure body.
Optionally, the step of generating a database operation file according to the database table structure body and a preset database operation code template includes:
acquiring code warehouse information corresponding to a current micro-service item;
and generating a database operation file according to the database table structure body, a preset database operation code template and the code warehouse information.
Optionally, the code repository information includes: code repository domain name, code repository packet name, and application name;
the step of generating a database operation file according to the database table structure, a preset database operation code template and the code warehouse information comprises the following steps:
determining a first structure name and a second structure name corresponding to the database table structure, wherein the first letter of the first structure name is uppercase, and the first letter of the second structure name is lowercase;
determining target operation placeholders corresponding to the code warehouse domain name, the code warehouse packet name, the application name, the first structure body name and the second structure body name in a preset database operation code template;
and respectively replacing the code warehouse domain name, the code warehouse packet name, the application name, the first structure body name and the second structure body name by the corresponding target operation placeholders to generate a database operation file.
Optionally, after the step of generating the database operation file according to the database table structure and the preset database operation code template, the method further includes:
based on a preset directory specification, storing the database operation file into a corresponding target directory;
and when at least one operation instruction including adding, deleting, modifying and inquiring is received, executing the database operation file in the target directory to return an operation result corresponding to the operation instruction.
In addition, to achieve the above object, the present invention also provides a database operation file generation apparatus, including:
the parameter extraction module is used for determining database table information of a database table corresponding to the current micro-service item;
the parameter replacement module is used for generating a database table structure body according to the database table information; and generating a database operation file according to the database table structure body and a preset database operation code template, wherein the database operation file is used for managing a database table.
In addition, in order to achieve the above object, the present invention also provides a database operation file generation device, including a processor, a memory, and a database operation file generation program stored on the memory and executable by the processor, wherein the database operation file generation program, when executed by the processor, implements the steps of the database operation file generation method as described above.
The present invention also provides a computer-readable storage medium having stored thereon a database operation file generation program, wherein the database operation file generation program, when executed by a processor, implements the steps of the database operation file generation method as described above.
The database operation file generation method in the technical scheme of the invention comprises the following steps: determining database table information of a database table corresponding to the current micro-service item; generating a database table structure body according to the database table information; and generating a database operation file according to the database table structure body and a preset database operation code template, wherein the database operation file is used for managing the database table. The invention solves the technical problems that the manual writing of database operation files is low in efficiency and easy to make mistakes.
The method and the system mainly draw the corresponding database table structure code templates by automatically extracting some key database table information in the database table, respectively replace each database table information to the corresponding positions in the database table structure code templates, automatically generate the database table structure, then automatically replace the database table structure into the preset database operation code templates according to the related information in the database table structure, thereby obtaining the database operation file, and a developer can quickly operate the database table by adding, deleting, changing, checking and the like according to the database operation file.
Drawings
FIG. 1 is a schematic diagram of a hardware operating environment of a database operation file generating device according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a database operation file generation method according to a first embodiment of the present invention;
FIG. 3 is a detailed flowchart of step S10 of the database operation file generating method according to the present invention;
FIG. 4 is another detailed flowchart of step S10 of the first embodiment of the database operation file generation method of the present invention;
FIG. 5 is a detailed flowchart of step S20 of the database operation file generation method according to the present invention;
FIG. 6 is a flowchart illustrating a database operation file generating method according to the first embodiment of the present invention after step S30;
fig. 7 is a schematic diagram of a frame structure of the database operation file generating apparatus according to the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the invention provides database operation file generating equipment.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a hardware running environment of a database operation file generating device according to an embodiment of the present invention.
As shown in fig. 1, the database operation file generation apparatus may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display (Display), an input unit such as a control panel, and the optional user interface 1003 may also include a standard wired interface, a wireless interface. Network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., a WIFI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above. A database operation file generation program may be included in the memory 1005 as a computer storage medium.
Those skilled in the art will appreciate that the hardware configuration shown in fig. 1 does not constitute a limitation of the apparatus, and may include more or fewer components than shown, or may combine certain components, or may be arranged in different components.
With continued reference to fig. 1, the memory 1005 in fig. 1, which is a computer-readable storage medium, may include an operating system, a user interface module, a network communication module, and a database operation file generation program.
In fig. 1, the network communication module is mainly used for connecting with a server and performing data communication with the server; and the processor 1001 may call a database operation file generation program stored in the memory 1005 and perform the steps in the following respective embodiments.
Based on the hardware structure of the controller, various embodiments of the database operation file generation method are provided.
The embodiment of the invention provides a database operation file generation method.
Referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of a database operation file generating method according to the present invention; in a first embodiment of the present invention, the database operation file generation method is applied to a database operation file generation device; the method comprises the following steps:
step S10, determining database table information of a database table corresponding to the current micro-service item;
in this embodiment, the method may be implemented by a database operation file generating device, where the database operation file generating device may be a personal computer, a server, a workstation, or other intelligent terminals that may be programmed.
The current micro-service items may be micro-service items under an MVC (Model-view-controller) based framework, and the current micro-service items may be compiled based on the GO language.
Different micro-service items may correspond to different database tables (a data table in a database may be a mysql data table), where the database tables include various field information, for example, the database tables may include information such as each field name, a field type corresponding to the field name, and a field description corresponding to the field name.
Referring to fig. 3, in an embodiment, the step S10 includes:
step S11, obtaining command parameters of the current micro service item;
step S12, determining a database identifier and a data table identifier corresponding to the command parameters;
and step S13, determining database table information of a database table corresponding to the current micro-service item according to the database identifier and the data table identifier.
In this embodiment, the command parameters of the current micro-service item may be written by a developer according to different micro-service items, or corresponding command parameters may be automatically generated according to the micro-service items and the automation tool, where the command parameters are used to query and determine the specific location of the database table in the database. For example, the command parameter is a lay-tools model-dbb2b_contact-table provider_role, the corresponding dbb2b_contact represents a database identifier (database name), and the table provider_role represents a data table identifier. After the database identification is determined from the command parameters, the target database required by the current micro-service project can be positioned, and then the target data table in the target database is positioned according to the determined data table identification, so that the corresponding data table is not required to be searched from each database manually, the related items of data table processing are quickened, and the development progress of the micro-service project is quickened. After determining the database table corresponding to the current micro-service item, the related database table information can be extracted from the target data table.
Referring to fig. 4, in an embodiment, the step S10 includes:
step S100, determining a field list of a database table corresponding to a current micro-service item;
step S110, sequentially acquiring field names, field types and field descriptions of the database table according to the arrangement sequence of the field list;
and step S120, the field name, the field type and the field description are used as database table information of the database table.
In this embodiment, after the database table corresponding to the current micro service item is found and determined, the relevant database table information may be obtained from the database table. A field list of the database table, that is, a list including various fields in the database table, which characterizes each field name (field identifier) having a certain arrangement order relationship, and a field type and a field description to which each field name corresponds, respectively, may be determined first. For the field name, for example, it may be: id. name, sex, state, card, in turn, may be int, char, int, int, int for the corresponding field type. The field names, the field types and the field descriptions of the database table can be sequentially acquired according to the arrangement sequence of the field list, namely, each database table information in the database table can be acquired in a line-by-line mode, so that each database table information can be acquired orderly and comprehensively without omission.
Step S20, generating a database table structure body according to the database table information;
since most of different database table structures have the same code structure, the difference is often that the database table information in the different database table structures is different due to the difference of databases and data tables used by different micro service projects, so a set of database table structure code templates can be written as preset according to the code specification according to the establishment of a set of code specifications.
And calling a preset database table structure code template, and respectively filling and replacing each database table information to the corresponding parameter position of the database table structure code template, so that a database table structure body is automatically generated, database table structure body writing is not needed by manually corresponding to the database table information and codes one by one, the workload is greatly reduced, and compared with the manual writing, the method has the advantages of high efficiency, low code repeatability, convenience in reading and difficulty in writing errors.
Referring to fig. 5, in an embodiment, the step S20 includes:
s21, determining all table structure placeholders in a preset database table structure code template;
step S22, determining target table structure placeholders corresponding to the field names, the field types and the field descriptions in the all table structure placeholders;
and S23, replacing the field names, the field types and the field descriptions with the corresponding target table structure placeholders respectively to generate a database table structure body.
In this embodiment, all table structure placeholders in the database table structure code template may be referenced in table 1 below:
TABLE 1
The table structure placeholders have their specific expression form, which itself cannot be run in the table structure code template, and need to be replaced with corresponding database table information to obtain a complete executable database table structure.
As can be seen from table 1, all table structure placeholders in the database table structure code template include: { { PackageName }, { { TableNamel }, { range. Cols }, { Comment }, { { Name }, and { {.Type }. The target table structure placeholder corresponding to the field Name is { {.Name }, the target table structure placeholder corresponding to the field Type is { {.Type }, and the field indicates that the corresponding target table structure placeholder is { { Comment }. In addition, the table structure placeholder further comprises { {. PackageName }, the package name of the whole micro service item can be defined as mysql according to code specifications, the table structure placeholder further comprises { {. TableNamel }, the database table information further comprises the table name of the initial capital of the data table (the original table name is converted into the capital if the original table name is lower case, and the table name is convenient to read and recognize), and the table name is replaced by the {. TableNamel }. The table structure placeholder further includes { { range. Colls }, the database table information may further include a field list, the field list is substituted for the { range. Colls }, and each field in the database table may be circularly fetched according to the order of the field list.
And replacing each item of database table information comprising the field name, the field type and the field description with the corresponding target table structure placeholders in the database table structure code template, so that the database table structure corresponding to the current micro-service item is generated by combining the target table structure placeholders with other fixed codes of the database table structure. According to the embodiment, the manual re-writing of the database table structure body is replaced, so that the generation efficiency of the database table structure body is improved, the code style specification in the database table structure body is unified, the subsequent maintenance of the database table structure body is facilitated, and the maintenance cost is reduced.
And step S30, generating a database operation file according to the database table structure body and a preset database operation code template, wherein the database operation file is used for managing the database table.
Corresponding information is also required to be obtained from the database table structure body, and the information is replaced by the placeholders corresponding to the preset database operation code templates, so that a database operation file is automatically generated, and based on the database operation file, a user can realize operations such as adding, deleting, changing, inquiring and the like of the database table in a visual mode.
In one embodiment, the step S30 includes:
step a, code warehouse information corresponding to a current micro-service item is obtained;
and b, generating a database operation file according to the database table structure body, a preset database operation code template and the code warehouse information.
The code repository corresponding to the current micro service item refers to a data location between developers and other related personnel for providing source codes according to the micro service item, and the corresponding code repository information may include: the method comprises the steps of replacing placeholders corresponding to database operation code templates respectively by code warehouse domain names, code warehouse group names and application names (names of application programs corresponding to micro-service items), and replacing corresponding placeholders of the database operation code templates by the related information of a database table structure (the related information is used for calling the corresponding database table structure in a database operation file so as to realize management of data in the database table) and the code warehouse information respectively, so that a complete executable database operation file is generated.
In an embodiment, the code repository information includes: code repository domain name, code repository packet name, and application name; the step b comprises the following steps:
step c, determining a first structure name and a second structure name corresponding to the database table structure, wherein the first letter of the first structure name is uppercase, and the first letter of the second structure name is lowercase;
in this embodiment, the structure name of the database table structure (related information corresponding to the database table structure) needs to be obtained from the database table structure, and the structure name is used to distinguish from other database table structures, so that the corresponding database table structure can be accurately called in the database operation file, and various management on the structure in the database table (data table) corresponding to the current micro service item is realized. The structure names can be divided into two categories: the first structure name and the second structure name, wherein the first letter of the first structure name is uppercase, the first letter of the second structure name is lowercase, and the first structure name of the uppercase can be replaced to the database operation code template to serve as the identification of the reading code, so that the examination and the reference of a developer are facilitated, and the method is not executed in practice. For the first lower case second structure name, the function of replacing the database operation code template is to call the corresponding database table structure, so that execution is realized, and management of data of the database table is realized.
Step d, determining target operation placeholders corresponding to the code warehouse domain name, the code warehouse packet name, the application name, the first structure body name and the second structure body name in a preset database operation code template;
for the target operation placeholders corresponding to the code repository domain name, the code repository packet name, the application name, the first fabric name, and the second fabric name, respectively, reference may be made to table 2 below:
TABLE 2
As shown in table 2, the target operation placeholder corresponding to the code repository domain name is { {.gitaddr }, the target operation placeholder corresponding to the code repository packet name is { {.groupname }, the target operation placeholder corresponding to the application name is { {.appname }, the target operation placeholder corresponding to the first structure name is { {.modelname }, the target operation placeholder corresponding to the second structure name is {.lmodelname }, and the target operation placeholder corresponding to the database table structure package name (default mysql) is {.modelpackage }, and the target operation placeholder corresponding to the table name of the data table is {.reponame }, but the table name is converted into a uppercase, i.e., the uppercase is used as an identifier of the uppercase. The database table operation package name (default image) corresponds to the target operation placeholder {.repopackage }.
And e, respectively replacing the code warehouse domain name, the code warehouse packet name, the application name, the first structure body name and the second structure body name by the corresponding target operation placeholders to generate a database operation file.
And replacing the corresponding target operation placeholders with the parameter information comprising the code warehouse domain name, the code warehouse packet name, the application name, the first structure name, the second structure name and the like, and combining the inherent codes in the database operation code template to automatically generate a complete executable database operation file corresponding to the current micro-service project, so that the method for manually writing the database to add, delete, search and change is not needed, the development efficiency is greatly improved, and the development cost is greatly reduced.
Referring to fig. 6, in an embodiment, after the step S30, the method further includes:
step S40, based on a preset directory specification, storing the database operation file into a corresponding target directory;
and step S50, when at least one operation instruction including addition, deletion, modification and query is received, executing the database operation file in the target directory to return an operation result corresponding to the operation instruction.
In this embodiment, the preset directory specification may be set according to actual needs, so as to orderly store different database operation files into corresponding target directories, so that when at least one operation instruction including adding, deleting, modifying and querying is performed on related data in the data table, which is input by a user or a developer, the location of the corresponding database operation file may be quickly located according to the directory where the database operation file is located, and further, various operation instructions of the user may be quickly responded to return to an operation result required by the user, thereby realizing convenient and efficient data table management.
The invention mainly extracts some key database table information in the database table automatically, pulls the corresponding database table structure code template, replaces each database table information to the corresponding position in the database table structure code template respectively, automatically generates the database table structure, then automatically replaces the database table structure into the preset database operation code template according to the related information in the database table structure, thereby obtaining the database operation file, and a developer can quickly operate the database table by adding, deleting, changing, checking and the like according to the database operation file.
In addition, the present invention also provides a database operation file generating device, referring to fig. 7, the database operation file generating device includes:
the parameter extraction module A10 is used for determining database table information of a database table corresponding to the current micro-service item;
a parameter replacement module a20, configured to generate a database table structure according to the database table information; and generating a database operation file according to the database table structure body and a preset database operation code template, wherein the database operation file is used for managing a database table.
Optionally, the parameter extraction module a10 is further configured to:
acquiring command parameters of the current microservice item;
determining a database identifier and a data table identifier corresponding to the command parameters;
and determining database table information of the database table corresponding to the current micro service item according to the database identifier and the data table identifier.
Optionally, the parameter extraction module a10 is further configured to:
determining a field list of a database table corresponding to the current micro-service item;
sequentially acquiring field names, field types and field descriptions of the database table according to the arrangement sequence of the field list;
and specifying the field name, the field type and the field as database table information of the database table.
Optionally, the parameter replacement module a20 is further configured to:
determining all table structure placeholders in a preset database table structure code template;
determining target table structure placeholders corresponding to the field names, the field types and the field descriptions in the all table structure placeholders;
and replacing the field names, the field types and the field descriptions with the corresponding target table structure placeholders respectively to generate a database table structure body.
Optionally, the parameter replacement module a20 is further configured to:
acquiring code warehouse information corresponding to a current micro-service item;
and generating a database operation file according to the database table structure body, a preset database operation code template and the code warehouse information.
Optionally, the parameter replacement module a20 is further configured to:
determining a first structure name and a second structure name corresponding to the database table structure, wherein the first letter of the first structure name is uppercase, and the first letter of the second structure name is lowercase;
determining target operation placeholders corresponding to the code warehouse domain name, the code warehouse packet name, the application name, the first structure body name and the second structure body name in a preset database operation code template;
and respectively replacing the code warehouse domain name, the code warehouse packet name, the application name, the first structure body name and the second structure body name by the corresponding target operation placeholders to generate a database operation file.
Optionally, the parameter replacement module a20 is further configured to:
based on a preset directory specification, storing the database operation file into a corresponding target directory;
and when at least one operation instruction including adding, deleting, modifying and inquiring is received, executing the database operation file in the target directory to return an operation result corresponding to the operation instruction.
The specific implementation manner of the database operation file generating device is basically the same as that of each embodiment of the database operation file generating method, and is not repeated here.
Furthermore, the invention also provides a computer readable storage medium. The computer readable storage medium of the present invention stores a database operation file generation program, wherein the database operation file generation program, when executed by a processor, implements the steps of the database operation file generation method described above.
The method implemented when the database operation file generating program is executed may refer to various embodiments of the database operation file generating method of the present invention, which are not described herein.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may 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, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may 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, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the invention, and all equivalent structural changes made by the description of the present invention and the accompanying drawings or direct/indirect application in other related technical fields are included in the scope of the invention.

Claims (6)

1. A database operation file generation method, characterized in that the database operation file generation method comprises the following steps:
determining database table information of a database table corresponding to the current micro-service item;
generating a database table structure body according to the database table information;
generating a database operation file according to the database table structure body and a preset database operation code template, wherein the database operation file is used for managing the database table;
the step of generating a database operation file according to the database table structure body and a preset database operation code template comprises the following steps:
acquiring code warehouse information corresponding to a current micro-service item;
generating a database operation file according to the database table structure body, a preset database operation code template and the code warehouse information;
the code repository information includes: code repository domain name, code repository packet name, and application name;
the step of generating a database operation file according to the database table structure, a preset database operation code template and the code warehouse information comprises the following steps:
determining a first structure name and a second structure name corresponding to the database table structure, wherein the first letter of the first structure name is uppercase, and the first letter of the second structure name is lowercase; wherein the first structure name is used as an identifier of a reading code; the second structure name is used for calling a corresponding database table structure;
determining target operation placeholders corresponding to the code warehouse domain name, the code warehouse packet name, the application name, the first structure body name and the second structure body name in a preset database operation code template;
respectively replacing the code warehouse domain name, the code warehouse packet name, the application name, the first structure name and the second structure name by corresponding target operation placeholders to generate a database operation file;
the step of determining database table information of the database table corresponding to the current micro service item comprises the following steps:
determining a field list of a database table corresponding to the current micro-service item;
sequentially acquiring field names, field types and field descriptions of the database table according to the arrangement sequence of the field list;
database table information in which the field name, the field type, and the field description are used as the database table;
wherein the step of generating a database table structure according to the database table information includes:
determining all table structure placeholders in a preset database table structure code template, wherein the all table structure placeholders comprise: packageName, tableNamel, range. Colls, comment, name, and Type;
determining target table structure placeholders corresponding to the field names, the field types and the field descriptions in the all table structure placeholders;
and replacing the field names, the field types and the field descriptions with the corresponding target table structure placeholders respectively to generate a database table structure body.
2. The database operation file generation method of claim 1, wherein the step of determining database table information of the database table corresponding to the current micro service item comprises:
acquiring command parameters of the current microservice item;
determining a database identifier and a data table identifier corresponding to the command parameters;
and determining database table information of the database table corresponding to the current micro service item according to the database identifier and the data table identifier.
3. The database operation file generation method according to claim 1, wherein after the step of generating a database operation file from the database table structure and a preset database operation code template, the method further comprises:
based on a preset directory specification, storing the database operation file into a corresponding target directory;
and when at least one operation instruction including adding, deleting, modifying and inquiring is received, executing the database operation file in the target directory to return an operation result corresponding to the operation instruction.
4. A database operation file generation apparatus, characterized in that the database operation file generation apparatus comprises:
the parameter extraction module is used for determining database table information of a database table corresponding to the current micro-service item;
the parameter replacement module is used for generating a database table structure body according to the database table information; generating a database operation file according to the database table structure body and a preset database operation code template, wherein the database operation file is used for managing a database table;
the code warehouse information corresponding to the current micro-service item is also acquired;
generating a database operation file according to the database table structure body, a preset database operation code template and the code warehouse information;
the method is also used for determining a first structure name and a second structure name corresponding to the database table structure, wherein the first letter of the first structure name is uppercase, and the first letter of the second structure name is lowercase; wherein the first structure name is used as an identifier of a reading code; the second structure name is used for calling a corresponding database table structure;
determining target operation placeholders corresponding to a code warehouse domain name, a code warehouse packet name, an application name, the first structure body name and the second structure body name in a preset database operation code template;
respectively replacing the code warehouse domain name, the code warehouse packet name, the application name, the first structure name and the second structure name by corresponding target operation placeholders to generate a database operation file;
the step of determining database table information of the database table corresponding to the current micro service item comprises the following steps:
determining a field list of a database table corresponding to the current micro-service item;
sequentially acquiring field names, field types and field descriptions of the database table according to the arrangement sequence of the field list;
database table information in which the field name, the field type, and the field description are used as the database table;
wherein the step of generating a database table structure according to the database table information includes:
determining all table structure placeholders in a preset database table structure code template, wherein the all table structure placeholders comprise: packageName, tableNamel, range. Colls, comment, name, and Type;
determining target table structure placeholders corresponding to the field names, the field types and the field descriptions in the all table structure placeholders;
and replacing the field names, the field types and the field descriptions with the corresponding target table structure placeholders respectively to generate a database table structure body.
5. A database operation file generation apparatus comprising a processor, a memory, and a database operation file generation program stored on the memory that is executable by the processor, wherein the database operation file generation program, when executed by the processor, implements the steps of the database operation file generation method according to any one of claims 1 to 3.
6. A computer-readable storage medium, wherein a database operation file generation program is stored thereon, wherein the database operation file generation program, when executed by a processor, implements the steps of the database operation file generation method according to any one of claims 1 to 3.
CN202211430791.2A 2022-11-16 2022-11-16 Database operation file generation method, device, equipment and storage medium Active CN115495442B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211430791.2A CN115495442B (en) 2022-11-16 2022-11-16 Database operation file generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211430791.2A CN115495442B (en) 2022-11-16 2022-11-16 Database operation file generation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115495442A CN115495442A (en) 2022-12-20
CN115495442B true CN115495442B (en) 2023-08-04

Family

ID=85115819

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211430791.2A Active CN115495442B (en) 2022-11-16 2022-11-16 Database operation file generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115495442B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253975A (en) * 2011-06-16 2011-11-23 上海博康智能网络科技有限公司 Automatic switching system and method for database
CN105354036A (en) * 2015-11-26 2016-02-24 深圳市金证科技股份有限公司 Database operation code generating method and apparatus
CN109710571A (en) * 2018-12-27 2019-05-03 腾讯音乐娱乐科技(深圳)有限公司 A kind of document analysis method, equipment and storage medium
CN112235311A (en) * 2020-10-20 2021-01-15 网络通信与安全紫金山实验室 OVSDB client code automatic generation method, system, device and medium
CN113190218A (en) * 2021-04-28 2021-07-30 中国邮政储蓄银行股份有限公司 Target operation function generation method and device
CN113535141A (en) * 2020-04-16 2021-10-22 浙江大搜车软件技术有限公司 Database operation code generation method and device
CN113609128A (en) * 2021-07-21 2021-11-05 深圳市元征未来汽车技术有限公司 Method and device for generating database entity class, terminal equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253975A (en) * 2011-06-16 2011-11-23 上海博康智能网络科技有限公司 Automatic switching system and method for database
CN105354036A (en) * 2015-11-26 2016-02-24 深圳市金证科技股份有限公司 Database operation code generating method and apparatus
CN109710571A (en) * 2018-12-27 2019-05-03 腾讯音乐娱乐科技(深圳)有限公司 A kind of document analysis method, equipment and storage medium
CN113535141A (en) * 2020-04-16 2021-10-22 浙江大搜车软件技术有限公司 Database operation code generation method and device
CN112235311A (en) * 2020-10-20 2021-01-15 网络通信与安全紫金山实验室 OVSDB client code automatic generation method, system, device and medium
CN113190218A (en) * 2021-04-28 2021-07-30 中国邮政储蓄银行股份有限公司 Target operation function generation method and device
CN113609128A (en) * 2021-07-21 2021-11-05 深圳市元征未来汽车技术有限公司 Method and device for generating database entity class, terminal equipment and storage medium

Also Published As

Publication number Publication date
CN115495442A (en) 2022-12-20

Similar Documents

Publication Publication Date Title
US20180357055A1 (en) System and method for computer language migration
CN106844307B (en) System and method for converting Excel into Word based on mark
CN110705237B (en) Automatic document generation method, data processing device and storage medium
CN104133772A (en) Automatic test data generation method
CN105528418B (en) A kind of design documentation generation method and device
CN108762743B (en) Data table operation code generation method and device
CN111068328A (en) Game advertisement configuration table generation method, terminal device and medium
CN102841841A (en) Method and system for processing assertion in test
US20220179642A1 (en) Software code change method and apparatus
CN114780641B (en) Multi-library multi-table synchronization method, device, computer equipment and storage medium
KR20200046769A (en) Method for providing business process management system based on automatic report generation
CN104750472A (en) Resource bundle management method and device of terminal application
Gómez et al. An approach to the co-creation of models and metamodels in Enterprise Architecture Projects.
CN109284469B (en) Webpage development framework
CN109657803B (en) Construction of machine learning models
CN111125067B (en) Data maintenance method and device
CN115495442B (en) Database operation file generation method, device, equipment and storage medium
KR20170024998A (en) System for authoring and executing rule-based business application
CN115469849A (en) Service processing system, method, electronic device and storage medium
CN113792026B (en) Method and device for deploying database script and computer-readable storage medium
Pröll et al. Precise Data Identification Services for Long Tail Research Data.
CN113010232A (en) Configuration-driven lightweight batch data processing method and device
CN110555185A (en) Page customization method and system based on PC client
CN115509513A (en) GRPC service layer code generation method, device, equipment and storage medium
US11921496B2 (en) Information processing apparatus, information processing method and computer readable medium

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
GR01 Patent grant
GR01 Patent grant