package model

type RequestLog struct {
	Base
	UserId     string `json:"userId" gorm:"type:char(40);comment:'用户id'"`
	ClientIP   string `json:"clientIP" gorm:"type:varchar(60);not null;comment:'客户端IP'"`
	Host       string `json:"host" gorm:"type:varchar(255);not null;comment:'请求域名'"`
	Method     string `json:"method" gorm:"type:varchar(20);not null;comment:'请求方法[GET POST DELETE PUT PATCH]'"`
	Uri        string `json:"uri" gorm:"type:varchar(255);not null;comment:'请求path'"`
	Header     string `json:"header" gorm:"type:text;comment:'请求头'"`
	Body       string `json:"body" gorm:"type:text;comment:'请求体'"`
	Form       string `json:"form" gorm:"type:text;comment:'请求表单'"`
	Query      string `json:"query" gorm:"type:text;comment:'请求query'"`
	UserAgent  string `json:"userAgent" gorm:"type:text;comment:'ua信息'"`
	Cost       int64  `json:"cost" gorm:"type:int(10);comment:'请求耗时'"`
	StatusCode int    `json:"statusCode" gorm:"type:int(10);comment:'响应状态码'"`
	Response   string `json:"response" gorm:"type:text;comment:'返回数据'"`
}

func (RequestLog) TableName() string {
	return "t_request_log"
}