在CI中替换语句查询

i have this table

id | part_number | desc | date       |
1  | 3yrt3470    | aa   | 2017-02-20 |
2  | 3utitj40    | bb   | 2017-02-12 |

pk=id

i want to create query insert into table but if part_number exist it will updated. anyone can help me? i tried this

function replace($part_number)
{
    $this->db->replace('tbl_master_data');
    $this->db->set('description',$description);
    $this->db->set('rrp',$rrp);
    $this->db->set('discount_code',$discount_code);
    $this->db->set('product_group',$product_group);
    $this->db->set('value_discount',$value_discount);
    $this->db->set('stk',$stk);
    $this->db->where('part_number',$part_number);
}

error messages show you must use the 'set' method...