CN111414350A - Service generation method and device - Google Patents

Service generation method and device Download PDF

Info

Publication number
CN111414350A
CN111414350A CN202010193386.8A CN202010193386A CN111414350A CN 111414350 A CN111414350 A CN 111414350A CN 202010193386 A CN202010193386 A CN 202010193386A CN 111414350 A CN111414350 A CN 111414350A
Authority
CN
China
Prior art keywords
database
data table
service
configuration file
generating
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.)
Granted
Application number
CN202010193386.8A
Other languages
Chinese (zh)
Other versions
CN111414350B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010193386.8A priority Critical patent/CN111414350B/en
Publication of CN111414350A publication Critical patent/CN111414350A/en
Application granted granted Critical
Publication of CN111414350B publication Critical patent/CN111414350B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to the technical field of computers, in particular to a service generation method and a service generation device, which are used for acquiring a configuration file of a service, wherein the configuration file at least comprises database description information and resource attributes, and the resource attributes represent data table structure information in a database; generating a database and a data table of the service according to the configuration file; and generating an operation method and an external interface associated with the data table for the service according to the configured operation method template, so that the service can be automatically generated through the configuration file, the service generation efficiency is improved, and the development cost and time are reduced.

Description

Service generation method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a service generation method and apparatus.
Background
At present, with the continuous development of background technologies, a background Service Architecture is increasingly refined from a single Service Architecture (monolithic-Oriented Architecture, SOA) to a Service-Oriented Architecture (SOA) and then to a micro-Service Architecture. Generally, data processed by a single micro service is relatively simple, for example, in many cases, CRUD operations of the data, i.e., add (Create), Read (Read), Update (Update), and Delete (Delete) operations, can meet service requirements, whereas in the prior art, developers need to write CRUD logical codes repeatedly for different services, which increases development cost and time and reduces development efficiency.
Disclosure of Invention
The embodiment of the application provides a service generation method and device, so that the service development efficiency is improved, and the cost and the time are reduced.
The embodiment of the application provides the following specific technical scheme:
an embodiment of the present application provides a service generation method, including:
acquiring a configuration file of a service, wherein the configuration file at least comprises database description information and resource attributes, and the resource attributes represent data table structure information in a database;
generating a database and a data table of the service according to the configuration file;
and generating an operation method and an external interface which are associated with the data table for the service according to the configured operation method template.
Another embodiment of the present application provides a service generation apparatus, including:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a configuration file of a service, the configuration file at least comprises database description information and resource attributes, and the resource attributes represent data table structure information in a database;
the first generation module is used for generating a database and a data table of the service according to the configuration file;
and the second generation module is used for generating an operation method and an external interface which are associated with the data table for the service according to the configured operation method template.
Optionally, the system further includes a first checking module, configured to: before the first generation module generates the database and the data table of the service according to the configuration file, at least one of the following is performed:
carrying out validity check on the configuration file, and determining that the grammar of the configuration file is the correct grammar;
determining that the configuration file contains complete necessary information.
Optionally, the configuration file further includes login verification information; further comprising, a second check module for: before the first generation module generates the database and the data table of the service according to the configuration file, identity verification is carried out according to login verification information in the configuration file, and it is determined that the database corresponding to the database description information has access authority.
Optionally, the database description information at least includes a database server address and a database name, and when the database of the service is generated according to the configuration file, the first generating module is configured to:
when the database corresponding to the database name is found according to the database server address, acquiring the database;
and when the database corresponding to the database name is not found according to the database server address, establishing a corresponding database under the database server address according to the database name.
Optionally, the resource attribute at least includes a data table name and field information of a field included in the data table, and when the data table of the service is generated according to the configuration file, the first generating module is configured to:
when finding out that a data table corresponding to the name of the data table exists in the database of the service according to the name of the data table, comparing field information in the existing data table with field information contained in the configuration file, and updating the existing data table;
and according to the data table name, when a data table corresponding to the data table name does not exist in the database of the service, establishing a corresponding data table in the database of the service according to the data table name and the field information.
Optionally, when generating the operation method and the external interface associated with the data table for the service according to the configured operation method template, the second generation module is configured to:
and generating a resource structure object aiming at the data table, generating an operation method associated with the resource structure object according to a pre-configured operation method template, and generating an external interface aiming at each operation method respectively.
Optionally, the method further comprises a compiling module, configured to: and compiling and running the generated service, and detecting whether the generated service is correct.
Another embodiment of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of any one of the service generation methods when executing the program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of any of the above-mentioned service generation methods.
In the embodiment of the application, a configuration file of a service is obtained, wherein the configuration file at least comprises database description information and resource attributes, and the resource attributes represent data table structure information in a database, so that the database and the data table of the service are generated according to the configuration file, and an operation method and an external interface associated with the data table are generated for the service according to a configured operation method template.
Drawings
Fig. 1 is a schematic diagram of an application architecture of a service generation method in an embodiment of the present application;
FIG. 2 is a flow chart of a service generation method in an embodiment of the present application;
FIG. 3 is a flow chart of another service generation method in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a service generation apparatus in an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
For the purpose of facilitating an understanding of the embodiments of the present application, a brief introduction of several concepts is provided below:
the Go language: the Go language is a static strongly typed, compiled, concurrent programming language developed by Google and has garbage collection function.
Object Relational Mapping (ORM): objects in an object oriented language program are automatically persisted to a relational database using metadata that describes the mapping between the objects and the database.
CRUD: refers to the acronyms of several words, add (Create), Read (Read), Update (Update) and Delete (Delete) when doing the computation process.
Representational state transfer (RESTful) is a design style and development way of web applications, which can use eXtensible Markup language (eXtensible Markup L anguage, XM L) format definition or JS Object Notation (JSON) format definition based on HTTP, and the RESTful architecture should follow the principle of uniform interface, the uniform interface contains a set of limited predefined operations, no matter what resources, access to resources is performed by using the same interface, the interface should use standard hypertext transfer Protocol (HTTP) methods, such as find (GET), PUT and POST, and follow the semantics of these methods, wherein Get is used for lookup operation on this resource, PUT is used for covering and modifying resources, if two requests are the same, the latter request will cover the first request, POST is used for modifying the first request, and the latter will not cover the first request.
Service-Oriented Architecture (SOA): is a component model that splits different functional units of an application (called services) and ties them together by defining well-defined interfaces and protocols between the services.
Micro-service: the micro-service architecture is a new technology for deploying applications and services in the cloud, the micro-service can run in a 'self program', and communicates with an HTTP type Application Program Interface (API) through a lightweight device, and the micro-service architecture mainly has the function of decomposing functions into discrete services, so that the coupling of the system is reduced, and more flexible service support is provided.
Database (Database): is a repository that organizes, stores and manages data according to a data structure, stores together in a manner that can be shared by multiple users with as little redundancy as possible, and is a collection of data that is independent of the application.
Data table: or table, is one of the most important components of a database, which is a framework only and the data table is the substance of the database.
At present, with the continuous development of background technologies, a background service architecture is from a single service architecture to an SOA (service oriented architecture) at first and then to a micro-service architecture, and service division is more and more refined. Generally, data processed by a single microservice is relatively simple, for example, CRUD operation of the data can meet service requirements under many conditions, developers need to write CRUD logic codes repeatedly for different services in the prior art, repeated work cannot effectively improve the capability of the developers, and on the contrary, the development efforts of teams are dispersed, so that the development cost and time are increased, the development efficiency is reduced, and therefore how to provide a method for generating a service framework by configuring one key is particularly important. And Go language is more and more popular at present, and the team that uses Go language as development language is also more and more, and the realization is also simpler, and it is also very necessary to realize based on Go language.
In addition, a method of the Jhipster is also provided in the related art, the Jhipster is a completely open source code, a widely used application generator can be used for conveniently creating Spring Boot + Angular/read projects, however, the Jhipster is mainly used for generating Java applications, is based on the Spring Boot, commands and inputs parameters required for generating micro services in a console through a Jhipster tool to generate the micro services, namely, component-type parameters are provided, a user inputs and creates the micro services step by step according to the provided parameters and steps, writing and changing in a code level cannot be supported, the user cannot flexibly write or configure resources, and the realization is inflexible, and the Jhipster cannot be used for generating Go language micro services.
Therefore, in view of the above problems, an embodiment of the present application provides a service generation method, where a user may customize a configuration file, including database description information and resource attributes required by a service, and further generate a database and a data table of the service according to the configuration file of the service, and generate an operation method and an external interface associated with the data table for the service according to a configured operation method template, so that the database data table of the service may be automatically generated through the configuration file, and the associated operation method and the external interface may be automatically implemented for the data table, thereby implementing generation of a service framework, without manual creation, improving service development efficiency, and reducing cost and time.
Fig. 1 is a schematic diagram of an application architecture of a service generation method in the embodiment of the present application, including a terminal 100 and a server 200.
The terminal 100 may be any intelligent device such as a smart phone, a tablet computer, a portable personal computer, etc., and various applications may be installed on the terminal 100, various services may be accessed, and certain computing power is provided, for example, after the service generation is completed at the server 200 end in the embodiment of the present application, a user may access different services through the terminal 100.
The server 200 can provide various network services for the terminal 100, and for different applications, the server 200 may be regarded as a corresponding background server, where the server 200 may be a server, a server cluster composed of several servers, or a cloud computing center.
The Internet is typically the Internet, but may be any Network including, but not limited to, any combination of local Area networks (L Area networks, L AN), Metropolitan Area Networks (MANs), Wide Area Networks (WANs), mobile, wired, or wireless networks, private networks, or virtual private networks, in some embodiments, data exchanged over the Network is represented using technologies and/or formats including hypertext Markup language (Hyper Text Mark-up L angle, HTM L), Extensible Markup language (Extensible Markup language) L angle, XM L, and the like, and in addition, data exchanged over the Network may be represented using technologies and/or formats such as Secure sockets layer (Secure Socket, SS L), Transport layer Security (Transport L, secret), Security (Secure) L, Internet, or virtual private networks (virtual VPN), or other technologies, such as Secure Internet encryption, Secure (Secure Internet, Internet encryption, or virtual private networks (virtual VPN), or other technologies.
It should be noted that, in the embodiment of the present application, the service generation method is mainly a basic framework for generating a service, for example, a database and a data table including the service, and may also generate an external interface and an operation method, after the service framework is generated, other specific details or functions need to be given and are deployed on the server 200 side for use, and the generation of the service framework, that is, the service generation method in the embodiment of the present application may be executed by the terminal 100 side or the server 200 side, which is not limited in the embodiment of the present application.
For example, a configuration file of a service may be obtained by a script file command on the terminal 100 side, so as to generate a database and a data table of the service, and an operation method and an external interface may be generated according to an operation method template, so as to generate a service framework, and after the service framework is generated, the correctness of the service may be tested by compiling and running, so that the generated service framework may be deployed to the server 200 for a user to use through the terminal 100.
For another example, the server 200 may directly obtain a configuration file of the service, generate a database and a data table of the service, generate an associated operation method and an external interface, generate a service framework, and after compiling and running, may deploy the generated service framework in the server 200, so that the service may be used, for example, the terminal 100 may access the service through the server 200.
In addition, the service generation method in the embodiment of the present application may be implemented based on Go language, which is simpler to implement, and the embodiment of the present application is not limited.
It should be noted that the application architecture diagram in the embodiment of the present application is for more clearly illustrating the technical solution in the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application, and is not limited to microservices, but the technical solution provided in the embodiment of the present application is also applicable to similar problems for other application architectures and business applications.
In the embodiments of the present application, the application architecture shown in fig. 1 is taken as an example to schematically illustrate the application of the service generation method, and in addition, the service in the embodiments of the present application is, for example, a micro service, but the application is not limited thereto.
Based on the foregoing embodiment, referring to fig. 2, a flowchart of a service generation method in the embodiment of the present application is shown, where the method includes:
step 200: and acquiring a configuration file of the service, wherein the configuration file at least comprises database description information and resource attributes, and the resource attributes represent data table structure information in the database.
In this embodiment, the configuration file of the service may be related configuration information of the service that is autonomously defined by a user according to needs, and at least includes database description information and resource attributes of the service, where the database description information at least includes a database server address and a database name, and the resource attributes at least includes a data table name and field information of fields included in the data table, specifically, the database server address is used to specify a connected database, that is, the required database may be addressed at the address through the database server address, the database name is used to specify a creation and a required database, and the resource attributes are used to specify a name of a data table that needs to be created and information of fields and types under the data table. In addition, the configuration file may further include login verification information, where the login verification information includes a user name, a password, and the like, and may be used for identity verification.
In addition, in the embodiment of the present application, an declarative language may be used as a format of the configuration file, the declarative language programming is a programming paradigm, a program is generally regarded as a theory of formal logic, and a calculation is regarded as an inference in a logic space, so that writing of parallel programs may be simplified by using a declarative language, for example, common declarative languages include a database Query language (e.g., Structured Query L angle, SQ L), a regular expression, a logic programming, a functional programming, a configuration management system, and the like, which is not limited in the embodiment of the present application.
Further, after obtaining the configuration file of the service, before performing step 210, a validity check may be performed on the configuration file to check whether a syntax error is included in the configuration file, and whether the configuration file does not include complete necessary information, specifically, several possible implementation manners are provided in this embodiment of the present application, and before generating the database and the data table of the service according to the configuration file, the method further includes: 1) carrying out validity check on the configuration file, and determining the grammar of the configuration file as the correct grammar; 2) and carrying out validity check on the configuration file to determine that the configuration file contains complete necessary information. 3) Carrying out validity check on the configuration file, and determining the grammar of the configuration file as the correct grammar; and determines that the configuration file contains the necessary information in its entirety.
That is, in the embodiment of the present application, the subsequent step 210 is only executed when it is determined that the syntax of the configuration file is correct and the configuration file includes complete necessary information, such as the database description information and the resource attributes, so as to ensure the correctness of the configuration file.
Further, if the configuration file further includes login check information, in this embodiment of the present application, identity check may also be performed, and since the associated database is found or created by using the database server address and the database name, it may also be checked whether there is an access right to the database at the address by using the login check information, so as to improve security and reliability, specifically, a possible implementation manner is provided in this embodiment of the present application, before generating the database and the data table of the service according to the configuration file, further including: and according to the login verification information in the configuration file, performing identity verification and determining that the database corresponding to the database description information has access authority.
Therefore, in the embodiment of the application, the configuration file is analyzed, the relevant configuration information in the configuration file is extracted, the legality and the identity of the configuration file are verified, the reliability of the subsequent service generation can be ensured, and the service can be automatically generated after the verification is passed.
Step 210: and generating a database and a data table of the service according to the configuration file.
When step 210 is executed, the following two parts can be divided:
a first part: and generating a database of the service according to the configuration file.
The method specifically comprises the following steps: 1) and when the database corresponding to the database name is found according to the address of the database server, acquiring the database.
2) And when the database corresponding to the database name is not found according to the database server address, establishing a corresponding database under the database server address according to the database name.
In the embodiment of the application, whether the database name corresponding to the database server address is created or not can be firstly connected and inquired according to the database server address, if the database name is determined to be created, the creation process can be skipped, the database corresponding to the database name is determined to be the database associated with the service, if the database name is not determined to be created, the creation process is executed, and the database which is the database name is created under the database server address to serve as the database associated with the service.
A second part: and generating a data table of the service according to the configuration file.
The method specifically comprises the following steps: 1) and when the data table corresponding to the data table name exists in the database of the service according to the data table name, comparing the field information in the existing data table with the field information contained in the configuration file, and updating the existing data table.
In practice, one database may include one or more data tables, and therefore, in the embodiment of the present application, names of the data tables in the configuration file may also be one or more, without limitation, and certainly, the configuration file may also include a plurality of databases, and a corresponding relationship between different data tables and databases may also be set in the configuration file, so that corresponding data tables may be searched in corresponding databases, and if it is determined that the data tables exist, whether field information of the data tables differs may be compared, for example, the field information includes a field name, a field value, a field type, and the like, and an existing data table may be automatically updated.
When the data table is updated, field information may be automatically added or modified through comparison, and in addition, to improve reliability, deletion of the field information may be performed manually, for example, an existing data table includes field information that is not included in the data table in the configuration file, the existing data table includes more field information and does not affect use of the service, and in order to avoid increase in use of subsequent services, deletion may be first reserved and not performed, so that reliability may also be improved, and certainly, more field information included in the existing data table may also be automatically deleted, which is not limited in the embodiment of the present application.
2) And according to the data table name, when the data table corresponding to the data table name exists in the database of the service which is not searched, establishing the corresponding data table in the database of the service according to the data table name and the field information.
That is, it is determined that the corresponding data table is not found in the database, the data table creation process is executed, and the corresponding data table may be created in the database.
Therefore, the database and the data table of the service can be automatically created through the configuration file in the embodiment of the application, manual creation on the server is not needed, the efficiency is improved, and the time and the cost are reduced.
Step 220: and generating an operation method and an external interface which are associated with the data table for the service according to the configured operation method template.
When step 220 is executed, the method specifically includes: and generating a resource structure object aiming at the data table, generating an operation method associated with the resource structure object according to a pre-configured operation method template, and generating an external interface aiming at each operation method respectively.
The resource structure object may be generated by using Go language, which is not limited in the embodiment of the present application.
When the operation method associated with the resource structure object is generated, for example, according to the operation method template, the relevant keywords of the field information in the data table in the configuration file are replaced by the corresponding keywords in the operation method template and are associated with the resource structure object, that is, the operation method of the resource structure object is generated, wherein the operation method is, for example, a CRUD method, and is not limited, the CRUD interface can be called by the operation method template code, so that the CRUD method does not need to be written manually for different services repeatedly, and multiplexing can be automatically generated.
In addition, in the embodiment of the present application, an external interface is only used for an external interface used for access, the actual service logic implementation is a related operation method, one operation method has one external interface, the external interface can also be automatically generated through a template, and the related operation method is defined by a request packet and a response packet of the external interface, where the external interface may be an RESTful interface, and the embodiment of the present application is not limited.
Therefore, the service can be automatically generated through the configuration file, and the related operation method, the external interface and the like can be generated through defining the resources and the like needing to be operated through the configuration file, so that the time and the development cost are reduced.
Further, compiling is required to verify a result generated by the service after the service is generated, and in particular, a possible implementation manner is provided in this embodiment of the present application, and after an operation method and an external interface associated with a data table are generated for the service according to a configured operation method template, the method further includes: and compiling and running the generated service, and detecting whether the generated service is correct.
After the service is generated, the result generated by the verification service is automatically compiled, so that whether the service is correct or not can be effectively verified, and the reliability of subsequent deployment and use is improved, so that developers can check errors and correct the errors in time.
In the embodiment of the application, the configuration file of the service is obtained, the database and the data sheet of the service are generated according to the configuration file, and the operation method and the external interface associated with the data sheet are generated for the service according to the configured operation method template, so that the service can be automatically generated.
Based on the foregoing embodiment, a specific application scenario is described below, and referring to fig. 3, a flowchart of another service generation method in the embodiment of the present application is shown, where the method includes:
step 300: and starting.
Step 301: checking whether the configuration file is legal, if so, executing step 302, otherwise, executing step 307.
Specifically, 1) it is possible to check whether the syntax of the configuration file is correct; or 2) checking whether the configuration file does not contain complete necessary information; or 3) can check whether the syntax of the configuration file is correct and whether the configuration file does not contain the complete necessary information.
Step 302: and analyzing the configuration file.
The configuration information in the configuration file is obtained in this way, and comprises database description information, resource attributes and the like.
Wherein the resource attribute represents data table structure information in the database.
Step 303: a database of services is generated.
The type of the database in the embodiment of the present application is not limited, and may be, for example, MySQ L, PostgreSQ L, Sqlite3, SQ L Server, or the like.
Step 304: a data table of the service is generated.
Specifically, according to the name of the data table, searching is performed in a service corresponding database, if the service corresponding database exists, comparison and updating are performed, and if the service corresponding database does not exist, the service corresponding database is created.
Step 305: an operating method and an external interface associated with the data table are generated for the service.
The operation method is, for example, a CRUD method, and the external interface is a RESTful interface, which is not limited in the embodiment of the present application.
Step 306: and compiling and running the generated service, and detecting whether the generated service is correct.
Step 307: and (6) ending.
Therefore, in the embodiment of the application, the service can be automatically generated through the configuration file, the database, the data table, CRUD method operation code logic and the external interface required by the service are generated, the databases of different types are not limited, the use of the database can be abstracted into a unified call, namely, the database can be generated and realized through one key through the configuration file, manual repeated operation is not needed, the cost and the time are reduced, the efficiency is improved, the correctness of the service can be detected by compiling, developers can debug, and the correctness and the reliability of the generated service are improved.
Based on the same inventive concept, the embodiment of the present application further provides a service generation apparatus, which may be, for example, a server or a terminal in the foregoing embodiment, and the service generation apparatus may be a hardware structure, a software module, or a hardware structure plus a software module. Based on the foregoing embodiments, referring to fig. 4, a service generation apparatus in an embodiment of the present application specifically includes:
an obtaining module 40, configured to obtain a configuration file of a service, where the configuration file at least includes database description information and resource attributes, and the resource attributes represent data table structure information in a database;
a first generating module 41, configured to generate a database and a data table of a service according to the configuration file;
and a second generating module 42, configured to generate an operation method and an external interface associated with the data table for the service according to the configured operation method template.
Optionally, the first verification module 43 is further included, configured to: before the first generation module 41 generates the database and the data table of the service according to the configuration file, at least one of the following is performed:
carrying out validity check on the configuration file, and determining the grammar of the configuration file as the correct grammar;
it is determined that the configuration file contains the complete necessary information.
Optionally, the configuration file further includes login verification information; then, a second check module 44 is further included for: before the first generating module 41 generates the database and the data table of the service according to the configuration file, identity verification is performed according to login verification information in the configuration file, and it is determined that the database corresponding to the database description information has access right.
Optionally, the database description information at least includes a database server address and a database name, and when the database of the service is generated according to the configuration file, the first generating module 41 is configured to:
when the database corresponding to the database name is found according to the address of the database server, the database is obtained;
and when the database corresponding to the database name is not found according to the database server address, establishing a corresponding database under the database server address according to the database name.
Optionally, the resource attribute at least includes a data table name and field information of a field included in the data table, and when the data table of the service is generated according to the configuration file, the first generating module 41 is configured to:
according to the data table name, when finding out that the data table corresponding to the data table name exists in the database of the service, comparing the field information in the existing data table with the field information contained in the configuration file, and updating the existing data table;
and according to the data table name, when the data table corresponding to the data table name exists in the database of the service which is not searched, establishing the corresponding data table in the database of the service according to the data table name and the field information.
Optionally, when generating an operation method and an external interface associated with the data table for the service according to the configured operation method template, the second generating module 42 is configured to:
and generating a resource structure object aiming at the data table, generating an operation method associated with the resource structure object according to a pre-configured operation method template, and generating an external interface aiming at each operation method respectively.
Optionally, the compiling module 45 is further configured to: and compiling and running the generated service, and detecting whether the generated service is correct.
Based on the above embodiments, fig. 5 is a schematic structural diagram of an electronic device in an embodiment of the present application.
An embodiment of the present application provides an electronic device, which may include a processor 510 (CPU), a memory 520, an input device 530, an output device 540, and the like, wherein the input device 530 may include a keyboard, a mouse, a touch screen, and the like, and the output device 540 may include a display device, such as a liquid crystal display (L acquired crystal display, &lttttransition = L "&tttl &ttt/t &tttcd), a Cathode Ray Tube (Cathode Ray Tube, CRT), and the like.
Memory 520 may include Read Only Memory (ROM) and Random Access Memory (RAM), and provides processor 510 with program instructions and data stored in memory 520. In the embodiment of the present application, the memory 520 may be used to store a program of any one of the service generation methods in the embodiment of the present application.
The processor 510 is configured to execute any of the service generation methods according to the embodiments of the present application by calling the program instructions stored in the memory 520 and the processor 510 is configured to execute the obtained program instructions.
Based on the above embodiments, in the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program, when executed by a processor, implements the service generation method in any of the above method embodiments.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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 application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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.
While the preferred embodiments of the present application 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. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if such modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to encompass such modifications and variations.

Claims (15)

1. A method of service generation, comprising:
acquiring a configuration file of a service, wherein the configuration file at least comprises database description information and resource attributes, and the resource attributes represent data table structure information in a database;
generating a database and a data table of the service according to the configuration file;
and generating an operation method and an external interface which are associated with the data table for the service according to the configured operation method template.
2. The method of claim 1, further comprising, prior to generating the database and data tables for the service from the configuration file, at least one of:
carrying out validity check on the configuration file, and determining that the grammar of the configuration file is the correct grammar;
determining that the configuration file contains complete necessary information.
3. The method according to claim 1 or 2, wherein the configuration file further comprises login verification information; before generating the database and the data table of the service according to the configuration file, the method further comprises the following steps:
and according to the login verification information in the configuration file, performing identity verification and determining that the database corresponding to the database description information has access authority.
4. The method of claim 1, wherein the database description information includes at least a database server address and a database name, and generating the database of services according to the configuration file includes:
when the database corresponding to the database name is found according to the database server address, acquiring the database;
and when the database corresponding to the database name is not found according to the database server address, establishing a corresponding database under the database server address according to the database name.
5. The method according to claim 1 or 4, wherein the resource attribute at least includes a data table name and field information of fields included in the data table, and then generating the data table of the service according to the configuration file includes:
when finding out that a data table corresponding to the name of the data table exists in the database of the service according to the name of the data table, comparing field information in the existing data table with field information contained in the configuration file, and updating the existing data table;
and according to the data table name, when a data table corresponding to the data table name does not exist in the database of the service, establishing a corresponding data table in the database of the service according to the data table name and the field information.
6. The method according to claim 1, wherein generating an operation method and an external interface associated with the data table for the service according to the configured operation method template specifically includes:
and generating a resource structure object aiming at the data table, generating an operation method associated with the resource structure object according to a pre-configured operation method template, and generating an external interface aiming at each operation method respectively.
7. The method of claim 1, wherein after generating the operating method and external interface associated with the data table for the service according to the configured operating method template, further comprising:
and compiling and running the generated service, and detecting whether the generated service is correct.
8. A service generation apparatus, comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a configuration file of a service, the configuration file at least comprises database description information and resource attributes, and the resource attributes represent data table structure information in a database;
the first generation module is used for generating a database and a data table of the service according to the configuration file;
and the second generation module is used for generating an operation method and an external interface which are associated with the data table for the service according to the configured operation method template.
9. The apparatus of claim 8, wherein the configuration file further comprises login verification information; further comprising, a second check module for: before the first generation module generates the database and the data table of the service according to the configuration file, identity verification is carried out according to login verification information in the configuration file, and it is determined that the database corresponding to the database description information has access authority.
10. The apparatus of claim 8, wherein the database description information at least includes a database server address and a database name, and when generating the database of services according to the configuration file, the first generating module is configured to:
when the database corresponding to the database name is found according to the database server address, acquiring the database;
and when the database corresponding to the database name is not found according to the database server address, establishing a corresponding database under the database server address according to the database name.
11. The apparatus according to claim 8 or 10, wherein the resource attribute at least includes a data table name and field information of fields included in the data table, and when the data table of the service is generated according to the configuration file, the first generating module is configured to:
when finding out that a data table corresponding to the name of the data table exists in the database of the service according to the name of the data table, comparing field information in the existing data table with field information contained in the configuration file, and updating the existing data table;
and according to the data table name, when a data table corresponding to the data table name does not exist in the database of the service, establishing a corresponding data table in the database of the service according to the data table name and the field information.
12. The apparatus of claim 8, wherein when generating the operating method and external interface associated with the data table for the service according to the configured operating method template, the second generating module is configured to:
and generating a resource structure object aiming at the data table, generating an operation method associated with the resource structure object according to a pre-configured operation method template, and generating an external interface aiming at each operation method respectively.
13. The apparatus of claim 8, further comprising:
and the compiling module is used for compiling and running the generated service and detecting whether the generated service is correct or not.
14. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method of any of claims 1-7 are implemented when the program is executed by the processor.
15. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program when executed by a processor implements the steps of the method of any one of claims 1 to 7.
CN202010193386.8A 2020-03-18 2020-03-18 Service generation method and device Active CN111414350B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010193386.8A CN111414350B (en) 2020-03-18 2020-03-18 Service generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010193386.8A CN111414350B (en) 2020-03-18 2020-03-18 Service generation method and device

Publications (2)

Publication Number Publication Date
CN111414350A true CN111414350A (en) 2020-07-14
CN111414350B CN111414350B (en) 2023-05-12

Family

ID=71493082

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010193386.8A Active CN111414350B (en) 2020-03-18 2020-03-18 Service generation method and device

Country Status (1)

Country Link
CN (1) CN111414350B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112235132A (en) * 2020-09-27 2021-01-15 广州视源电子科技股份有限公司 Method, device, medium and server for dynamically configuring service
CN112764826A (en) * 2020-12-30 2021-05-07 中国人寿保险股份有限公司上海数据中心 tuxedo resource batch processing method, system, equipment and medium
CN114115839A (en) * 2022-01-28 2022-03-01 云账户技术(天津)有限公司 ORM code processing method and device, electronic equipment and readable storage medium
CN114968214A (en) * 2022-07-12 2022-08-30 云账户技术(天津)有限公司 Code automatic generation method and device, storage medium and terminal equipment
CN115422280A (en) * 2022-11-04 2022-12-02 杭州西湖新基建数字技术有限公司 Interface method for data addition, deletion and modification of uncertain data structure

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU6167701A (en) * 2000-05-20 2001-12-03 Equipe Comm Corp A network device for supporting multiple upper layer network protocols over a single network connection
US20030167356A1 (en) * 2001-07-10 2003-09-04 Smith Adam W. Application program interface for network software platform
CN101013424A (en) * 2005-12-27 2007-08-08 国际商业机器公司 System and method for executing search in a relational database
CN102135883A (en) * 2011-03-14 2011-07-27 山东大学 Software-as-a-service (SaaS) application generation and deployment supporting method and device
CN103077032A (en) * 2013-01-06 2013-05-01 北京百度网讯科技有限公司 Operation method for application program and application program client-side
CN104267932A (en) * 2014-08-12 2015-01-07 广州华多网络科技有限公司 Method, device and server for operating databases
CN106844643A (en) * 2017-01-13 2017-06-13 王洋 A kind of Database Dynamic generation method based on template engine
CN106874247A (en) * 2017-01-03 2017-06-20 北京神州绿盟信息安全科技股份有限公司 A kind of report form generation method and device
CN108427550A (en) * 2018-02-13 2018-08-21 深圳太极云软技术股份有限公司 A kind of Web service generation method, device and equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU6167701A (en) * 2000-05-20 2001-12-03 Equipe Comm Corp A network device for supporting multiple upper layer network protocols over a single network connection
US7130870B1 (en) * 2000-05-20 2006-10-31 Ciena Corporation Method for upgrading embedded configuration databases
US20030167356A1 (en) * 2001-07-10 2003-09-04 Smith Adam W. Application program interface for network software platform
CN101013424A (en) * 2005-12-27 2007-08-08 国际商业机器公司 System and method for executing search in a relational database
CN102135883A (en) * 2011-03-14 2011-07-27 山东大学 Software-as-a-service (SaaS) application generation and deployment supporting method and device
CN103077032A (en) * 2013-01-06 2013-05-01 北京百度网讯科技有限公司 Operation method for application program and application program client-side
CN104267932A (en) * 2014-08-12 2015-01-07 广州华多网络科技有限公司 Method, device and server for operating databases
CN106874247A (en) * 2017-01-03 2017-06-20 北京神州绿盟信息安全科技股份有限公司 A kind of report form generation method and device
CN106844643A (en) * 2017-01-13 2017-06-13 王洋 A kind of Database Dynamic generation method based on template engine
CN108427550A (en) * 2018-02-13 2018-08-21 深圳太极云软技术股份有限公司 A kind of Web service generation method, device and equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KEHRER S等: "autogenic:automated generation of self configuring microservices", CLOSER *
曹路;秦传波;李任杰;: "基于Android的电子工程师小助手的设计与实现", 物联网技术 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112235132A (en) * 2020-09-27 2021-01-15 广州视源电子科技股份有限公司 Method, device, medium and server for dynamically configuring service
CN112235132B (en) * 2020-09-27 2023-04-28 广州视源电子科技股份有限公司 Method, device, medium and server for dynamically configuring service
CN112764826A (en) * 2020-12-30 2021-05-07 中国人寿保险股份有限公司上海数据中心 tuxedo resource batch processing method, system, equipment and medium
CN112764826B (en) * 2020-12-30 2024-05-17 中国人寿保险股份有限公司上海数据中心 Tuxedo resource batch processing method, system, equipment and medium
CN114115839A (en) * 2022-01-28 2022-03-01 云账户技术(天津)有限公司 ORM code processing method and device, electronic equipment and readable storage medium
CN114968214A (en) * 2022-07-12 2022-08-30 云账户技术(天津)有限公司 Code automatic generation method and device, storage medium and terminal equipment
CN114968214B (en) * 2022-07-12 2022-10-28 云账户技术(天津)有限公司 Code automatic generation method and device, storage medium and terminal equipment
CN115422280A (en) * 2022-11-04 2022-12-02 杭州西湖新基建数字技术有限公司 Interface method for data addition, deletion and modification of uncertain data structure

Also Published As

Publication number Publication date
CN111414350B (en) 2023-05-12

Similar Documents

Publication Publication Date Title
US10990367B2 (en) Application development method, tool, and device, and storage medium
CN111414350B (en) Service generation method and device
US9646041B2 (en) Testing of inactive design-time artifacts
US10862979B2 (en) Techniques for supporting remote micro-services as native functions in spreadsheet applications
US20230057335A1 (en) Deployment of self-contained decision logic
US9645989B2 (en) Techniques to generate custom electronic forms using custom content
US9934007B2 (en) Method for operating tool in working environment and machine using such method
US11128721B2 (en) Action flow fragment management
CN109710220B (en) Relational database query method, relational database query device, relational database query equipment and storage medium
CN111125064B (en) Method and device for generating database schema definition statement
US9606844B2 (en) Remotely-hosted interactive client-server session
US11604662B2 (en) System and method for accelerating modernization of user interfaces in a computing environment
US20200057617A1 (en) Software code optimizer and method
WO2022099913A1 (en) Interface configuration method and apparatus, and device and medium
CN113342399A (en) Application structure configuration method and device and readable storage medium
CN111488286A (en) Method and device for independently developing Android module
CN114254232A (en) Cloud product page generation method and device, computer equipment and storage medium
Aryal MERN stack with modern web practices
US11704093B2 (en) Rapid prototyping of user experience components and related application functionality
US20230267163A1 (en) Runtime completion of web component metadata
Sastry Enhanced Position Aware Sampling For The Cloud
Sanchiz et al. Extending MoWebA for MobileApps with functions in the Cloud
Giordano Study and development of a mobile-oriented application for the efficient management of a radiation test
CN117234899A (en) Regression testing method, device, equipment and computer medium
CN117992101A (en) Application program modification method and device, electronic equipment and storage 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