package model import ( "time" ) // Todo represents a todo item in the database type Todo struct { ID uint `gorm:"primaryKey" json:"id"` Title string `gorm:"index" json:"title"` Description string `gorm:"default:null" json:"description"` Completed bool `gorm:"default:false" json:"completed"` CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` } // TableName overrides the table name func (Todo) TableName() string { return "todos" }