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