CN111427571A - Data verification method and device - Google Patents
Data verification method and device Download PDFInfo
- Publication number
- CN111427571A CN111427571A CN202010181377.7A CN202010181377A CN111427571A CN 111427571 A CN111427571 A CN 111427571A CN 202010181377 A CN202010181377 A CN 202010181377A CN 111427571 A CN111427571 A CN 111427571A
- Authority
- CN
- China
- Prior art keywords
- verified
- verification
- rule
- data
- check
- 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.)
- Withdrawn
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/36—Software reuse
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a data verification method, which comprises the following steps: reading data to be verified, wherein the data to be verified comprises one or more objects to be verified; respectively matching each object to be verified from a preset verification rule set to obtain a verification rule corresponding to the object to be verified; the preset check rule set comprises a plurality of objects and check rules corresponding to the objects; and respectively executing the verification of the object to be verified according to the verification rule corresponding to each object to be verified. The invention also discloses a data checking device.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a flexibly configurable data verification method, device, storage medium, and electronic device.
Background
Data verification is a necessary step in various application systems, and besides basic data format verification, complex business logic verification also exists everywhere in codes. In the application of data input/output/import/export, data verification is also an essential link.
in the prior art, for a data import and export link, data correlation verification is mainly completed at a server, and related schemes such as Apache common Validator based on XM L verification and Hibernate valid based on JSR303 exist in prior art frameworks.
Therefore, a lightweight, low coupling data verification scheme is urgently needed.
Disclosure of Invention
In order to solve the technical problem, the invention provides a data verification method and a data verification device, which are realized in a configuration mode by coupling the verification logic originally required to be coupled into a code, thereby reducing module coupling and improving reusability of each independent verification function.
The embodiment of the invention provides a data checking method, which comprises the following steps,
Reading data to be verified, wherein the data to be verified comprises one or more objects to be verified;
Respectively matching each object to be verified from a preset verification rule set to obtain a verification rule corresponding to the object to be verified; the preset check rule set comprises a plurality of objects and check rules corresponding to the objects;
And respectively executing the verification of the object to be verified according to the verification rule corresponding to each object to be verified.
The embodiment of the invention also provides a data checking device, which comprises,
The device comprises a to-be-verified data acquisition module, a verification module and a verification module, wherein the to-be-verified data acquisition module is configured to read data to be verified, and the data to be verified comprises one or more to-be-verified objects;
The verification rule obtaining module is configured to respectively match each object to be verified from a preset verification rule set to obtain a verification rule corresponding to the object to be verified; the preset check rule set comprises a plurality of objects and check rules corresponding to the objects;
And the checking module is configured to execute the checking of the object to be checked according to the checking rule corresponding to each object to be checked.
The embodiment of the invention also provides a storage medium, wherein a computer program is stored in the storage medium, and the computer program is set to execute the data verification method when running.
The embodiment of the present invention further provides an electronic device, which includes a memory and a processor, and is characterized in that the memory stores a computer program, and the processor is configured to run the computer program to execute the above data checking method.
Drawings
Fig. 1 is a flowchart of a data verification method according to the first and second embodiments;
Fig. 2 is a structural diagram of a data verification apparatus according to a third embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
Example one
The embodiment of the invention provides a data verification method, the main flow of which is shown in fig. 1, and the method comprises the following steps:
Step 101: reading data to be verified, wherein the data to be verified comprises one or more objects to be verified;
Step 102: respectively matching each object to be verified from a preset verification rule set to obtain a verification rule corresponding to the object to be verified;
Step 103: and respectively executing the verification of the object to be verified according to the verification rule corresponding to each object to be verified.
Optionally, the obtaining, from a preset check rule set, a check rule corresponding to each object to be checked by matching for the object to be checked respectively includes:
And matching from the preset check rule set according to the keywords of the object to be checked to obtain a check rule corresponding to the object to be checked.
Optionally, the performing data verification on the object to be verified according to the verification rule of the object to be verified includes:
When more than one check rule is corresponding to the object to be checked, the check of the object to be checked is executed according to each check rule corresponding to the object to be checked in sequence according to the sequence of the more than one rule in a preset check rule set.
Optionally, in the process of sequentially performing verification of the object to be verified according to each verification rule corresponding to the object to be verified, when the verification performed according to any verification rule fails, it is determined that the verification result of the object to be verified is failure.
Optionally, after determining that the data verification result of the object to be verified is a failure, the method further includes:
Recording failure information, wherein the failure information at least comprises: the object to be verified and a verification rule for the object to be verified to be failed in verification are executed.
Optionally, wherein the verification rule is a function of performing a verification function;
The executing the data verification of the object to be verified according to the verification rule of the object to be verified comprises the following steps:
And calling a function corresponding to the verification rule to obtain an execution result of the function.
Example two
An embodiment of the present invention provides a data verification method, a main flow of which is also shown in fig. 1, including:
Step 101: reading data to be verified, wherein the data to be verified comprises one or more objects to be verified;
Step 102: respectively matching each object to be verified from a preset verification rule set to obtain a verification rule corresponding to the object to be verified;
Step 103: and respectively executing the verification of the object to be verified according to the verification rule corresponding to each object to be verified.
For example, the data to be verified is read as follows:
Wherein, at least one object email to be checked is included; optionally, the data to be verified may further include a plurality of objects to be verified, which is not limited to the exemplary case of this embodiment.
The preset check rule set in step 102 is exemplified as follows:
The preset check rule set comprises check rules corresponding to the check sum required to be carried out on the email data items.
In step 102, matching the email of the object to be verified to obtain a verification rule of the email, and obtaining a matching result from a preset rule set according to the keyword "email", as follows:
It can be seen that, for the check object email, matching obtains the 2 check rules.
Then, in step 103, the checks corresponding to the 2 check rules are sequentially executed, that is, the following steps are first executed: com, minglamp, export, func, checknull function, then perform: com.minglamp.export.func.checkemail function.
Optionally, each check object may be configured with one or more check rules, respectively. When a plurality of verification rules are configured, the configuration sequence of the verification rules determines the sequence of verification execution.
Optionally, when a plurality of verification rules are obtained through matching, if the verification execution corresponding to any rule fails, after failure information is recorded, the verification process is exited, subsequent verification is not executed, and the overall verification failure of the object is determined;
Or if the verification corresponding to any rule fails to be executed, the verification corresponding to the subsequent rule is continuously executed after the failure information is recorded; finally, recording related failure information of the verification failure, and determining the whole verification failure of the object;
Wherein the failure information at least comprises: the object to be verified and the corresponding object to be verified execute a verification rule of verification failure;
Wherein, the check function is exemplified as follows:
Boolean CheckNull(Object value,…);
Boolean CheckEmail(Object value,…);
The return value of the check function is of a Boolean type and represents that the check fails or succeeds; the first parameter of the function is the object to be verified. This example is merely to illustrate possible implementations, and those skilled in the art may accordingly adopt other ways, not limited to the above example.
Optionally, if the data to be verified includes a plurality of objects to be verified, matching is performed on each verification object one by one in sequence, corresponding verification rules are obtained respectively, and verification is performed correspondingly. In this embodiment, only the case where one object needs to be checked is illustrated. The specific embodiments are not limited to this description.
The data to be verified is described by adopting an xml file format, and in a specific implementation, the data to be verified is not limited to the specific file format; alternatively, other file formats may be used to describe or return the contents of the data packet when called by an API interface.
The content recorded in the preset check rule set is also described by using an xml file format, and in a specific implementation, the content is not limited to the specific file format; alternatively, other file formats may be used for description, or a database storage manner may be used for storing the preset check rule.
Optionally, for data objects in the data to be verified, matching in a preset verification rule set according to the keyword of each data object in sequence, and if the corresponding verification rule is not matched, not performing verification on the data object; the matching and checking of subsequent data objects is continued.
It can be seen that, for data to be verified, which data verification needs to be executed specifically, need not be determined and included in the overall business framework; but is flexibly configured by the form of the set of set check rules. Through the verification rule set, one or more objects to be verified which need to be verified are respectively configured by taking the keywords of the objects to be verified as indexes, so that the objects which need to be verified can be added or reduced according to the change of business requirements; furthermore, for each object to be verified, different verification rules can be combined by configuring one or more corresponding verification rules, and finally, a flexible data verification scheme as required is realized.
Those skilled in the art can see that these specific check rules correspond to different functions, and the existing check functions can be reused by combining multiple check rules.
EXAMPLE III
An embodiment of the present invention further provides a data verification apparatus 20, which has a structure as shown in fig. 2, and includes:
A to-be-verified data acquisition module 201 configured to read data to be verified, where the data to be verified includes one or more objects to be verified;
A verification rule obtaining module 202 configured to match each object to be verified with a preset verification rule set to obtain a verification rule corresponding to the object to be verified; the preset check rule set comprises a plurality of objects and check rules corresponding to the objects;
The verification module 203 is configured to perform verification on each object to be verified according to a verification rule corresponding to the object to be verified.
Optionally, the verification module 203 is configured to, when there is more than one verification rule corresponding to the object to be verified, sequentially perform verification on the object to be verified according to each verification rule corresponding to the object to be verified according to an arrangement order of the more than one rule in a preset verification rule set.
Optionally, the apparatus further includes a recording module 204 configured to record failure information when it is determined that the data verification result of the object to be verified is failure;
Wherein the failure information at least comprises: the object to be verified and a verification rule for the object to be verified to be failed in verification are executed.
Optionally, wherein the verification rule is a function of performing a verification; the checking module 203 is further configured to call a function corresponding to the checking rule to obtain an execution result of the function.
Optionally, the check rule obtaining module 202 is further configured to obtain, according to the keyword of the object to be checked, a check rule corresponding to the object to be checked by matching from the preset check rule set.
The embodiment of the present invention further provides a storage medium, in which a computer program is stored, where the computer program is configured to execute any one of the above data verification methods when running.
An embodiment of the present invention further provides an electronic device, which includes a memory and a processor, where the memory stores a computer program, and the processor is configured to execute any one of the above data verification methods.
It will be understood by those of ordinary skill in the art that all or part of the steps of the above embodiments may be implemented using a computer program flow, which may be stored in a computer readable storage medium and executed on a corresponding hardware platform (e.g., system, apparatus, device, etc.), and when executed, includes one or a combination of the steps of the method embodiments.
Alternatively, all or part of the steps of the above embodiments may be implemented by using an integrated circuit, and the steps may be respectively manufactured as an integrated circuit module, or a plurality of the blocks or steps may be manufactured as a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The devices/functional modules/functional units in the above embodiments may be implemented by general-purpose computing devices, and they may be centralized on a single computing device or distributed on a network formed by a plurality of computing devices.
Each device/function module/function unit in the above embodiments may be implemented in the form of a software function module and may be stored in a computer-readable storage medium when being sold or used as a separate product. The computer readable storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (10)
1. A data verification method includes the steps of,
Reading data to be verified, wherein the data to be verified comprises one or more objects to be verified;
Respectively matching each object to be verified from a preset verification rule set to obtain a verification rule corresponding to the object to be verified; the preset check rule set comprises a plurality of objects and check rules corresponding to the objects;
And respectively executing the verification of the object to be verified according to the verification rule corresponding to each object to be verified.
2. The method of claim 1, wherein,
The method for obtaining the check rule corresponding to each object to be checked by matching each object to be checked from a preset check rule set comprises the following steps:
And matching from the preset check rule set according to the keywords of the object to be checked to obtain a check rule corresponding to the object to be checked.
3. The method of claim 1 or 2,
The executing the data verification of the object to be verified according to the verification rule of the object to be verified comprises the following steps:
When more than one check rule is corresponding to the object to be checked, the check of the object to be checked is executed according to each check rule corresponding to the object to be checked in sequence according to the sequence of the more than one rule in a preset check rule set.
4. The method of claim 3, wherein,
And in the process of sequentially executing the verification of the object to be verified according to each verification rule corresponding to the object to be verified, when the verification executed according to any verification rule fails, judging that the verification result of the object to be verified is failure.
5. The method of claim 4, wherein the first and second light sources are selected from the group consisting of,
After the data verification result of the object to be verified is judged to be failed, the method further comprises the following steps:
Recording failure information, wherein the failure information at least comprises: the object to be verified and a verification rule for the object to be verified to be failed in verification are executed.
6. The method of claim 1 or 2,
The checking rule is a function for executing a checking function;
The executing the data verification of the object to be verified according to the verification rule of the object to be verified comprises the following steps:
And calling a function corresponding to the verification rule to obtain an execution result of the function.
7. A data verification apparatus, comprising,
The device comprises a to-be-verified data acquisition module, a verification module and a verification module, wherein the to-be-verified data acquisition module is configured to read data to be verified, and the data to be verified comprises one or more to-be-verified objects;
The verification rule obtaining module is configured to respectively match each object to be verified from a preset verification rule set to obtain a verification rule corresponding to the object to be verified; the preset check rule set comprises a plurality of objects and check rules corresponding to the objects;
And the checking module is configured to execute the checking of the object to be checked according to the checking rule corresponding to each object to be checked.
8. The apparatus of claim 7,
And the verification module is configured to, when more than one verification rule corresponding to the object to be verified is used, sequentially execute verification of the object to be verified according to each verification rule corresponding to the object to be verified according to the arrangement sequence of the more than one rule in a preset verification rule set.
9. A storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 6 when executed.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010181377.7A CN111427571A (en) | 2020-03-16 | 2020-03-16 | Data verification method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010181377.7A CN111427571A (en) | 2020-03-16 | 2020-03-16 | Data verification method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111427571A true CN111427571A (en) | 2020-07-17 |
Family
ID=71546399
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010181377.7A Withdrawn CN111427571A (en) | 2020-03-16 | 2020-03-16 | Data verification method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111427571A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023051308A1 (en) * | 2021-09-29 | 2023-04-06 | 华为技术有限公司 | Data verification method and apparatus, device and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160292242A1 (en) * | 2015-04-06 | 2016-10-06 | Adp, Llc | Automatic verification of json data |
CN109543942A (en) * | 2018-10-16 | 2019-03-29 | 平安普惠企业管理有限公司 | Data verification method, device, computer equipment and storage medium |
CN110019158A (en) * | 2017-11-13 | 2019-07-16 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus of monitoring data quality |
CN110704426A (en) * | 2019-09-06 | 2020-01-17 | 中国平安财产保险股份有限公司 | Data verification method, electronic device and computer readable storage medium |
CN110727425A (en) * | 2019-09-26 | 2020-01-24 | 招商局金融科技有限公司 | Electronic device, form data verification method and computer-readable storage medium |
-
2020
- 2020-03-16 CN CN202010181377.7A patent/CN111427571A/en not_active Withdrawn
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160292242A1 (en) * | 2015-04-06 | 2016-10-06 | Adp, Llc | Automatic verification of json data |
CN110019158A (en) * | 2017-11-13 | 2019-07-16 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus of monitoring data quality |
CN109543942A (en) * | 2018-10-16 | 2019-03-29 | 平安普惠企业管理有限公司 | Data verification method, device, computer equipment and storage medium |
CN110704426A (en) * | 2019-09-06 | 2020-01-17 | 中国平安财产保险股份有限公司 | Data verification method, electronic device and computer readable storage medium |
CN110727425A (en) * | 2019-09-26 | 2020-01-24 | 招商局金融科技有限公司 | Electronic device, form data verification method and computer-readable storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023051308A1 (en) * | 2021-09-29 | 2023-04-06 | 华为技术有限公司 | Data verification method and apparatus, device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108595157B (en) | Block chain data processing method, device, equipment and storage medium | |
CN112256886B (en) | Probability calculation method and device in atlas, computer equipment and storage medium | |
US7434112B2 (en) | System and method for verifying validity of assembled PCI devices of a computer | |
CN109376063A (en) | A kind of blog search method and apparatus, storage medium | |
CN114881616A (en) | Business process execution method and device, electronic equipment and storage medium | |
CN110688111A (en) | Configuration method, device, server and storage medium of business process | |
CN112181430A (en) | Code change statistical method and device, electronic equipment and storage medium | |
CN112363814A (en) | Task scheduling method and device, computer equipment and storage medium | |
CN115408391A (en) | Database table changing method, device, equipment and storage medium | |
CN113434542B (en) | Data relationship identification method and device, electronic equipment and storage medium | |
CN111427571A (en) | Data verification method and device | |
CN116661758B (en) | Method, device, electronic equipment and medium for optimizing log framework configuration | |
CN117331956A (en) | Task processing method, device, computer equipment and storage medium | |
CN115099922B (en) | Financial data query method, system, readable storage medium and computer equipment | |
US20200097458A1 (en) | Metadata validation tool | |
US20210383073A1 (en) | Comment management method, server and readable storage medium | |
CN111080209B (en) | BOM verification method, system, device and storage medium | |
CN112686759A (en) | Account checking monitoring method, device, equipment and medium | |
CN111611056A (en) | Data processing method and device, computer equipment and storage medium | |
US11797644B2 (en) | Identifying checksum mechanisms using linear equations | |
CN111324434B (en) | Configuration method, device and execution system of computing task | |
CN108763363B (en) | Method and device for checking record to be written | |
CN115629958A (en) | Universal field level automatic checking method and device for different service interfaces | |
CN117271487A (en) | Service data verification method, device, equipment and storage medium | |
CN117370160A (en) | Code auditing method, apparatus, computer device, storage medium and program product |
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 | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20200717 |
|
WW01 | Invention patent application withdrawn after publication |