package dbbasemodel import "time" type DBModelBase struct { CreatedAt *time.Time `pg:"default:now()" json:"created,omitempty" swaggerignore:"true"` UpdatedAt *time.Time `pg:"default:now()" json:"updated,omitempty" swaggerignore:"true"` } func (d *DBModelBase) ClearCreatedAt() { d.CreatedAt = nil } func (d *DBModelBase) ClearDates() { d.CreatedAt = nil d.UpdatedAt = nil } // Keeping the Scrub name used in other locations so people are more likely to find this function func (d *DBModelBase) Scrub(){ d.ClearDates() }