package model import ( "encoding/json" "time" ) type Assured struct { ID int OrderNo string AssuredName string ComTelArea string CreditCode string CreditVld string ContactName string ContactMobile string TenderBankAccount string TenderBankOpenbank string TenderAccountName string Province string City string District string Address string ComTelNum string Agency string Order *Order `gorm:"foreignKey:OrderNo;references:OrderNo"` CreatedAt time.Time UpdatedAt time.Time `json:"-"` } func (Assured) TableName() string { return "assured" } func (a Assured) MarshalJSON() ([]byte, error) { type Alias Assured return json.Marshal(&struct { CreatedAt string UpdatedAt string *Alias }{ CreatedAt: a.CreatedAt.Format("2006-01-02 15:04:05"), UpdatedAt: a.UpdatedAt.Format("2006-01-02 15:04:05"), Alias: (*Alias)(&a), }) }