CN112256772A - Data service method, device and readable storage medium - Google Patents

Data service method, device and readable storage medium Download PDF

Info

Publication number
CN112256772A
CN112256772A CN201910660426.2A CN201910660426A CN112256772A CN 112256772 A CN112256772 A CN 112256772A CN 201910660426 A CN201910660426 A CN 201910660426A CN 112256772 A CN112256772 A CN 112256772A
Authority
CN
China
Prior art keywords
data
field
client
access request
resource access
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
CN201910660426.2A
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910660426.2A priority Critical patent/CN112256772A/en
Publication of CN112256772A publication Critical patent/CN112256772A/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/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • 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/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • 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/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links

Abstract

The embodiment of the invention discloses a data service method, a device and a readable storage medium, wherein the data service method comprises the following steps: receiving a resource access request sent by a client; the determining of the data type of at least one field contained in the resource access request; respectively executing the data analysis functions corresponding to the at least one field according to a mapping relation between a pre-configured data type and the data analysis functions; and aggregating the execution result of the data analysis function corresponding to the at least one field, and feeding back the result to the client. By adopting the embodiment of the invention, the interaction efficiency of the client and the server and the development efficiency of the server can be improved.

Description

Data service method, device and readable storage medium
Technical Field
The present invention relates to the field of computers, and in particular, to a data service method, apparatus, and readable storage medium.
Background
With the popularization of the internet and various mobile terminals, the rapid development of web pages using a Browser/Server (B/S) architecture and mobile applications using a Browser/Server (Client/Server, C/S) architecture, the rapid increase of the number of users and the update of functions lead to the continuous change of front-end interaction, and correspondingly, the synchronous modification of a back-end interface is also required, thereby bringing great challenges to developers.
In general development, two consideration ways exist for the backend service to provide an interface for the front end: one is to design interfaces according to the display of a front-end page, and one interface meets all data required by one page as much as possible; the other is designed from the dimension of the data entity, and one interface only provides information related to one entity. For the first case, the front-end experience is better, and a page only needs to wait for the time of requesting an interface once, but when the page changes, the maintenance cost of the back-end interface is higher, and the compatibility of the new interface and the old interface is a problem that cannot be ignored. For the second case, the interface at the back end is relatively fixed, but the front end often needs one page to request a plurality of interfaces to meet the page display requirement, and the user needs to wait for a long time, so that the user experience is not high.
For example, the following situation often occurs in a practical application scenario: the client needs to display a list of game names, and the servable end uses the same set of interfaces for being compatible with a Personal Computer (PC) end and a mobile end, so that various (useless) information such as detailed playing methods, updating time, creators and the like of the game can be returned together, and information redundancy is caused; for another example, when the client needs to display information of multiple entities of the game, such as detailed playing methods, update time, creators, and the like, one interface of the servable end only provides information related to one entity, and thus multiple interfaces need to be requested, resulting in slow response speed and poor user experience.
Disclosure of Invention
Embodiments of the present invention provide a data service method, an apparatus, and a readable storage medium, which can improve interaction efficiency between a client and a server and development efficiency of the server.
An embodiment of the present invention provides a data service method, including:
receiving a resource access request sent by a client;
the determining of the data type of at least one field contained in the resource access request;
respectively executing the data analysis functions corresponding to the at least one field according to a mapping relation between a pre-configured data type and the data analysis functions;
and aggregating the execution result of the data analysis function corresponding to the at least one field, and feeding back the result to the client.
Before receiving a resource access request sent by a client, the method includes:
the method comprises the steps of obtaining a plurality of fields in a service database, and receiving configuration information of the fields, wherein the configuration information comprises a data type of each field and a data analysis function of each data type.
Wherein the determining the data type of at least one field included in the resource access request comprises:
the parsing of at least one field contained in the resource access request;
and determining the data types corresponding to the at least one field according to the data types pre-configured for the fields.
Wherein a target field in the at least one field carries a parameter; the executing the data analysis function corresponding to the at least one field according to the mapping relationship between the pre-configured data type and the data analysis function respectively includes:
determining a target data analysis function corresponding to the target field according to a mapping relation between a preset data type and a data analysis function;
and transmitting the parameters carried by the target field to the target data analysis function for execution.
Wherein the aggregating the execution result of the data parsing function corresponding to the at least one field and feeding back the result to the client includes:
the determining a hierarchical nesting relationship of fields contained in the resource access request;
and aggregating the execution results of the data analysis functions corresponding to the at least one field according to the hierarchy nesting relation, and feeding back the aggregated execution results to the client.
The resource access request is an access request aiming at a uniform access address.
Wherein the client comprises a testing client; the resource access request is simulation object test data sent by the test client.
Another aspect of an embodiment of the present invention provides a data service apparatus, including:
the receiving module is used for receiving a resource access request sent by a client;
a determining module, configured to determine a data type of at least one field included in the resource access request;
the execution module is used for respectively executing the data analysis functions corresponding to the at least one field according to the mapping relation between the pre-configured data types and the data analysis functions;
and the aggregation module is used for aggregating the execution result of the data analysis function corresponding to the at least one field and feeding the result back to the client.
Wherein, the device still includes:
the configuration module is used for acquiring a plurality of fields in a service database and receiving configuration information of the fields, wherein the configuration information comprises the data type of each field and the data analysis function of each data type.
Wherein the determining module is specifically configured to:
analyzing at least one field contained in the resource access request;
and determining the data types respectively corresponding to the at least one field according to the data types pre-configured to the fields.
Wherein a target field in the at least one field carries a parameter; the execution module is specifically configured to:
determining a target data analysis function corresponding to the target field according to a mapping relation between a preset data type and a data analysis function;
and transmitting the parameters carried by the target field to the target data analysis function for execution.
Wherein the aggregation module is specifically configured to:
determining a hierarchical nesting relationship of fields contained in the resource access request;
and aggregating the execution results of the data analysis functions corresponding to the at least one field according to the hierarchy nesting relation, and feeding back the aggregated execution results to the client.
The resource access request is an access request aiming at a uniform access address.
Wherein the client comprises a testing client; the resource access request is simulation object test data sent by the test client.
Another aspect of an embodiment of the present invention provides a server, including: a processor and a memory;
the processor is connected to a memory, wherein the memory is used for storing a computer program, and the processor is used for calling the computer program to execute the method executed in one aspect of the embodiment of the invention.
Another aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, the computer program includes program instructions, which when executed by a processor, perform the method as described in one aspect of the present invention.
In the embodiment of the invention, after a resource access request sent by a client is received, the data type of at least one field contained in the resource access request is determined, and then data analysis functions corresponding to the at least one field are determined and executed respectively according to the mapping relation between the pre-configured data type and the data analysis functions; and finally aggregating the execution result of the data analysis function corresponding to the at least one field, and feeding back the result to the client. As can be seen from the above, in the embodiment of the present invention, after receiving a resource access request from a client, fields included in the request are first analyzed, and corresponding data analysis functions are respectively executed according to data types of the fields, that is, a fine-grained split is performed on each request field in the resource access request, and then the data analysis function corresponding to each query field is executed, and then corresponding execution results are aggregated, so that redundancy of request results can be avoided; and no matter how the resource access request of the client changes, the embodiment of the invention respectively executes the pre-configured data analysis function on each field in the request, so that a plurality of interfaces are not required to be requested, and a back-end interface is not required to be modified, thereby greatly improving the query and development efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of a network architecture according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a data service method according to an embodiment of the present invention.
Fig. 3 is a table showing relationships among fields, data types, and data parsing functions according to an embodiment of the present invention.
Fig. 4 is a schematic diagram of another data service method provided in the embodiment of the present invention.
Fig. 5a is a schematic diagram of adding and deleting a service database through a management interface according to an embodiment of the present invention.
Fig. 5b is a schematic diagram of adding and deleting data types through a management interface according to an embodiment of the present invention.
Fig. 5c is a schematic diagram of adding a delete data parsing function through a management interface according to an embodiment of the present invention.
Fig. 5d is a schematic diagram of binding a data type and a data parsing function through a management interface according to an embodiment of the present invention.
Fig. 6 is a schematic structural diagram of a data service device according to an embodiment of the present invention.
Fig. 7 is a schematic structural diagram of another data service device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram of a network architecture according to an embodiment of the present invention. The network architecture may include a plurality of clients and at least one server (as shown in fig. 1, specifically including a client 100a, a client 100b, a client 100c, and a server 200), where the server 200 may perform data transmission with each client through a network, and each client may initiate a resource access request (for example, an http request such as a web browsing request, a shopping request, and a search request sent by a user at a front end) to the server 200 through a browser, a terminal Application (APP), and the like. The client 100a, 100b or 100c in the present application may include a mobile phone, a tablet computer, a notebook computer, a palm computer, a Mobile Internet Device (MID), a wearable device (e.g., a smart watch, a smart band, etc.). The server 200 in the present application may be a backend server, a service device, a cloud server, and the like, for example, the server 200 may be a graph ql-based server 200, and the server 200 may respond to a resource access request initiated by the client 100a, 100b, or 100c through a graph ql interface service, and feed back a request result. The graph ql is an Application Programming Interface (API) interaction specification, which is essentially an API-based query language and can be used to implement the interaction between a client and a server API. When a client 100a, 100b or 100c obtains data from the server 200 through a resource query request, the data may be stored in a database of the server 200, and it is the responsibility of the API to provide an interface for storing the data that matches the resource query request. While graph ql is based on a layer of encapsulation above the API, i.e., queries against the API. The server 200 in the present application, in combination with any data service method in the present application, can more accurately understand the resource query request of the client based on the GraphQL service, and accurately obtain data corresponding to the resource query request, thereby being more flexibly applicable to the demand change of the service. That is, the server 200 can process data interaction between the front end and the back end by using the GraphQL service, and as the server, it should have the function of a general server, and the function of the server is different according to the type of the server. For example, the server 200 is a file server, a database server, a World Wide Web (World Wide Web) server, an application server, and the like, which can provide the GraphQL service, and this is not particularly limited in this embodiment of the present invention.
Fig. 2 is a schematic flow chart of a data service method according to an embodiment of the present invention. The method may be applied to the system architecture in fig. 1, and will be described below with reference to fig. 2, taking an execution subject as a server, from an interaction side of the server and a client, where the method may include the following steps:
step S101, the server receives a resource access request sent by the client.
Specifically, a server (which may correspond to the server 200 in the embodiment corresponding to fig. 1, for example, a GraphQL server) receives a resource access request sent by a client (which may correspond to the client 100a, the client 100b, or the client 100c in the embodiment corresponding to fig. 1). According to the difference of the service types of the graph ql service end, the types of the resource access requests sent by the corresponding clients are also different, for example, when the service or service content provided by the graph ql service end is a data retrieval type, the corresponding client can be a search engine, and the resource access request sent by the corresponding client can be a search for a certain keyword or content; when the service or service provided by the GraphQL server is a shopping type, the corresponding client may be a shopping Application (APP), and the resource access request sent by the client may be a purchase request or payment request for one or more commodities; when the service or service provided by the graph ql server is a video service type, the corresponding client may be a video playing APP, and the resource access request correspondingly sent by the client may be a playing request for a certain movie or tv series.
Step S102, determining the data type of at least one field contained in the resource access request.
Specifically, the graph ql server parses a query field (may be referred to as fields for short) included in the resource access request, as shown in fig. 3, fig. 3 is a relationship table of a field, a data type, and a data parsing function provided in the embodiment of the present invention, for example, the query field includes an english character id (for example, an id indicating a user), a name (for example, indicating a user name), and a desc (for example, indicating description information of the user), and after the field is included in the resource access request through parsing, the data types corresponding to the field are further determined according to attribute information of the field pre-selected and set by the server, for example, the data type of the field id is INT (basic shaping), the data type of the field name is VARCHAR (variable length string type), and the data type of the field desc is VARCHAR. These fields and the corresponding data Type (which may be referred to as Type) need to be configured in advance before the GraphQL server receives the resource access request sent by the client. In this way, whatever field is included in the resource access request sent by the client can be found in the preconfigured mapping information. It will be appreciated that the type of resource access request will vary, as will the request fields contained in the request. For example, when the request is a search for a certain keyword or content, then the field contained in the request may be at least one keyword; when the request is a purchase request or a payment request for at least one commodity, the fields contained in the request may be the name, code, quantity, price, etc. of the at least one commodity; when the request is a play request for a certain movie or a tv show, the fields included in the request may be a movie name, definition, play mode, and the like, and so on, which will not be described herein again.
Step S103, respectively executing the data analysis functions corresponding to the at least one field according to the mapping relation between the pre-configured data types and the data analysis functions.
Specifically, before the graph ql server receives the resource access request sent by the client, based on the service provided by the server, data parsing functions corresponding to various data types (types) are deployed on the graph ql server, which may also be referred to as a parser (Resolver), a data parser or a data processor, and the like. For example, the GraphQL server may write and store configuration information of the relevant field at the beginning of building a service, or the GraphQL server may receive the data type of the field configured by the developer or the user and the corresponding data parsing function through a management interface of the server, and may be continuously updated according to the requirements. After confirming the fields required to be queried in the resource access request sent by the client, the graph QL server determines the data analysis function corresponding to each query field according to the data type of the fields and the mapping relation between the pre-configured data type and the data analysis function, and executes the data analysis functions respectively. For example, different data types may have different corresponding query or operation modes due to different data types, and different data types may have some other filtering (such as removing ending spaces), format change (such as capitalization of first characters), and the like besides different query modes, so in the embodiment of the present invention, it is necessary to execute the corresponding data parsing functions for fields of different data types.
And step S104, aggregating the execution result of the data analysis function corresponding to the at least one field, and feeding back the result to the client.
Specifically, the graph ql server performs aggregation according to a result executed by the data analysis function corresponding to each field, and feeds back the aggregated result to the client, so that the graph ql server completes a response to the resource access request sent by the client through a series of operations such as analysis, execution, aggregation, feedback, and the like, and the user side can view or receive the corresponding response result through the client. For example, a user searching for a keyword gets all relevant content on the client for that keyword; the user who buys the commodity can check corresponding purchase information, payment information and the like on the client; a user requesting to play a certain movie can play the corresponding movie in the corresponding definition and play mode through the client, and so on, which is not described herein again.
After receiving a resource access request sent by a client, a graph QL server in the embodiment of the invention firstly determines the data type of at least one field contained in the resource access request, and then determines and respectively executes data analysis functions corresponding to the at least one field according to a mapping relation between the pre-configured data type and the data analysis functions; and finally aggregating the execution result of the data analysis function corresponding to the at least one field, and feeding back the result to the client. As can be seen from the above, after receiving a resource access request from a client, the GraphQL server first parses fields included in the request, and respectively executes corresponding data parsing functions according to the data types of the fields, that is, performs fine-grained splitting on each request field in the resource access request to further execute the data parsing function corresponding to each query field, and then aggregates corresponding execution results, thereby avoiding redundancy of the request results; and no matter how the resource access request of the client changes, the graph ql server in the embodiment of the present invention respectively executes the preconfigured data parsing function on each field in the request, so that there is no need to request multiple interfaces or modify a backend interface, and query and development efficiency is greatly improved.
Fig. 4 is a schematic flow chart of another data service method according to an embodiment of the present invention. The method may be applied to the system architecture in fig. 1, and will be described below with reference to fig. 4 by taking an execution subject as a server, where the execution subject is an interaction side between the server and a client, as shown in fig. 4, the method may include the following steps:
step S201, acquiring a plurality of fields in the service database, and receiving configuration information of the plurality of fields.
Specifically, before providing a service, the graph ql server needs to obtain all the fields that may be accessed in the corresponding service database according to the service type provided by the graph ql server, and then the graph ql server may receive configuration information of the fields through the management interface, where the configuration information includes a data type of each field and a data parsing function of each data type. Namely, before the GraphQL server provides the relevant service, relevant parameters need to be configured, and a relevant platform architecture is built, so as to establish the relevant service. The management interface may be a configuration tool provided for a developer or a user on the graph ql server, that is, the developer or the user uploads configuration information of a plurality of fields in the service database to the graph ql server through the management interface, and the graph ql server receives and stores the configuration information. For example, the method can include the following processes that 1, a GraphQL server is connected with a project database, data stored in the early stage are obtained, and data are added; 2. the GraphQL server is connected with a service database, and a service database field is obtained for the project database to use; 3. the GraphQL server side is respectively configured with a data type and a data parser and mounts the data parser for the data type; 4. the method comprises the steps that a GraphQL server generates service from an incoming data type and a data parser to an apolo-server, wherein the apolo-server is a web middleware for constructing the GraphQL server on node.js (a back-end development language); 5. the GraphQL server automatically generates a framework deployment service to the server through a Common Gateway Interface (CGI); 6. and finally generating and calling an interface on the GraphQL server side, and the like.
As shown in fig. 5a, fig. 5a is a schematic view of adding and deleting a service database through a management interface according to an embodiment of the present invention, and a developer or a user may add a service database to be configured through the management interface of the GraphQL server, as shown in fig. 5a, the name of the service database is asn _ private _ test (for example, the name is custom).
As shown in fig. 5b, fig. 5b is a schematic diagram of adding and deleting data types through a management interface according to an embodiment of the present invention, a developer or a user may obtain a field in the service data through a management interface of a graph ql server, and add a data type to the field, as shown in fig. 5b, a data type configured in a field e1 is String, a data type configured in a field hello (for example, any name customized by the user) is String, a data type configured in a field asdfas (for example, any name customized by the user) is Boolean, and the like, which is not described herein again.
As shown in fig. 5c, fig. 5c is a schematic diagram of adding a delete data parsing function through a management interface according to an embodiment of the present invention, and a developer or a user may add a data parsing function for a certain data type through the management interface of the GraphQL server, for example, the data parsing function may be a function customized or written by the developer or the user.
As shown in fig. 5d, fig. 5d is a schematic diagram of binding data types and data parsing functions through a management interface according to an embodiment of the present invention, a developer or a user may bind the configured data parsing functions for a certain data type through a management interface of a GraphQL server, for example, binding data parsing functions auth (user authentication function) and getUserName (get username function) for the data type String, and the data type of a field e1 (e.g., any name customized by the user) in fig. 5b is String, it can be understood that when a resource access request of a client includes the field e1, the GraphQL server triggers execution of the data parsing functions including the auth and getUserName.
It is understood that a field corresponds to a data type, and a data type may correspond to at least one data parsing function, depending on the actual processing requirements.
Step S202, at least one field contained in the resource access request is analyzed.
Step S203, determining the data types corresponding to the at least one field according to the data types pre-configured for the fields.
Specifically, the steps S202 to S203 may specifically refer to the related description of the step S102 in fig. 2, and are not repeated herein.
Step S204, determining a target data analysis function corresponding to the target field according to a mapping relation between a preset data type and a data analysis function.
Step S205, transferring the parameters carried by the target field to the target data parsing function for execution.
Specifically, in step S204 and step S205, when some or all of the fields in the resource access request are fields carrying parameter types, the parameters need to be transferred to the corresponding parsing function for execution, so as to obtain the corresponding execution result. For example, the graph ql server is a microblog server, the client is a microblog client on the mobile phone of the user, when the resource access request submitted by the user is 'inquiring the contents of the microblogs sent by all users with the' king 'word in the microblog names', the fields (fields) in the request may include microblog name (name), pacing time (time), pacing content (desc), etc., and the corresponding data types (types) are VARCHAR (variable length string), datetime (date Type), VARCHAR (variable length string), the data analysis functions corresponding to the field microblog name carrying parameter 'king' field posting time carrying parameter 'today' are respectively an analysis function for VARCHAR (parameter 'king' needs to be introduced), a data analysis function for datetime (parameter 'today' needs to be introduced), and a data analysis function for VARCHAR (no parameter).
Step S206, determining the hierarchical nesting relation of the fields contained in the resource access request.
Specifically, the graph ql server determines a hierarchical nesting relationship of fields included in the resource access request, that is, when the resource access request includes a plurality of fields and the fields have different hierarchical relationships, the graph ql server needs to determine a hierarchical nesting relationship corresponding to the field, so that the graph ql server is used when a subsequent aggregation function executes a result.
Step S207, aggregating the execution results of the data analysis functions corresponding to the at least one field according to the hierarchical nesting relationship, and feeding back the aggregated execution results to the client.
Specifically, the graph ql server aggregates the execution results according to the hierarchical nesting relationship among the fields, and feeds back the aggregated results to the client, so as to satisfy different forms of resource access requests of the client.
Optionally, the resource access request is an access request for a unified access address. Namely, the resource access requests sent by different clients and the different resource access requests sent by the same client are both access requests for the uniform access address. That is, the GraphQL server only needs to use one access address (e.g., an end point link), and then can distinguish different Resource access requests according to the difference of fields, parameters, and the like in the Resource access request, so in the embodiment of the present invention, it is not necessary to distinguish resources by Uniform Resource Identifiers (URIs), thereby avoiding a series of problems caused by that different Resource access requests need to correspond to different URIs due to distinguishing resources by URIs.
Optionally, the client includes a testing client; the resource access request is simulation object test data sent by the test client. For example, the mock object test data is mock test data, wherein the mock test refers to a test method which is created by using a virtual object for testing some objects which are not easy to construct or easily obtain in the test process. The GraphQL server in the embodiment of the invention can also test the test data in the above way, i.e. the corresponding interface does not need to be rewritten for mock test data, and the effect that the interface can be reused can be achieved.
In the embodiment of the invention, after receiving a resource access request of a client, a GraphQL server firstly analyzes fields contained in the request, and respectively executes corresponding data analysis functions according to the data types of the fields, namely, each request field in the resource access request is subjected to fine-grained splitting so as to execute the data analysis function corresponding to each query field, and then corresponding execution results are aggregated, so that the redundancy of the request results can be avoided; and no matter how the resource access request of the client changes, the graph ql server in the embodiment of the present invention respectively executes the preconfigured data parsing function on each field in the request, so that there is no need to request multiple interfaces or modify a backend interface, and query and development efficiency is greatly improved.
Fig. 6 is a schematic structural diagram of a data service device according to an embodiment of the present invention. As shown in fig. 6, the data service apparatus 10 may be applied to the server 200 in the embodiment corresponding to fig. 2, and the apparatus 10 may include a receiving module 101, a determining module 102, an executing module 103, and an aggregating module 104.
A receiving module 101, configured to receive a resource access request sent by a client;
a determining module 102, configured to determine a data type of at least one field included in the resource access request;
the execution module 103 is configured to execute the data analysis functions corresponding to the at least one field according to a mapping relationship between a preconfigured data type and the data analysis function;
and the aggregation module 104 is configured to aggregate the execution result of the data analysis function corresponding to the at least one field, and feed back the result to the client.
For specific functional implementation manners of the receiving module 101, the determining module 102, the executing module 103, and the aggregating module 104, reference may be made to steps S101 to S104 in the embodiment corresponding to fig. 2, which is not described herein again.
Referring to fig. 6, the data service apparatus 10 may further include:
a configuration module 105, configured to obtain a plurality of fields in a service database, and receive configuration information of the plurality of fields, where the configuration information includes a data type of each field and a data parsing function of each data type;
the specific functional implementation manner of the configuration module 105 may refer to step S201 in the embodiment corresponding to fig. 4, which is not described herein again.
Referring to fig. 6, the determining module 102 is specifically configured to:
analyzing at least one field contained in the resource access request;
and determining the data types respectively corresponding to the at least one field according to the data types pre-configured to the fields.
The specific functional implementation manner of the determining module 102 may refer to step S202 and step S203 in the embodiment corresponding to fig. 4, which is not described herein again.
Referring to fig. 6, a target field of the at least one field carries a parameter; the execution module 103 is specifically configured to:
determining a target data analysis function corresponding to the target field according to a mapping relation between a preset data type and a data analysis function;
and transmitting the parameters carried by the target field to the target data analysis function for execution.
The specific implementation manner of the function of the execution module 103 may refer to step S204 and step S205 in the embodiment corresponding to fig. 4, which is not described herein again.
Referring to fig. 6, the aggregation module 104 is specifically configured to:
determining a hierarchical nesting relationship of fields contained in the resource access request;
and aggregating the execution results of the data analysis functions corresponding to the at least one field according to the hierarchy nesting relation, and feeding back the aggregated execution results to the client.
The specific functional implementation manner of the aggregation module 104 may refer to step S206 and step S207 in the embodiment corresponding to fig. 4, which is not described herein again.
Optionally, the resource access request is an access request for a unified access address. Specifically, please refer to the related description in the embodiment corresponding to fig. 4, which is not repeated herein.
Optionally, the client includes a testing client; the resource access request is simulation object test data sent by the test client. Specifically, please refer to the related description in the embodiment corresponding to fig. 4, which is not repeated herein.
Referring to fig. 7, fig. 7 is a schematic structural diagram of another data service device according to an embodiment of the present invention. As shown in fig. 7, the data service apparatus 1000 may correspond to the GraphQL server 200 in the embodiment corresponding to fig. 2, and the data service apparatus 1000 may include: the processor 1001, the network interface 1004, and the memory 1005, and the data service apparatus 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display (Display) and a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a standard wireless interface, for example, a developer or a user may add or delete related configuration information using a management interface function in the user interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1004 may be a high-speed RAM memory or a non-volatile memory (e.g., at least one disk memory). The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 6, a memory 1005, which is a kind of computer-readable storage medium, may include therein an operating system, a network communication module, a user interface module, and a device control application program.
In the data service apparatus 1000 shown in fig. 7, the network interface 1004 may provide a network communication function; the user interface 1003 is an interface for providing a user with input; the processor 1001 may be configured to call a device control application stored in the memory 1005, so as to implement the description of the data service method in the embodiment corresponding to any one of fig. 2 and fig. 4, which is not described herein again. In addition, the beneficial effects of the same method are not described in detail.
It should be understood that the data service apparatus 1000 described in the embodiment of the present invention may perform the description of the data service method in the embodiment corresponding to any one of fig. 2 and fig. 4, which is not described herein again. In addition, the beneficial effects of the same method are not described in detail.
Further, here, it is to be noted that: an embodiment of the present invention further provides a computer-readable storage medium, where the computer program executed by the data service apparatus 1000 is stored in the computer-readable storage medium, and the computer program includes program instructions, and when the processor executes the program instructions, the description of the data service method in any one of the embodiments corresponding to fig. 2 and fig. 4 can be executed, so that details are not repeated here. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present invention, reference is made to the description of the method embodiments of the present invention.
Further, here, it is to be noted that: an embodiment of the present invention further provides a computer-readable storage medium, where the computer program executed by the data service apparatus 1000 is stored in the computer-readable storage medium, and the computer program includes program instructions, and when the processor executes the program instructions, the description of the data service method in any one of the embodiments corresponding to fig. 2 and fig. 4 can be executed, so that details are not repeated here. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present invention, reference is made to the description of the method embodiments of the present invention.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.

