func (s *InventoryService) CreateInventory(m *model.Inventory) (*model.Inventory, error) { if m == nil { panic("Inventory can't be null!") } m.CreateTime = time.Now() // m.PrepareToSave() // prepare to save, create time... return inventorydao.Create(m) }