Method, apparatus, device, and computer-readable medium for matching interfaces
By extracting and matching interface information in the interface data table and csv file, using precise and fuzzy queries of path identification and search parameters, the problem of slow matching of csv file and database interface is solved, and efficient interface matching is achieved.
Patent Information
- Application Number
- CN202210801259.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-08
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2042-07-08
AI Technical Summary
In the prior art, the data structure provided by the csv file is different from the data format in the database, resulting in slow interface matching speed and cumbersome code.
Extract database interface information from the interface data table and store it in a storage document determined based on the path identification; extract interface type information from the csv file, and use search parameters to match the database interface information in the storage document, and use key-value pairs and lists to perform precise and fuzzy queries to achieve interface matching.
It improves the targetedness and speed of interface matching, simplifies code, and improves matching efficiency.
Smart Images

Figure CN115114364B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of big data data access, and in particular, to a method, apparatus, device, and computer-readable medium for matching interfaces. Background Art
[0002] Under the microservices architecture, a system is divided into multiple microservices according to functions. Each microservice provides a backend port that can be called by the system. Under the above framework, the interface permissions of microservices need to be strictly controlled. Currently, authentication is implemented through the login approach.
[0003] There are usually hundreds or thousands of interfaces in a system. In order to initialize and maintain such relationships, the method of importing through a comma-separated values (csv) file is adopted to match the interfaces.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: the data structure provided by the csv file is different from the data format in the database. When the interfaces imported from the csv file are matched with the interfaces in the interface data table, since multiple objects need to be targeted, not only is the code cumbersome, but also the matching speed is slow. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method, apparatus, device, and computer-readable medium for matching interfaces, which can improve the pertinence of interface matching and the matching speed.
[0006] To achieve the above object, according to one aspect of the embodiments of the present invention, a method for matching interfaces is provided, including:
[0007] Extracting database interface information from an interface data table and storing the database interface information in a corresponding storage document, where the storage document is a document determined according to a path identifier in the database interface information;
[0008] In a comma-separated values (csv) file, extracting interface type information and using search parameters of the interface type information to match the database interface information in the storage document;
[0009] Based on the matching result, locating the database interface corresponding to the interface type information in the csv file to implement the matching of the csv interface and the database interface.
[0010] The extracting database interface information from an interface data table and storing the database interface information in a corresponding storage document includes:
[0011] In the interface data table, extract the database interface information according to the data structure for storing interface information in the database. The database interface information includes a service identifier, a request method, and a path identifier;
[0012] Store the service identifier, the request method, and the path identifier into the corresponding storage document.
[0013] The path identifier corresponds to a target identifier, and the storage file is an exact query document determined according to the target identifier in the database interface information.
[0014] The storing the service identifier, the request method, and the path identifier into the corresponding storage document includes:
[0015] Map to a search string according to the service identifier, the request method, and the path identifier;
[0016] Store the search string into the exact query document in the form of key-value pairs.
[0017] The path identifier corresponds to a target path, and the storage file is a fuzzy query document determined according to the target path in the database interface information.
[0018] The storing the service identifier, the request method, and the path identifier into the corresponding storage document includes:
[0019] Store the service identifier, the request method, and the path identifier into the fuzzy query document in the form of a list.
[0020] The extracting interface type information in the csv file includes:
[0021] In the csv file, extract the interface type information according to the data structure of the csv file. The interface type information includes a service identifier, a request method, and a request path;
[0022] Map to the search parameter of the interface type information according to the service identifier, the request method, and the request path.
[0023] Before mapping to the search parameter of the interface type information according to the service identifier, the request method, and the request path, it further includes:
[0024] Use the search method and pass in the service identifier, the request method, and the request path.
[0025] The matching the database interface information in the storage document by using the search parameter of the interface type information includes:
[0026] Using the search parameters of the interface type information, match the database interface information of the exact query document in the stored document by key-value pairs.
[0027] The matching of the database interface information of the exact query document in the stored document by key-value pairs includes:
[0028] By using the get method, match the database interface information of the exact query document in the stored document by key-value pairs.
[0029] The matching of the database interface information in the stored document by using the search parameters of the interface type information includes:
[0030] The matching of the database interface information of the exact query document in the stored document by key-value pairs using the search parameters of the interface type information fails;
[0031] Based on the service identifier, request method, and request path of the interface type information, match the database interface information of the fuzzy query document in the stored document in a list manner.
[0032] The matching of the database interface information of the fuzzy query document in the stored document in a list manner includes:
[0033] Use the matcher method to match the database interface information of the fuzzy query document in the stored document in a list manner.
[0034] The matching of the database interface information in the stored document by using the search parameters of the interface type information includes:
[0035] After extracting a search parameter of the interface type information, use the search parameter of the interface type information to synchronously match the database interface information in the stored document.
[0036] The matching of the database interface information in the stored document by using the search parameters of the interface type information includes:
[0037] After extracting all search parameters of the interface type information, use the search parameters of all interface type information to asynchronously match the database interface information in the stored document.
[0038] The matching of the database interface information in the stored document by using the search parameters of the interface type information includes:
[0039] Use the search parameters of the interface type information to match the database interface information in the stored document when receiving the interface information for use.
[0040] Based on the matching result, locating the database interface corresponding to the interface type information in the csv file includes:
[0041] The matching result includes successful matching, locating and identifying the database interface corresponding to the interface type information in the csv file.
[0042] According to a second aspect of an embodiment of the present invention, there is provided a device for matching interfaces, including:
[0043] A storage module, configured to extract database interface information from an interface data table and store the database interface information into a corresponding storage document, where the storage document is a document determined according to a path identifier in the database interface information;
[0044] A matching module, configured to extract interface type information from a comma-separated values (csv) file and use search parameters of the interface type information to match the database interface information in the storage document;
[0045] A positioning module, configured to locate the database interface corresponding to the interface type information in the csv file based on the matching result, so as to implement the matching of the csv interface and the database interface.
[0046] According to a third aspect of an embodiment of the present invention, there is provided an electronic device for matching interfaces, including:
[0047] One or more processors;
[0048] A storage device, configured to store one or more programs,
[0049] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0050] According to a fourth aspect of an embodiment of the present invention, there is provided a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method as described above is implemented.
[0051] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, including a computer program, and when the program is executed by a processor, the method as provided in the embodiment of the present invention as described above is implemented.
[0052] One embodiment of the above invention has the following advantages or beneficial effects: extracting database interface information from an interface data table and storing the database interface information in a corresponding storage document, where the storage document is a document determined according to a path identifier in the database interface information; extracting interface type information from a comma-separated values (CSV) file and using search parameters of the interface type information to match the database interface information in the storage document; based on the matching result, locating the database interface corresponding to the interface type information in the CSV file to achieve the matching of the CSV interface and the database interface. By extracting interface information from the interface data table and the CSV file respectively and matching the interfaces in the storage file for the interface information, the pertinence of interface matching can be improved and the matching speed can be increased.
[0053] The further effects of the above non-conventional alternative will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The drawings are used to better understand the present invention and do not unduly limit the present invention. Among them:
[0055] Figure 1 is a main flow schematic diagram of a method for matching interfaces according to an embodiment of the present invention;
[0056] Figure 2 is a flow schematic diagram of storing database interface information in a corresponding storage document according to an embodiment of the present invention;
[0057] Figure 3 is a flow schematic diagram of storing a search string according to an embodiment of the present invention;
[0058] Figure 4 is a flow schematic diagram of extracting interface type information according to an embodiment of the present invention;
[0059] Figure 5 is a flow schematic diagram of matching database interface information according to an embodiment of the present invention;
[0060] Figure 6 is an interaction schematic diagram of CSV-side data and database-side data according to an embodiment of the present invention;
[0061] Figure 7 is a main structural schematic diagram of a device for matching interfaces according to an embodiment of the present invention;
[0062] Figure 8 is an exemplary system architecture diagram to which an embodiment of the present invention can be applied;
[0063] Figure 9 is a structural schematic diagram of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. Detailed implementation manners
[0064] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. The acquisition, storage, use, processing, etc. of data in the technical solution of this application all comply with the relevant regulations of national laws and regulations.
[0065] Currently, permission control is achieved by matching access interfaces for interface menus. Specifically, the system provides different permissions. When a user creates a new role, the user can select the corresponding permissions for the role in the interface menu. The function list is called the "interface menu". Each function corresponds to the permission to access the backend interface. Through the above mechanism, "menu-interface permission control" is achieved.
[0066] Under the above mechanism, the corresponding relationship between the menu and the interface permissions is obviously defined by the operator. There are usually hundreds or thousands of interfaces in the system. To initialize and maintain the above corresponding relationship, the method of importing through a csv file is mostly used. However, the data structure provided by csv is usually different from the format in the database.
[0067] The microservice architecture implemented based on Spring Boot is the current mainstream construction solution. Among them, Spring Boot provides many encapsulated classes and methods for developers to use. Among them, the ServerWebExchange of Spring Gateway stores important request-response attributes, request instances, response instances, etc.
[0068] Spring Boot provides RequestMappingInfo, and for the attributes of a method, value, path, params, and heads of an interface, a series of processing methods are provided, including sorting (compareTo) and request matching (getMatchingCondition), etc.
[0069] In the framework of Spring Boot, the simplest and most common method for interface matching is to directly use the getMappingCondition method provided by RequestMappingInfo for interface matching.
[0070] The following briefly describes the implementation of interface matching using the getMappingCondition method.
[0071] 1) Read the csv file.
[0072] 2) Process each interface information and construct a source object of type ServerWebExchange.
[0073] 3) Read the interface information stored in the system database and construct a target object of type ServerWebExchange.
[0074] 4) Use the getMappingCondition method to match the source object of type ServerWebExchange with the target object.
[0075] Among them, using the getMappingCondition matching method, as a packaging method of Spring Boot, is very convenient to call, but for permission control, it has great defects. This is because the parameter structure of the packaging method is specified, and ServerWebExchange, as a comprehensive packaging object, has a wide range of encapsulated attributes. There are many possibilities to consider when calling getMappingCondition.
[0076] Implementing the matching interface in the above manner is not only cumbersome in code, but also slow in matching speed due to the wide range of encapsulated attributes.
[0077] To solve the pertinence of the matching interface, the technical solutions in the following embodiments of the present invention can be adopted.
[0078] See Figure 1 , Figure 1 is a schematic diagram of the main process of the method for matching interfaces according to the embodiments of the present invention. The database interface information is stored in a storage document, and the interface type information in the csv file is used to implement the matching interface in the storage document. As Figure 1 shown, it specifically includes the following steps:
[0079] S101. Extract the database interface information from the interface data table and store the database interface information in the corresponding storage document, where the storage document is determined according to the path identifier in the database interface information.
[0080] In the embodiments of the present invention, the method for matching interfaces is applicable to matching database interfaces and csv files. Specifically, in the framework of Sping Boot, the interface information in the database is recorded in the interface data table. Among them, microservices can be executed through the database interface.
[0081] Microservices advocate dividing a single application into a group of small services that coordinate and cooperate with each other to provide ultimate value to users. Each service runs in its own independent process, and lightweight communication mechanisms are used to communicate between services. Each service is built around a specific business and can be independently deployed to production environments, pre-production environments, etc.
[0082] In an embodiment of the present invention, the database interface is used to execute microservices. As an example, microservice a is executed through the first interface; microservice b is executed through the second interface; microservice c is executed through the third interface.
[0083] The purpose of extracting database interface information from the interface data table is to store the database interface information in a storage document. The storage document is a document determined based on the path identifier in the database interface information. It can be understood that if the path identifier is different, the storage document is different, that is, the storage location of the database interface information is different.
[0084] See Figure 2 , Figure 2 is a schematic flowchart of storing database interface information into a corresponding storage document according to an embodiment of the present invention. It specifically includes the following steps:
[0085] S201. In the interface data table, extract the database interface information according to the data structure of the database storing the interface information. The database interface information includes a service identifier, a request method, and a path identifier.
[0086] The database interface information is stored in the interface data table. The database interface information includes relevant information about the interface. Extract the database interface information according to the data structure of the database storing the interface information.
[0087] As an example, the data structure of the database storing the interface information is: the service identifier is stored in the 1st byte to the 10th byte; the request method is stored in the 20th byte to the 40th byte; the path identifier is stored in the 50th byte to the 70th byte.
[0088] In an embodiment of the present invention, the database interface information includes a service identifier, a request method, and a path identifier. The service identifier is used to mark the service. For example, service identifier 1 is used to identify microservice 1; service identifier 2 is used to identify microservice 2. The request method is the way to submit a request. As an example, the request method includes post. The path identifier is used to identify the target accessed by the interface.
[0089] S202. Store the service identifier, the request method, and the path identifier into the corresponding storage document.
[0090] In an embodiment of the present invention, considering that a large number of database interface information is extracted from the interface data table, it is necessary to store the database interface information in a corresponding storage document. That is, the database interface information is classified and stored.
[0091] In an embodiment of the present invention, the database interface information is classified into two categories based on the path identifier. Specifically, if the path identifier corresponds to the target identifier, the storage file is an exact query document determined according to the target identifier in the database interface information. Among them, the target identifier is the target of accessing the interface. As an example, the target identifier includes / api / all / app1. It can be understood that the target of accessing the interface is app1.
[0092] For the case where the path identifier corresponds to the target identifier and the database interface information is stored, the following method can also be adopted:
[0093] See Figure 3 , Figure 3 which is a schematic flowchart of storing search strings according to an embodiment of the present invention. Specifically, it includes the following methods:
[0094] S301. Map the service identifier, request method, and path identifier to obtain a search string.
[0095] To improve the speed of searching for database interface information, the database interface can be stored in a corresponding storage document in the form of a string.
[0096] Specifically, map the service identifier, request method, and path identifier to obtain a search string. As an example, according to the sha256Hex method, map the service identifier, request method, and path identifier to obtain a search string (searchkey).
[0097] S302. Store the search string in the exact query document in the form of a key-value pair.
[0098] The search string can be stored in the form of a key-value pair, that is, the search string is stored in the exact query document in the form of a key-value pair. It can be understood that in the exact query document, multiple search strings are stored in the form of key-value pairs. Each search string corresponds to a database interface information.
[0099] In Figure 3 's embodiment, for the target identifier, store the search string in the exact query document to improve the speed of matching interfaces.
[0100] In an embodiment of the present invention, if the path identifier corresponds to the target path, the target of the access interface cannot be directly determined. As an example, the target path includes / h5 / print / {h5Id}. It can be understood that the target can be accessed through the target path. In the above case, the stored file is a fuzzy query document determined according to the target path in the database interface information.
[0101] That is, if the path identifier corresponds to the target path, the stored file is a fuzzy query document determined according to the target path in the database interface information.
[0102] In the case where the path identifier corresponds to the target path, the service identifier, request method, and path identifier are stored in a list in the fuzzy query document. Storing in a list is to consider that traversal needs to be used to implement interface matching in the fuzzy query file to improve the matching speed.
[0103] S102. In the csv file, extract the interface type information, and use the search parameters of the interface type information to match the database interface information in the stored document.
[0104] The csv file stores tabular data in plain text form. The csv file consists of any number of records separated by some newline character; each record consists of fields separated by other characters or strings, most commonly commas or tab characters. Usually, all records have exactly the same field sequence.
[0105] After extracting the interface type information from the csv file, use the search parameters of the interface type information to match the database interface information in the stored document.
[0106] See Figure 4 , Figure 4 is a flowchart of extracting interface type information according to an embodiment of the present invention. Specifically, it includes the following steps:
[0107] S401. In the csv file, extract the interface type information according to the data structure of the csv file. The interface type information includes the service identifier, request method, and request path.
[0108] In the csv file, the interface type information can be extracted based on the data structure of the csv file. The interface type information includes the service identifier, request method, and request path. The purpose of extracting the interface type information is to match the interface.
[0109] In one embodiment of the present invention, it is necessary to pass in interface type information to obtain search parameters for the interface type information. Specifically, using the search method, pass in the service identifier, request method, and request path. The search method can find entries in the document that match the search criteria. As an example, if the search criteria is set to the service identifier, then the search method can be used to pass in the service identifier, request method, and request path.
[0110] S402. Map according to the service identifier, request method, and request path to obtain search parameters for the interface type information.
[0111] Matching an interface requires involving search parameters, and search parameters for the interface type information can be mapped according to the service identifier, request method, and request path. As an example, according to the sha256Hex method, search parameters are mapped based on the service identifier, request method, and request path.
[0112] In Figure 4 's embodiment, search parameters for the interface type information are mapped based on the csv file.
[0113] After learning the search parameters for the interface type information, the database interface information in the stored document can be matched.
[0114] In the embodiment of the present invention, there are two types of stored documents, an exact query document and a fuzzy query document. When matching the database interface information, it can be first matched in the exact query document, and in the case of failure to match, then matched in the fuzzy query file. This is because most of the database interface information is stored in the exact query document, and a small part of the database interface information is stored in the fuzzy query file.
[0115] In one embodiment of the present invention, using the search parameters for the interface type information, the database interface information in the exact query document of the stored document is matched by key-value pairs.
[0116] Since in the exact query document, the search strings are stored in the form of key-value pairs, the database interface information in the exact query document of the stored document is matched by key-value pairs. As an example, through the get method, the database interface information in the exact query document of the stored document is matched by key-value pairs.
[0117] If the database interface information is successfully matched in the exact query document, the matching of the csv interface and the database interface can be achieved; if the database interface information is not successfully matched in the exact query document, the database interface information is matched in the fuzzy query document.
[0118] See Figure 5 , Figure 5It is a schematic flow chart of matching database interface information according to an embodiment of the present invention. Specifically, it includes the following steps:
[0119] S501. Using the search parameters of the interface type information, the key-value pair matching fails to accurately query the database interface information in the storage document.
[0120] After using the search parameters of the interface type information and failing to accurately query the database interface information in the storage document by key-value pair matching, it indicates that there is no database interface information matching the search parameters in the accurate query document. Then, it can continue to match in the fuzzy query document.
[0121] S502. Based on the service identifier, request method, and request path of the interface type information, match the database interface information in the fuzzy query document in the storage document in a list manner.
[0122] The fuzzy query document stores the database interface information in a list manner. Based on the service identifier, request method, and request path of the interface type information, match the database interface information in the fuzzy query document in the storage document in a list manner. As an example, by traversing the list Fuzzy List, match the database interface information in the fuzzy query document in the storage document, such as: matching the service identifier.
[0123] In an embodiment of the present invention, the matcher method is used to match the database interface information in the fuzzy query document in the storage document in a list manner. Specifically, when it is determined that the service identifier and request method of the interface type information are the same as those of the database interface information in the fuzzy query document, then through regular expressions, the matcher method is used to match the path identifier in the database interface information in the fuzzy query document in the storage document in a list manner. If the request path is the same as the path identifier, the match is successful; if the request path is different from the path identifier, the match fails.
[0124] In Figure 5 In the embodiment of, after the match fails in the accurate query document, match in the fuzzy query document.
[0125] In the practice process of the embodiment solution of the present invention, first match the interface in the accurate query document, and the time complexity is O(logM)+O(N). Since most of the database interface information is stored in the accurate query document and a small part of the database interface information is stored in the fuzzy query file. The time complexity of adopting the embodiment solution of the present invention can reach O(logM). M is the number of database interface information stored in the accurate query document; N is the number of database interface information stored in the fuzzy query document.
[0126] In one embodiment of the present invention, when the number of search parameters of the interface type information is large, after extracting a search parameter of the interface type information, the search parameter of the interface type information can be used to synchronously match the database interface information in the stored document. That is to say, every time a search parameter is extracted, the database interface information is synchronously matched, thereby improving the speed of matching the interface.
[0127] In one embodiment of the present invention, after extracting all the search parameters of the interface type information, the search parameters of all the interface type information are used to asynchronously match the database interface information in the stored document. It can be understood that in the case of a large number of search parameters, in order to ensure the correctness of the matching, asynchronous matching can be implemented.
[0128] In one embodiment of the present invention, in order to avoid the impact of interface matching on the normal operation of the system, interface matching can be implemented when receiving interface usage information. That is, using the search parameter of the interface type information, when receiving interface usage information, the database interface information in the stored document is matched.
[0129] S103. Based on the matching result, locate the database interface corresponding to the interface type information in the csv file to implement the matching of the csv interface and the database interface.
[0130] Based on the matching result, the database interface corresponding to the interface type information in the csv file can be located. Specifically, the matching result includes successfully matching the database interface information in the stored document using the search parameter of the interface type information. The interface that successfully matches the database interface information is located as the database interface corresponding to the interface type information in the csv file, thereby implementing the matching of the csv interface and the database interface. After the interface is completely matched successfully, the menu - interface permission is successfully imported.
[0131] In addition, if the matching result includes a failure to match in the exact query document and a failure to match in the fuzzy query document, it is determined that the interface matching fails.
[0132] In the above - mentioned embodiment of the present invention, database interface information is extracted from the interface data table, and the database interface information is stored in the corresponding stored document, and the stored document is a document determined according to the path identifier in the database interface information; in the csv file, interface type information is extracted, and the search parameter of the interface type information is used to match the database interface information in the stored document; based on the matching result, the database interface corresponding to the interface type information in the csv file is located to implement the matching of the csv interface and the database interface. Extracting interface information from the interface data table and the csv file respectively and matching the interfaces in the storage file for the interface information can improve the pertinence of interface matching and the matching speed.
[0133] See Figure 6 , Figure 6 which is a schematic diagram of the interaction between csv-side data and database-side data according to an embodiment of the present invention.
[0134] Figure 6 In, the csv-side data structure extracts interface type information from the csv file. The database data structure extracts database interface information from the interface data table. Both the interface type information and the database interface information belong to the basic interface type (MetaResource). In the server, interface matching is achieved through exact query documents and fuzzy query documents.
[0135] See Figure 7 , Figure 7 which is a schematic diagram of the main structure of a device for matching interfaces according to an embodiment of the present invention. The device for matching interfaces can implement the method of matching interfaces. As Figure 7 shown, the device for matching interfaces specifically includes:
[0136] A storage module 701, configured to extract database interface information from the interface data table and store the database interface information into a corresponding storage document, where the storage document is a document determined according to the path identifier in the database interface information;
[0137] A matching module 702, configured to extract interface type information from a comma-separated values (csv) file and use the search parameters of the interface type information to match the database interface information in the storage document;
[0138] A positioning module 703, configured to locate the database interface corresponding to the interface type information in the csv file based on the matching result, so as to implement the matching between the csv interface and the database interface.
[0139] In an embodiment of the present invention, the storage module 701 is specifically configured to extract the database interface information from the interface data table according to the data structure of the database storage interface information, where the database interface information includes a service identifier, a request method, and a path identifier;
[0140] Store the service identifier, the request method, and the path identifier into a corresponding storage document.
[0141] In an embodiment of the present invention, the path identifier corresponds to a target identifier, and the storage file is an exact query document determined according to the target identifier in the database interface information.
[0142] In an embodiment of the present invention, the storage module 701 is specifically configured to map and obtain a search string according to the service identifier, the request method, and the path identifier;
[0143] Store the search string in the form of key-value pairs in the exact query document.
[0144] In an embodiment of the present invention, the path identifier corresponds to a target path, and the stored file is a fuzzy query document determined according to the target path in the database interface information.
[0145] In an embodiment of the present invention, the storage module 701 is specifically configured to store the service identifier, the request method, and the path identifier in the form of a list in the fuzzy query document.
[0146] In an embodiment of the present invention, the matching module 702 is specifically configured to extract interface type information in a csv file according to the data structure of the csv file, and the interface type information includes a service identifier, a request method, and a request path;
[0147] Map the service identifier, the request method, and the request path to obtain search parameters of the interface type information.
[0148] In an embodiment of the present invention, the matching module 702 is specifically configured to use the search method and pass in the service identifier, the request method, and the request path.
[0149] In an embodiment of the present invention, the matching module 702 is specifically configured to use the search parameters of the interface type information and match the database interface information of the exact query document in the stored document by key-value pairs.
[0150] In an embodiment of the present invention, the matching module 702 is specifically configured to use the get method and match the database interface information of the exact query document in the stored document by key-value pairs.
[0151] In an embodiment of the present invention, the matching module 702 is specifically configured to fail to match the database interface information of the exact query document in the stored document by using the search parameters of the interface type information by key-value pairs;
[0152] Based on the service identifier, the request method, and the request path of the interface type information, match the database interface information of the fuzzy query document in the stored document in the form of a list.
[0153] In an embodiment of the present invention, the matching module 702 is specifically configured to use the matcher method and match the database interface information of the fuzzy query document in the stored document in the form of a list.
[0154] In one embodiment of the present invention, the matching module 702 is specifically configured to extract search parameters of an interface type information, and then use the search parameters of the interface type information to synchronously match the database interface information in the stored document.
[0155] In one embodiment of the present invention, the matching module 702 is specifically configured to extract search parameters of all interface type information, and then use the search parameters of all interface type information to asynchronously match the database interface information in the stored document.
[0156] In one embodiment of the present invention, the matching module 702 is specifically configured to use the search parameters of the interface type information to match the database interface information in the stored document when receiving the use of interface information.
[0157] In one embodiment of the present invention, the positioning module 703 is specifically configured to, when the matching result includes successful matching, locate and identify the database interface corresponding to the interface type information in the csv file.
[0158] In one embodiment of the present invention, the database interface is used to execute microservices.
[0159] Figure 8 An exemplary system architecture 800 to which the method or apparatus for matching interfaces according to the embodiments of the present invention can be applied is shown.
[0160] As Figure 8 shown, the system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 is used as a medium to provide a communication link between the terminal devices 801, 802, 803 and the server 805. The network 804 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0161] Users can use the terminal devices 801, 802, 803 to interact with the server 805 through the network 804 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 801, 802, 803, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0162] The terminal devices 801, 802, 803 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0163] The server 805 can be a server that provides various services. For example, it can be a back-end management server (only an example) that supports shopping websites browsed by users using terminal devices 801, 802, and 803. The back-end management server can analyze and process data such as product information query requests received, and feedback the processing results (such as target push information, product information - only examples) to the terminal devices.
[0164] It should be noted that the method for the matching interface provided in the embodiments of the present invention is generally executed by the server 805. Correspondingly, the device for the matching interface is generally set in the server 805.
[0165] It should be understood that Figure 8 the numbers of terminal devices, networks, and servers in
[0166] A computer program product according to an embodiment of the present invention includes a computer program, and when the program is executed by a processor, it implements the method for the matching interface provided in the embodiments of the present invention.
[0167] Next, refer to Figure 9 , which shows a schematic structural diagram of a computer system 900 of a terminal device suitable for implementing the embodiments of the present invention. Figure 9 The terminal device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0168] As Figure 9 shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage section 908 into the random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other through a bus 904. The input / output (I / O) interface 905 is also connected to the bus 904.
[0169] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as required. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is mounted on the drive 910 as required so that a computer program read from it is installed into the storage section 908 as required.
[0170] Specifically, according to an embodiment disclosed by the present invention, the processes described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment disclosed by the present invention includes a computer program product which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from the removable medium 911. When the computer program is executed by a central processing unit (CPU) 901, the above functions defined in the system of the present invention are executed.
[0171] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0172] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0173] The modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: A processor includes a storage module, a matching module, and a positioning module. Among them, the names of these modules do not constitute a limitation to the module itself in some cases. For example, the storage module can also be described as "extracting database interface information from an interface data table and storing the database interface information into a corresponding storage document, where the storage document is determined according to the path identifier in the database interface information."
[0174] As another aspect, the present invention also provides a computer-readable medium, which can be included in the device described in the above embodiments; or can exist separately without being assembled into the device. The above computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the device includes:
[0175] extracting database interface information from an interface data table and storing the database interface information into a corresponding storage document, where the storage document is determined according to the path identifier in the database interface information;
[0176] extracting interface type information from a comma-separated values (CSV) file, and using search parameters of the interface type information to match the database interface information in the storage document;
[0177] positioning the database interface corresponding to the interface type information in the CSV file based on the matching result to implement the matching of the CSV interface and the database interface.
[0178] According to the technical solution of the embodiments of the present invention, database interface information is extracted from an interface data table and stored in a corresponding storage document, where the storage document is determined according to the path identifier in the database interface information; interface type information is extracted from a comma-separated values (CSV) file, and search parameters of the interface type information are used to match the database interface information in the storage document; based on the matching result, the database interface corresponding to the interface type information in the CSV file is positioned to implement the matching of the CSV interface and the database interface. By extracting interface information from the interface data table and the CSV file respectively and matching the interfaces in the storage file for the interface information, the pertinence of interface matching can be improved, and the matching speed can be increased.
[0179] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for matching interfaces, characterized in that, Including: Extract database interface information from the interface data table and store the database interface information in the corresponding storage document, where the storage document is a document determined according to the path identifier in the database interface information; In a comma-separated values (CSV) file, extract interface type information and use the search parameters of the interface type information to match the database interface information in the storage document; Based on the matching result, locate the database interface corresponding to the interface type information in the CSV file to achieve the matching of the CSV interface and the database interface; The extracting database interface information from the interface data table and storing the database interface information in the corresponding storage document includes: In the interface data table, extract the database interface information according to the data structure of the database storage interface information, where the database interface information includes a service identifier, a request method, and a path identifier; Store the service identifier, the request method, and the path identifier in the corresponding storage document; The using the search parameters of the interface type information to match the database interface information in the storage document includes: Use the search parameters of the interface type information to match the database interface information of the exact query document in the storage document by key-value pairs; The use of the search parameters of the interface type information to match the database interface information of the exact query document in the storage document fails; based on the service identifier, the request method, and the request path of the interface type information, match the database interface information of the fuzzy query document in the storage document by means of a list; Use the matcher method to match the database interface information of the fuzzy query document in the storage document by means of a list; After extracting the search parameter of an interface type information, use the search parameter of the interface type information to synchronously match the database interface information in the storage document; After extracting the search parameters of all interface type information, use the search parameters of all interface type information to asynchronously match the database interface information in the storage document; Use the search parameters of the interface type information to match the database interface information in the storage document when receiving the use of interface information.
2. The method for matching interfaces according to claim 1, wherein The path identifier corresponds to a target identifier, and the storage document is an exact query document determined according to the target identifier in the database interface information.
3. The method for matching interfaces according to claim 2, wherein The storing the service identifier, the request method, and the path identifier in the corresponding storage document includes: Map to a search string based on the service identifier, the request method, and the path identifier; Store the search string in the exact query document in the form of key-value pairs.
4. The method for matching interfaces according to claim 1, wherein The path identifier corresponds to a target path, and the storage document is a fuzzy query document determined according to the target path in the database interface information.
5. The method for matching interfaces according to claim 4, wherein The storing the service identifier, the request method, and the path identifier in the corresponding storage document includes: Store the service identifier, the request method, and the path identifier in the fuzzy query document in the form of a list.
6. The method for matching interfaces according to claim 1, wherein In the csv file, extract interface type information, including: In the csv file, extract interface type information according to the data structure of the csv file, where the interface type information includes a service identifier, a request method, and a request path; Map according to the service identifier, the request method, and the request path to obtain search parameters for the interface type information.
7. The method for matching an interface according to claim 6, wherein Before mapping according to the service identifier, the request method, and the request path to obtain search parameters for the interface type information, it further includes: Use the search method and pass in the service identifier, the request method, and the request path.
8. The method for matching interfaces according to claim 1, wherein The database interface information for accurately querying documents in the storage document by using key-value pair matching includes: Through the get method, use key-value pair matching to match the database interface information for accurately querying documents in the storage document.
9. The method for matching an interface according to claim 1, wherein Based on the matching result, locate the database interface corresponding to the interface type information in the csv file, including: The matching result includes a successful match, locate and identify the database interface corresponding to the interface type information in the csv file.
10. A device for matching interfaces, characterized in that, It includes: A storage module for extracting database interface information from an interface data table and storing the database interface information in a corresponding storage document, where the storage document is a document determined according to the path identifier in the database interface information; and, in the interface data table, extract the database interface information according to the data structure of the database storage interface information, where the database interface information includes a service identifier, a request method, and a path identifier; store the service identifier, the request method, and the path identifier in a corresponding storage document; A matching module for extracting interface type information from a comma-separated values (csv) file and using the search parameters of the interface type information to match the database interface information in the storage document; And use the search parameters of the interface type information to match the database interface information for accurately querying documents in the storage document by using key-value pair matching; Failed to match the database interface information for accurately querying documents in the storage document by using the search parameters of the interface type information; based on the service identifier, the request method, and the request path of the interface type information, match the database interface information for fuzzy querying documents in the storage document in a list manner; Use the matcher method to match the database interface information for fuzzy querying documents in the storage document in a list manner; After extracting the search parameters of an interface type information, use the search parameters of the interface type information to synchronously match the database interface information in the storage document; After extracting the search parameters of all interface type information, use the search parameters of all interface type information to asynchronously match the database interface information in the storage document; Use the search parameters of the interface type information to match the database interface information in the storage document when receiving and using interface information; A positioning module, configured to position a database interface corresponding to interface type information in the csv file based on a matching result, so as to implement the matching between the csv interface and the database interface.
11. An electronic device with a matching interface, characterized in that, It includes: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-9.
12. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, the method according to any one of claims 1-9 is implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by the processor, the method according to any one of claims 1-9 is implemented.
Citation Information
Patent Citations
Interface testing method and device based on Protobuf
CN113704079A
Commodity list access method and device, equipment, medium and product
CN114185977A