Claims (10)

1. A data service method, comprising:
receiving a resource access request sent by a client, and determining the data type of at least one field contained in the resource access request;
respectively executing the data analysis function corresponding to the at least one field according to a mapping relation between a preset data type and the data analysis function;
and aggregating the execution result of the data analysis function corresponding to the at least one field, and feeding back the result to the client.
2. The method of claim 1, wherein before receiving the resource access request sent by the client, the method comprises:
the method comprises the steps of obtaining a plurality of fields in a service database, and receiving configuration information of the fields, wherein the configuration information comprises a data type of each field and a data analysis function of each data type.
3. The method of claim 1, wherein determining the data type of the at least one field included in the resource access request comprises:
analyzing at least one field contained in the resource access request;
and determining the data types respectively corresponding to the at least one field according to the data types pre-configured to the fields.
4. The method of claim 1, wherein a target field of the at least one field carries a parameter; the executing the data analysis function corresponding to the at least one field according to the mapping relationship between the pre-configured data type and the data analysis function respectively includes:
determining a target data analysis function corresponding to the target field according to a mapping relation between a preset data type and a data analysis function;
and transmitting the parameters carried by the target field to the target data analysis function for execution.
5. The method according to claim 1, wherein the aggregating the execution result of the data parsing function corresponding to the at least one field and feeding back the result to the client comprises:
determining a hierarchical nesting relationship of fields contained in the resource access request;
and aggregating the execution results of the data analysis functions corresponding to the at least one field according to the hierarchy nesting relation, and feeding back the aggregated execution results to the client.
6. The method according to any one of claims 1 to 5, wherein the resource access request is an access request for a uniform access address.
7. The method of any of claims 1-5, wherein the client comprises a testing client; the resource access request is simulation object test data sent by the test client.
8. A data service apparatus, comprising:
the receiving module is used for receiving a resource access request sent by a client;
a determining module, configured to determine a data type of at least one field included in the resource access request;
the execution module is used for respectively executing the data analysis functions corresponding to the at least one field according to the mapping relation between the pre-configured data types and the data analysis functions;
and the aggregation module is used for aggregating the execution result of the data analysis function corresponding to the at least one field and feeding the result back to the client.
9. A server, comprising: a processor and a memory;
the processor is connected to a memory, wherein the memory is used for storing a computer program, and the processor is used for calling the computer program to execute the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions which, when executed by a processor, perform the method according to any one of claims 1-7.
CN201910660426.2A 2019-07-22 2019-07-22 Data service method, device and readable storage medium Pending CN112256772A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910660426.2A CN112256772A (en) 2019-07-22 2019-07-22 Data service method, device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910660426.2A CN112256772A (en) 2019-07-22 2019-07-22 Data service method, device and readable storage medium

