| 1234567891011121314151617181920212223242526272829303132333435 |
- package models
- // 操作埋点记录表
- type TrackingRecord struct {
- BaseModel
- UserID int `gorm:"type:int;not null;comment:用户ID" json:"user_id"`
- ApiPath string `gorm:"type:varchar(255);not null;comment:接口路径" json:"api_path"`
- ApiName string `gorm:"type:varchar(255);not null;comment:接口名称" json:"api_name"`
- Method string `gorm:"type:varchar(10);not null;comment:请求方法" json:"method"`
- UserAgent string `gorm:"type:varchar(500);comment:用户代理" json:"user_agent"`
- IpAddress string `gorm:"type:varchar(50);comment:IP地址" json:"ip_address"`
- RequestId string `gorm:"type:varchar(100);comment:请求ID" json:"request_id"`
- Status int `gorm:"type:tinyint;default:1;comment:状态 1:成功 0:失败" json:"status"`
- Duration int64 `gorm:"type:bigint;comment:请求耗时(毫秒)" json:"duration"`
- ExtraData string `gorm:"type:text;comment:额外数据" json:"extra_data"`
- }
- // TableName 指定表名
- func (TrackingRecord) TableName() string {
- return "tracking_record"
- }
- // 接口路径映射表
- type ApiPathMapping struct {
- BaseModel
- ApiPath string `gorm:"type:varchar(255);not null;uniqueIndex;comment:接口路径" json:"api_path"`
- ApiName string `gorm:"type:varchar(255);not null;comment:接口名称" json:"api_name"`
- ApiDesc string `gorm:"type:varchar(500);comment:接口描述" json:"api_desc"`
- Status int `gorm:"type:tinyint;default:1;comment:状态 1:启用 0:禁用" json:"status"`
- }
- // TableName 指定表名
- func (ApiPathMapping) TableName() string {
- return "api_path_mapping"
- }
|