CN114218278A - Data table field query method and system of http interface - Google Patents

Data table field query method and system of http interface Download PDF

Info

Publication number
CN114218278A
CN114218278A CN202111545532.XA CN202111545532A CN114218278A CN 114218278 A CN114218278 A CN 114218278A CN 202111545532 A CN202111545532 A CN 202111545532A CN 114218278 A CN114218278 A CN 114218278A
Authority
CN
China
Prior art keywords
data
returned
query
specified
field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111545532.XA
Other languages
Chinese (zh)
Inventor
张全中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech 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 CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202111545532.XA priority Critical patent/CN114218278A/en
Publication of CN114218278A publication Critical patent/CN114218278A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24564Applying rules; Deductive queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques

Landscapes

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

Abstract

The embodiment of the application provides a data table field query method and system of an http interface. The method comprises the following steps: acquiring query parameters of specified data fields; creating a form to be returned according to a preset structure list creation rule and the query parameters of the specified data fields; acquiring a data form of a corresponding API (application programming interface) of a query request, querying specified data fields in the data form based on query parameters of the specified data fields and the form to be returned, and storing data obtained by querying in the form to be returned; and outputting a character string in a json format based on the form to be returned after data storage is completed, and carrying out service response based on the character string in the json format. The invention simultaneously improves the compiling efficiency and the processing efficiency of the data table field query method.

Description