Publications (1)

Publication Number Publication Date
CN112256772A true CN112256772A (en) 2021-01-22

Family

ID=74223918

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910660426.2A Pending CN112256772A (en) 2019-07-22 2019-07-22 Data service method, device and readable storage medium

Country Status (1)

Country Link
CN (1) CN112256772A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112925557A (en) * 2021-01-28 2021-06-08 长沙市到家悠享网络科技有限公司 Container assembly, processing method and computing equipment
CN113127928A (en) * 2021-04-29 2021-07-16 山东英信计算机技术有限公司 Database data access method and device, electronic equipment and medium
CN114629972A (en) * 2022-03-21 2022-06-14 中国科学院计算机网络信息中心 Data message processing method and device
CN114785774A (en) * 2022-06-17 2022-07-22 昆仑智汇数据科技(北京)有限公司 Data transmission method, device and equipment

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112925557A (en) * 2021-01-28 2021-06-08 长沙市到家悠享网络科技有限公司 Container assembly, processing method and computing equipment
CN112925557B (en) * 2021-01-28 2023-09-05 长沙市到家悠享网络科技有限公司 Data processing device, method and computing equipment
CN113127928A (en) * 2021-04-29 2021-07-16 山东英信计算机技术有限公司 Database data access method and device, electronic equipment and medium
CN114629972A (en) * 2022-03-21 2022-06-14 中国科学院计算机网络信息中心 Data message processing method and device
CN114629972B (en) * 2022-03-21 2024-03-22 中国科学院计算机网络信息中心 Data message processing method and device
CN114785774A (en) * 2022-06-17 2022-07-22 昆仑智汇数据科技(北京)有限公司 Data transmission method, device and equipment

