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

// Code generated by xo. DO NOT EDIT.

import (
	"context"
)

// Territory represents a row
    
func (t *Territory) Insert(ctx context.Context, db DB) error {
	switch {
	case t._exists: // already exists
		return logerror(&ErrInsertFailed{ErrAlreadyExists})
	case t._deleted: // deleted
		return logerror(&ErrInsertFailed{ErrMarkedForDeletion})
	}
	// insert (manual)
	const sqlstr = `INSERT INTO territories (` +
		`territory_id, territory_description, region_id` +
		`) VALUES (` +
		`$1, $2, $3` +
		`)`
	// run
	logf(sqlstr, t.TerritoryID, t.TerritoryDescription, t.RegionID)
	if _, err := db.ExecContext(ctx, sqlstr, t.TerritoryID, t.TerritoryDescription, t.RegionID); err != nil {
		return logerror(err)
	}
	// set exists
	t._exists = true
	return nil
}