Data table field query method and system of http interface
Technical Field
The application relates to the technical field of computers, in particular to a data table field query method and a data table field query system of an http interface.
Background
A web server realized by a software programming language can additionally provide an API interface function which can be called by http/https, and the API interface often has such a function requirement, in one case, the data in a certain form can be inquired by calling through the API interface, a plurality of rows of data lists are returned, and each row of data in the form comprises a plurality of columns of data fields; another situation is that while the table data is being queried, the returned data list is filtered for a certain column of data fields, i.e. only the data list with a certain column of fields as a specific data value is queried. Based on the above-mentioned requirements for the filtering query function of the http interface in the web server software system, the data of this specific form is required. In the existing processing method, a specific query table is mainly obtained, then, in each implemented API interface, multi-layer if-else is performed on each different column field, and whether a query target exists is determined layer by layer. Or the method of searching and matching through the switch statement and judging based on the searching and matching result is realized. In the implementation process of the method, a large number of repeated code compiling needs to be carried out on different API interface forms, the code logic of a single form field is overlong, and changes in addition, modification and deletion of the form field involve too many places for code modification, so that the API interface is more inconvenient for later maintenance and updating. This greatly affects both the writing efficiency and the processing efficiency. Aiming at the problem that the existing processing method is low in both writing efficiency and processing efficiency, a new data table field query method of an http interface is urgently needed.
Disclosure of Invention
The embodiment of the application aims to provide a data table field query method and system of an http interface.
In order to achieve the above object, a first aspect of the present application provides a method for querying a data table field of an http interface, including: acquiring query parameters of specified data fields; creating a form to be returned according to a preset structure list creation rule and the query parameters of the specified data fields; acquiring a data form of a corresponding API (application programming interface) of a query request, querying specified data fields in the data form based on query parameters of the specified data fields and the form to be returned, and storing data obtained by querying in the form to be returned; and outputting a character string in a json format based on the form to be returned after data storage is completed, and carrying out service response based on the character string in the json format.
In an embodiment of the present application, the query parameters of the specified data field include: a key-value pair consisting of a name and a corresponding value specifying a data field.
In the embodiment of the application, the form to be returned is defined as a struct data type; the form to be returned comprises a plurality of data field columns, and each data field column is defined as a member variable of the struct data.
In the embodiment of the application, each member variable is provided with a structure label, and the key of the structure label is json and column; wherein json is used for describing the name of each data field in the entity character string; column is used for describing the name of each data field in the data form; wherein each member variable represents a mapping relationship between a name of a data field in an entity string and a name in a data form.
In this embodiment of the present application, before querying, in the data form, the specified data field based on the query parameter of the specified data field and the form to be returned, the method further includes: based on the query parameters of the specified data fields and the form to be returned, the verification of the specified data fields in the data form is carried out, and the verification comprises the following steps: according to the name of the designated data field in the entity character string and the mapping relation, the name of the designated data field in the data form is obtained; comparing the name of the specified data field in the data form with the name of each data column in the data form of the corresponding API interface, and judging whether a matching relation exists or not; if the matching relation does not exist, determining that the specified data field does not exist in the data form of the corresponding API interface, and judging that the specified data field fails to be checked; and if the matching relation exists, outputting a verification success signal of the specified data field.
In this embodiment of the present application, the querying, in the data form, the specified data field based on the query parameter of the specified data field and the form to be returned, and storing data obtained by the querying in the form to be returned includes: responding to a verification success signal, splicing the query parameters of the specified data field and the form to be returned to obtain query structure body parameters; based on the query structure body parameters, querying the specified data fields in the data form to obtain specific data values under the specified data fields; and outputting specific data values under the specified data fields, and storing the specific data values into the form to be returned.
In this embodiment of the present application, outputting a character string in a json format based on a to-be-returned form in which data saving is completed includes: and converting the data in the form to be returned, which completes data storage, into the corresponding character string in the json format according to a preset json character string serialization method.
A second aspect of the present application provides a data table field query system of an http interface, including: the acquisition unit is used for acquiring the query parameters of the specified data fields and acquiring the data form of the corresponding API interface of the query request; a processing unit to: creating a form to be returned according to a preset structure list creation rule and the query parameters of the specified data fields; based on the query parameters of the specified data fields and the form to be returned, querying the specified data fields in the data form, and storing the data obtained by querying in the form to be returned; the output unit is used for outputting character strings in a json format based on the forms to be returned after data storage is finished; and the execution unit is used for carrying out service response based on the character string in the json format.
A third aspect of the present application provides a machine-readable storage medium having stored thereon instructions, which when executed by a processor, cause the processor to be configured to perform the above-mentioned data table field query method of the http interface.
A fourth aspect of the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the above-mentioned method for querying a data table field of an http interface.
According to the technical scheme, when the query requirement is obtained, the form to be returned is constructed according to the specified data field, then whether the data is in the target data form is verified, if the data is verified to be qualified, query data mapping extraction is carried out based on the created return form, and the data obtained by query is stored in the form to be returned. And then carrying out data feedback based on the form to be returned, processing the data in the form to be returned into a character string in a json format, and carrying out service response based on the character string in the json format.
The scheme of the invention provides a query algorithm based on a go language with strong universality, repeated coding is not needed according to different conditions, all query requirements of an http interface can be met by directly utilizing the method, and positive influence is brought to the processing efficiency and the compiling efficiency.
Additional features and advantages of embodiments of the present application will be described in detail in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the embodiments of the disclosure, but are not intended to limit the embodiments of the disclosure. In the drawings:
FIG. 1 is a flow chart schematically illustrating the steps of a data table field query method of an http interface according to an embodiment of the present application;
FIG. 2 schematically illustrates a flow diagram for querying specified data fields according to an embodiment of the present application;
FIG. 3 schematically shows a system architecture diagram of a data table field query system of an http interface according to an embodiment of the present application;
fig. 4 schematically shows an internal structure diagram of a computer device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of 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 should be understood that the specific embodiments described herein are only used for illustrating and explaining the embodiments of the present application and are not used for limiting the embodiments of the present application. 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.
It should be noted that if directional indications (such as up, down, left, right, front, and back … …) are referred to in the embodiments of the present application, the directional indications are only used to explain the relative positional relationship between the components, the movement situation, and the like in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indications are changed accordingly.
In addition, if there is a description of "first", "second", etc. in the embodiments of the present application, the description of "first", "second", etc. is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present application.
A web server realized by a software programming language can additionally provide an API interface function which can be called by http/https, and the API interface often has such a function requirement, in one case, the data in a certain form can be inquired by calling through the API interface, a plurality of rows of data lists are returned, and each row of data in the form comprises a plurality of columns of data fields; another situation is that while the table data is being queried, the returned data list is filtered for a certain column of data fields, i.e. only the data list with a certain column of fields as a specific data value is queried. Based on the above-mentioned requirements for the filtering query function of the http interface in the web server software system, the data of this specific form is required.
In the existing processing method, a specific query table is mainly obtained, then, in each implemented API interface, multi-layer if-else is performed on each different column field, and whether a query target exists is determined layer by layer. Or the method of searching and matching through the switch statement and judging based on the searching and matching result is realized. In the implementation process of the method, a large number of repeated code compiling needs to be carried out on different API interface forms, the code logic of a single form field is overlong, and changes in addition, modification and deletion of the form field involve too many places for code modification, so that the API interface is more inconvenient for later maintenance and updating. This greatly affects both the writing efficiency and the processing efficiency. Therefore, a logic implementation method of the http interface capable of efficiently performing the lookup of the data table field is needed. The present invention is based on this problem and provides a unified and simple logic processing method to solve the above code encoding problem.
For convenience of explanation, the specific embodiments of the present application are described in the implementation of go language, but it should be understood that not only go language, but also any programming language can theoretically implement the method proposed by the present application based on the conceptual process proposed by the present application. The go language is a static strongly typed, compiled language that is similar in syntax to C, but functionally: memory security, GC (garbage collection), structural morphology and CSP-style concurrent computation. The development of go as a new language with only a decade history is quite vigorous and has replaced Python for many applications, such as: processing the cloud log stored at S3; moving TB-level-sized files between buckets and/or regions at S3; the local database records are matched with the files at S3 to ensure that the files are in a synchronized state. The tasks are mostly disposable, so that the operation is more suitable by using the script language, the tasks need to be programmed quickly, the codes are generally abandoned after one time use, generally, the requirements of the tasks are novel and specific, and the codes need to be reused rarely. The go language has the advantages of convenience in compiler, high development speed, better parallelism, simplicity in deployment, consistent style and convenience in tool. The invention creates a logic implementation method of an http interface for implementing the data table field query based on the advantages of the go language.
Fig. 3 schematically shows a system structure of a data table field query system of an http interface according to an embodiment of the present application. As shown in fig. 3, the present application provides a data table field query system of an http interface, including: the acquisition unit is used for acquiring the query parameters of the specified data fields and acquiring the data form of the corresponding API interface of the query request; a processing unit to: creating a form to be returned according to a preset structure list creation rule and the query parameters of the specified data fields; based on the query parameters of the specified data fields and the form to be returned, querying the specified data fields in the data form, and storing the data obtained by querying in the form to be returned; the output unit is used for outputting character strings in a json format based on the forms to be returned after data storage is finished; and the execution unit is used for carrying out service response based on the character string in the json format.
Fig. 1 schematically shows a flow chart of a data table field query method of an http interface according to an embodiment of the present application. As shown in fig. 1, in an embodiment of the present application, a method for querying a data table field of an http interface is provided, which includes the following steps:
step S10: query parameters specifying data fields are obtained.
Specifically, the core purpose of the invention is to realize direct query and extraction of target data table fields, and based on the purpose, the form fields to be queried need to be obtained firstly. In the invention, the method for requesting a page of the API interface of the complete web service comprises the following steps: firstly, calling an API (application programming interface) of a web server side by a client through an http GET (hyper text transport protocol) method, and inquiring a data list under a specified data field value of a specified form; then the Web server receives the http request and enters a code function realized by an API (application program interface) to execute; and then, acquiring the key and the value of the data field of the form needing to be queried in the parameters of the request in the function, and performing data verification on the key and the value of the parameters. If the parameter check fails, the request is returned, and the parameter check passes, and the next step is carried out; then, according to the requested URL and parameters, splicing SQL sentences or methods needing to be subjected to database query to perform query of database data; storing a query result returned by the database into a data structure list defined by the form, converting a json character string serialization method into a json format character string, and finally returning the json format character string to the client through an http response; and finally, the client receives the returned form json data list of the http response, performs form display of the page, and completes one-time page request.
Firstly, a service query request needs to be obtained, a user initiates the service request at the front end, the http interface allocates a corresponding API interface for executing the service based on the service request, and the API interface needs to perform subsequent data query. The query parameters for specifying the data field are obtained according to the query target, and preferably, the query parameters include key-value pairs consisting of the name of the specified data field and the corresponding value, i.e., key and value of the specified data field. In popular terms, the entity language request name initiated by the user needs to be corresponded to the storage language name of the storage back end, and then the data of the back end is called according to the mapping relation. Each data field includes a front name and a back name, and the name of the specified data field obtained at this time is the name of the front.
Step S20: and creating the form to be returned according to a preset structure list creating rule and the query parameter of the specified data field.
Specifically, as is known above, the name of the corresponding data field at the back end needs to be found according to the mapping relationship, and based on the rule, the invention provides a mapping relationship system, that is, a preset structure list creation rule. And for the form fields needing to be inquired, acquiring an API (application programming interface) corresponding to the specific http, and then returning the required form fields through the API. For the form field, it needs to be created as a preset form to be returned. Preferably, the form to be returned is written by a go language, and the form to be returned is set as a struct data type. The form to be returned contains a plurality of form columns, and the form columns are the target set which we want to query. For form column differentiation, the form field of each column is defined as a member variable of struct. In order to represent the form field differentiation of each column, a structure Tag Struct Tag is set for each member variable, and the Struct Tag represents the identity information of the corresponding member variable. The key added with the Tag of the corresponding structural body is json and is used for describing the field name of the form, and the key added with the Tag is column and is used for describing the field name of the database table needing to be inquired. For example, for column field 1, the characterization is:
column field 1 string' json: "name represented in json" column: "name defined in database table".
Step S30: and acquiring a data form of the query request corresponding to the API, querying the specified data field in the data form based on the query parameter of the specified data field and the form to be returned, and storing the data acquired by querying in the form to be returned.
Specifically, according to the requested URL and parameters, the SQL statements or methods that need to be queried by the database are concatenated to obtain the target data table fields, and the target may also be actively specified by the user. In order to define the query target, a name key is set for the query target for subsequent retrieval comparison. Then, a preset query rule is required. As shown in fig. 2, the method comprises the following steps:
step S301: and mapping the structural body label in the form to be returned formed by the corresponding API interface into a map system.
Specifically, firstly, a universal function CheckStructTag is defined, and the entry of the function is interface { } of any defined form to be returned. interface { } type, empty interface, is the source of much confusion. interface { } type is interface without method. Since there are no instances keys, all types implement at least 0 methods, and therefore all types implement null interfaces. This means that if you compose a function with the interface { } value as a parameter, you can provide the function with any value that can represent any defined interface object to be returned to the form. The exit of the function is map [ string ] string, the exit is used for acquiring the entry in the form to be returned, the json value defined in the Tag of each member variable (column field) is the key of the map, and the column value defined in the Tag is the value of the map. The map is a data structure for acquiring the value through the key, the bottom layer storage mode of the map is an array, the key cannot be repeated during storage, when the key is repeated, the value is covered, hash operation is performed through the key (the key can be simply understood as converting the key into a shaping number), then the length of the array is left, the subscript position of the array where the key is stored is obtained, and finally the key and the value are assembled into a structure body and placed at the subscript position of the array.
Step S302: and traversing each member variable in the form to be returned based on the reflection function of the go language, and mapping the structural body label of each member variable to a corresponding key value pair.
Specifically, in the above-mentioned preset generic function checkstructttag, it utilizes the reflex reflection function of go language. Reflection of the go language refers to the ability to access and modify the program itself during program run time. When the program is compiled, the variable is converted into a memory address, and the name of the variable cannot be written into the executable part by the compiler. When running a program, the program cannot acquire its own information. Reflection-supporting languages can integrate reflection information of variables, such as field names, type information, structure information, etc., into an executable file at program compile time and provide an interface for programs to access the reflection information, thus obtaining reflection information of types at program run time and having the ability to modify them. Based on the function, traversing and acquiring json and column information described by the Struct Tag of each member in the reference structure Struct, wherein the json value of the structure label corresponds to the key of the map, and the column value of the structure label corresponds to the value of the map. And storing the key corresponding to the obtained map and the value of the map into a key value pair.
Step S303: a specified data field check is performed.
Specifically, if the specified data field does not exist in the corresponding data form, it is meaningless to perform subsequent data query and extraction, and in order to avoid the influence of such meaningless steps, it is preferable that, when performing the specific data query, the specified data field is checked first. The established mapping relation is that each member variable represents the mapping relation between the name of a data field in an entity string and the name in a form, the name of the specified data field is mapped into the name in a data form based on the mapping relation, and then the name of the specified data field in the data form is compared with the name of each data column in the data form corresponding to the API interface to judge whether a matching relation exists or not; if the matching relation does not exist, the specified data field does not exist in the corresponding form, and the specified data field fails to be checked. If there is a match, then the currently specified data field is present in the data form, and the next step may be performed.
Step S304: and extracting specific query data.
Specifically, if the specified data field is judged to exist in the data form corresponding to the API, the extracted specific query data is filled into the form to be returned.
Step S40: and outputting a character string in a json format based on the form to be returned after data storage is completed, and carrying out service response based on the character string in the json format.
Specifically, the data is serialized into a json character string in a queried data table field, and when the json character string is output, the bold type is output as true, the completion of query is informed, and the user performs subsequent processing based on the json character string sequence. And if the specified data field does not exist in the data form corresponding to the API, outputting a null character string, and then outputting a false type to inform a user of the failure of query.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the data table field query method of the http interface is realized by adjusting kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The embodiment of the application provides a storage medium, wherein a program is stored on the storage medium, and the program realizes the data table field query method of the http interface when being executed by a processor.
An embodiment of the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method for querying a data table field of the http interface is implemented.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 4. The computer apparatus includes a processor a01, a network interface a02, a display screen a04, an input device a05, and a memory (not shown in the figure) connected through a system bus. Wherein processor a01 of the computer device is used to provide computing and control capabilities. The memory of the computer device comprises an internal memory a03 and a non-volatile storage medium a 06. The nonvolatile storage medium a06 stores an operating system B01 and a computer program B02. The internal memory a03 provides an environment for the operation of the operating system B01 and the computer program B02 in the nonvolatile storage medium a 06. The network interface a02 of the computer device is used for communication with an external terminal through a network connection. The computer program when executed by the processor a01 implements a method for table field lookup for an http interface. The display screen a04 of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device a05 of the computer device may be a touch layer covered on the display screen, a button, a trackball or a touch pad arranged on a casing of the computer device, or an external keyboard, a touch pad or a mouse.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
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.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, which include both non-transitory and non-transitory, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A data table field query method of an http interface is characterized by comprising the following steps:
acquiring query parameters of specified data fields;
creating a form to be returned according to a preset structure list creation rule and the query parameters of the specified data fields;
acquiring a data form of a corresponding API (application programming interface) of a query request, querying specified data fields in the data form based on query parameters of the specified data fields and the form to be returned, and storing data obtained by querying in the form to be returned;
and outputting a character string in a json format based on the form to be returned after data storage is completed, and carrying out service response based on the character string in the json format.
2. The method of claim 1, wherein the query parameters specifying the data field comprise: a key-value pair consisting of a name and a corresponding value specifying a data field.
3. The method of claim 2, wherein the form to be returned is defined as a struct data type; the form to be returned comprises a plurality of data field columns, and each data field column is defined as a member variable of the struct data.
4. The method according to claim 3, wherein each member variable is provided with a structure tag, the key of which is json and column;
wherein json is used for describing the name of each data field in the entity character string; column is used for describing the name of each data field in the data form;
wherein each member variable represents a mapping relationship between a name of a data field in an entity string and a name in a data form.
5. The method of claim 4, wherein prior to querying the data form for specified data fields based on query parameters for the specified data fields and the form to be returned, the method further comprises:
based on the query parameters of the specified data fields and the form to be returned, the verification of the specified data fields in the data form is carried out, and the verification comprises the following steps:
according to the name of the designated data field in the entity character string and the mapping relation, the name of the designated data field in the data form is obtained;
comparing the name of the specified data field in the data form with the name of each data column in the data form of the corresponding API interface, and judging whether a matching relation exists or not;
if the matching relation does not exist, determining that the specified data field does not exist in the data form of the corresponding API interface, and judging that the specified data field fails to be checked;
and if the matching relation exists, outputting a verification success signal of the specified data field.
6. The method according to claim 5, wherein the querying the specified data field in the data form based on the query parameter of the specified data field and the form to be returned, and saving the data obtained by the querying in the form to be returned comprises:
responding to a verification success signal, splicing the query parameters of the specified data field and the form to be returned to obtain query structure body parameters;
based on the query structure body parameters, querying the specified data fields in the data form to obtain specific data values under the specified data fields;
and outputting specific data values under the specified data fields, and storing the specific data values into the form to be returned.
7. The method of claim 6, wherein outputting the character string in json format based on the form to be returned for which data saving is completed comprises:
and converting the data in the form to be returned, which completes data storage, into the corresponding character string in the json format according to a preset json character string serialization method.
8. A system for querying fields of a data table of an http interface, the system comprising:
the acquisition unit is used for acquiring the query parameters of the specified data fields and acquiring the data form of the corresponding API interface of the query request;
a processing unit to:
creating a form to be returned according to a preset structure list creation rule and the query parameters of the specified data fields;
based on the query parameters of the specified data fields and the form to be returned, querying the specified data fields in the data form, and storing the data obtained by querying in the form to be returned;
the output unit is used for outputting character strings in a json format based on the forms to be returned after data storage is finished;
and the execution unit is used for carrying out service response based on the character string in the json format.
9. A machine-readable storage medium having instructions stored thereon, which when executed by a processor causes the processor to be configured to perform the data table field query method of the http interface of any one of claims 1 to 7.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the http interface data table field query method of any one of claims 1 to 7.
CN202111545532.XA 2021-12-16 2021-12-16 Data table field query method and system of http interface Pending CN114218278A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111545532.XA CN114218278A (en) 2021-12-16 2021-12-16 Data table field query method and system of http interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111545532.XA CN114218278A (en) 2021-12-16 2021-12-16 Data table field query method and system of http interface