Similar Documents

Publication Publication Date Title
JP4398462B2 (en) Method and system for improving the presentation of HTML pages on web devices
JP6761112B2 (en) Methods and systems for server-side rendering of native content for presentation
US10839038B2 (en) Generating configuration information for obtaining web resources
CN112256772A (en) Data service method, device and readable storage medium
US20080288477A1 (en) Method and system of generating an aggregate website search database using smart indexes for searching
CN108846753B (en) Method and apparatus for processing data
CN111414407A (en) Data query method and device of database, computer equipment and storage medium
US20150012533A1 (en) Method and client device for accessing webpage
WO2021203918A1 (en) Method for processing model parameters, and apparatus
CN112394932A (en) Automatic browser webpage skin changing method and device
AU2016101498B4 (en) Data Interchange System
CN108959294B (en) Method and device for accessing search engine
CN113326418A (en) Method and device for determining webpage information source and webpage quality
CN112988311A (en) On-line experimental method based on WEB server
CN113760948A (en) Data query method and device
CN113568923A (en) Method and device for querying data in database, storage medium and electronic equipment
PH12015500034B1 (en) A web browser operation method and system
CN111680247A (en) Local calling method, device, equipment and storage medium of webpage character string
CN116048517A (en) API (application program interface) generating method, system and device based on B/S (browser/Server) architecture application system
US20220229858A1 (en) Multi-cloud object store access
CN115061785A (en) Information issuing method and device, storage medium and server
WO2021120913A1 (en) Application loading method, device, user terminal and server
CN105589870B (en) Method and system for filtering webpage advertisements
US10114864B1 (en) List element query support and processing
CN114936050B (en) Access request processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination