当前位置:网站首页>Writing a contract testing tool from scratch -- database design
Writing a contract testing tool from scratch -- database design
2022-06-22 13:13:00 【Diandian Hanbin】
Continued above , The first step is to design our table structure , My initial idea is to have two watches to hold it , There must be some changes in the future , Because I also write tools while recording .
Design description
The tool should have two pieces of content , The first is the information of the contract , This part records the structure of the contract . The second is the sub contract , All concrete values must be carried by the sub contract , The content of a sub contract is immutable once it is defined . The specific message contents of the contract tool for the consumer and the production end are carried by the sub contract .
Environmental statement
I'm using sqlalchemy This ORM Framework to handle database interaction . The code of the table structure is as follows
from sqlalchemy import Column, String, Integer
from sqlalchemy.ext.declarative import declarative_base
BaseModel = declarative_base()
class ContractStructure(BaseModel):
__tablename__ = 'contract_structure'
id = Column(Integer, primary_key=True)
contract_name = Column(String(500), nullable=False)
contract_consumer_body = Column(String(10000), nullable=False)
contract_consumer_keys = Column(String(500), nullable=False)
contract_provider_body = Column(String(5000), nullable=False)
contract_stakeholders = Column(String(500), nullable=False)
contract_child_ids = Column(String(500), nullable=True)
contract_version = Column(Integer, default=1)
contract_last_version = Column(String(1), nullable=False, default='Y')
provider_url = Column(String(100), nullable=True)
class ContractChild(BaseModel):
__tablename__ = 'contract_child'
id = Column(Integer, primary_key=True)
child_id = Column(String(40), nullable=False)
child_name = Column(String(100), nullable=False)
contract_id = Column(Integer)
child_consumer_body = Column(String(10000), nullable=False)
child_provider_body = Column(String(5000), nullable=False)
Let's explain my design idea one by one
ContractStructure
This table is used to store the contract structure and some contract related information .
- contract_name
Contract name , Generally speaking, names that are easy to recognize are better , such as Consumer-Provider such .
- contract_consumer_body
The structure of contract consumers , That is to say consumer Message sent by the end .
- contract_consumer_keys
The structure of the contract consumer key, Because the structure is immutable in contract testing , Therefore, it must be verified consumer End to end structure key value , To ensure the consistency of message structure
- contract_provider_body
The structure of the contract producer , That is, return to consumer End message structure
- contract_stakeholders
The stakeholders of the contract , Once the contract changes , Objects that the program needs to notify
- contract_child_ids
Of the sub contents of the contract id
- contract_version
Version information of the contract , Once the contract is changed , Then the version should be changed accordingly
- contract_last_version
Mark whether the modified contract is the latest contract
- provider_url
In production url Address , Tools should be able to give provider The client sends the contract content , So you need a field to record url
contract_child
This table is used to store the contents of the sub contract
- child_name
The name corresponding to the sub contract
- contract_id
Of the contract id
- child_consumer_body
The message content of the consumer
- child_provider_body
Message content of the production end
Last
above , We defined the table of the tool , What should be done next is to start writing concrete contract classes .
边栏推荐
- think php环境搭建笔记
- MySQL_ Addition, deletion and modification of data processing
- Set up your own website (5)
- Help financial informatization innovation, Jushan database has won more than 50 financial customers recently
- SAP fi financial statement version setting
- 巨杉数据库荣获艾媒咨询2022年中国信创产业双项荣誉
- Parallels Desktop 17.1.4pd virtual machine
- CVPR 2022 | visual language model pre training for scene text detection
- 476. Number Complement
- 2022-6-21os review group linking method
猜你喜欢

轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷

leetcode 99.恢复二叉搜索树

SiCf batch activation service node

Isn't this another go bug?

MySQL 5.7 + Navicat 下载安装教程(附安装包)

46. Permutations

文件下载漏洞&文件读取漏洞&文件删除漏洞

SNC processing failed SAP router certificate regeneration

MySQL_ Query of data processing

Sap-abap- how to find a table and what related tables the fields have
随机推荐
MySQL笔记
SAP SPRO configure how to display the corresponding t-code
RobotFramework二次开发——Socket推送实时日志
SAP system license viewing application and import
2022-6-21os review group linking method
leetcode 834. 树中距离之和
Is the dynamic table of Flink created in this way? I use the flick CDC to read MySQL data, write the flick dynamic table, and send
docker安装postgresql
从零开始写一个契约测试工具——数据库设计
MySQL_ Create and manage tables
SAP ABAP ole core code
769. Max Chunks To Make Sorted
leetcode 968.监控二叉树
Fluentd is easy to get started. Combined with the rainbow plug-in market, log collection is faster
318. Maximum Product of Word Lengths
redis修改密码,及启动、查看等操作
190. Reverse Bits
2017年度总结
文件下载漏洞&文件读取漏洞&文件删除漏洞
268. Missing Number