Publications (1)

Publication Number Publication Date
CN114218278A true CN114218278A (en) 2022-03-22

Family

ID=80703230

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111545532.XA Pending CN114218278A (en) 2021-12-16 2021-12-16 Data table field query method and system of http interface

Country Status (1)

Country Link
CN (1) CN114218278A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114942750A (en) * 2022-05-19 2022-08-26 北京金堤科技有限公司 Method and device for processing field of external interface
CN116414899A (en) * 2023-03-14 2023-07-11 中国人民财产保险股份有限公司 Interface interaction method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114942750A (en) * 2022-05-19 2022-08-26 北京金堤科技有限公司 Method and device for processing field of external interface
CN116414899A (en) * 2023-03-14 2023-07-11 中国人民财产保险股份有限公司 Interface interaction method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109964216B (en) Identifying unknown data objects
CN111414350B (en) Service generation method and device
CN106778351B (en) Data desensitization method and device
CN107766130B (en) Method and device for migrating virtual machine to container
CN114218278A (en) Data table field query method and system of http interface
US10635666B2 (en) System, method and device for index compilation to optimize index usage
US9384202B1 (en) Gateway module to access different types of databases
US20150363435A1 (en) Declarative Virtual Data Model Management
EP2951678B1 (en) Remotely executing operations of an application using a schema that provides for executable scripts in a nodal hierarchy
US20120159515A1 (en) Sharing object representations
US11262986B2 (en) Automatic software generation for computer systems
CN115599386A (en) Code generation method, device, equipment and storage medium
CN115080154A (en) Page display method and device, storage medium and electronic equipment
CN110019497B (en) Data reading method and device
US11294901B1 (en) Isolating the performance of functions included in queries
US11855910B2 (en) Configuration management of cloud resources for multiple providers and frameworks
CN111125087A (en) Data storage method and device
CN115357298A (en) Calling method of third-party interface, processor and storage medium
CN110928896A (en) Data query method and device
CN107291439B (en) Target incremental data construction method and device
US11256602B2 (en) Source code file retrieval
Ventocilla Big data programming with Apache spark
CN112445810A (en) Data updating method and device for data warehouse, electronic device and storage medium
CN112749189A (en) Data query method and device
US10120968B1 (en) System and method for hierarchical library searching

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