You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: shipper.xo.go
    path of file: ./repos/xo/_examples/northwind/sqlserver
    
    the code of the file until where you have to start completion: package sqlserver

// Code generated by xo. DO NOT EDIT.

imp
    
func (s *Shipper) Upsert(ctx context.Context, db DB) error {
	switch {
	case s._deleted: // deleted
		return logerror(&ErrUpsertFailed{ErrMarkedForDeletion})
	}
	// upsert
	const sqlstr = `MERGE northwind.shippers AS t ` +
		`USING (` +
		`SELECT @p1 shipper_id, @p2 company_name, @p3 phone ` +
		`) AS s ` +
		`ON s.shipper_id = t.shipper_id ` +
		`WHEN MATCHED THEN ` +
		`UPDATE SET ` +
		`t.company_name = s.company_name, t.phone = s.phone ` +
		`WHEN NOT MATCHED THEN ` +
		`INSERT (` +
		`shipper_id, company_name, phone` +
		`) VALUES (` +
		`s.shipper_id, s.company_name, s.phone` +
		`);`
	// run
	logf(sqlstr, s.ShipperID, s.CompanyName, s.Phone)
	if _, err := db.ExecContext(ctx, sqlstr, s.ShipperID, s.CompanyName, s.Phone); err != nil {
		return logerror(err)
	}
	// set exists
	s._exists = true
	return nil
}