feat: add history helper
							parent
							
								
									a5322f8d92
								
							
						
					
					
						commit
						ae12649984
					
				| 
						 | 
				
			
			@ -25,3 +25,16 @@ func getBase() *History {
 | 
			
		|||
	}
 | 
			
		||||
	return h
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *History) Msg(msg string) *History {
 | 
			
		||||
	h.Message = msg
 | 
			
		||||
	return h
 | 
			
		||||
}
 | 
			
		||||
func (h *History) Bd(body interface{}) *History {
 | 
			
		||||
	h.Body = body
 | 
			
		||||
	return h
 | 
			
		||||
}
 | 
			
		||||
func (h *History) Iss(issuer string) *History {
 | 
			
		||||
	h.Issuer = issuer
 | 
			
		||||
	return h
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,16 +21,16 @@ const (
 | 
			
		|||
type History struct {
 | 
			
		||||
	ID        uint `gorm:"primaryKey"`
 | 
			
		||||
	CreatedAt time.Time
 | 
			
		||||
 | 
			
		||||
	Module    string
 | 
			
		||||
	Type      string
 | 
			
		||||
 | 
			
		||||
	Message  string
 | 
			
		||||
	BodyJson string
 | 
			
		||||
	Body     interface{} `gorm:"-"`
 | 
			
		||||
	Issuer   string
 | 
			
		||||
	Caller    string
 | 
			
		||||
	Trace     string
 | 
			
		||||
 | 
			
		||||
	Message string
 | 
			
		||||
	Body    interface{} `gorm:"-"`
 | 
			
		||||
	Issuer  string
 | 
			
		||||
 | 
			
		||||
	BodyJson string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *History) BeforeCreate(tx *gorm.DB) (err error) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue