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: order.xo.go
    path of file: ./repos/xo/_examples/northwind/mysql
    
    the code of the file until where you have to start completion: package mysql

// Code generated by xo. DO NOT EDIT.

import (
	"context"
	"database/sql"
)

// Order represents a row from 'northwind.orders'.
type Order struct {
	OrderID        int16           `json:"order_id"`         // order_id
	CustomerID     sql.NullString  `json:"customer_id"`      // customer_id
	EmployeeID     sql.NullInt64   `json:"employee_id"`      // employee_id
	OrderDate      sql.NullTime    `json:"order_date"`       // order_date
	RequiredDate   sql.NullTime    `json:"required_date"`    // required_date
	ShippedDate    sql.NullTime    `json:"shipped_date"`     // shipped_date
	ShipVia        sql.NullInt64   `json:"ship_via"`         // ship_via
	Freight        sql.NullFloat64 `json:"freight"`          // freight
	ShipName       sql.NullString  `json:"ship_name"`        // ship_name
	ShipAddress    sql.NullString  `json:"ship_address"`     // ship_address
	ShipCity       sql.NullString  `json:"ship_city"`        // ship_city
	ShipRegion     sql.NullString  `json:"ship_region"`      // ship_region
	ShipPostalCode sql.NullString  `json:"ship_postal_code"` // ship_postal_code
	ShipCountry    sql.NullString  `json:"ship_country"`     // ship_country
	// xo fields
	_exists, _deleted bool
}

// Exists returns true when the [Order] exists in the database.
func (o *Order) Exists() bool {
	return o._exists
}

// Deleted returns true when the [Order] has been marked for deletion
// from the database.
func (o *Order) Deleted() bool {
	return o._d
    
func (o *Order) Upsert(ctx context.Context, db DB) error {
	switch {
	case o._deleted: // deleted
		return logerror(&ErrUpsertFailed{ErrMarkedForDeletion})
	}
	// upsert
	const sqlstr = `INSERT INTO northwind.orders (` +
		`order_id, customer_id, employee_id, order_date, required_date, shipped_date, ship_via, freight, ship_name, ship_address, ship_city, ship_region, ship_postal_code, ship_country` +
		`) VALUES (` +
		`?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?` +
		`)` +
		` ON DUPLICATE KEY UPDATE ` +
		`order_id = VALUES(order_id), customer_id = VALUES(customer_id), employee_id = VALUES(employee_id), order_date = VALUES(order_date), required_date = VALUES(required_date), shipped_date = VALUES(shipped_date), ship_via = VALUES(ship_via), freight = VALUES(freight), ship_name = VALUES(ship_name), ship_address = VALUES(ship_address), ship_city = VALUES(ship_city), ship_region = VALUES(ship_region), ship_postal_code = VALUES(ship_postal_code), ship_country = VALUES(ship_country)`
	// run
	logf(sqlstr, o.OrderID, o.CustomerID, o.EmployeeID, o.OrderDate, o.RequiredDate, o.ShippedDate, o.ShipVia, o.Freight, o.ShipName, o.ShipAddress, o.ShipCity, o.ShipRegion, o.ShipPostalCode, o.ShipCountry)
	if _, err := db.ExecContext(ctx, sqlstr, o.OrderID, o.CustomerID, o.EmployeeID, o.OrderDate, o.RequiredDate, o.ShippedDate, o.ShipVia, o.Freight, o.ShipName, o.ShipAddress, o.ShipCity, o.ShipRegion, o.ShipPostalCode, o.ShipCountry); err != nil {
		return logerror(err)
	}
	// set exists
	o._exists = true
	return nil
}