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

// Code generated by xo. DO NOT EDIT.

import (
	"context"
)

// APrimary represents a row from 'a_bit_of_everything.a_primary'.
type APrimary struct {
	AKey int `json:"a_key"` // a_key
	// xo fields
	_exists, _deleted bool
}

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

// Deleted returns true when the [APrimary] has been marked for deletion
// from the database.
func (ap *APrimary) Deleted() bool {
	ret
    
func (ap *APrimary) Insert(ctx context.Context, db DB) error {
	switch {
	case ap._exists: // already exists
		return logerror(&ErrInsertFailed{ErrAlreadyExists})
	case ap._deleted: // deleted
		return logerror(&ErrInsertFailed{ErrMarkedForDeletion})
	}
	// insert (manual)
	const sqlstr = `INSERT INTO a_bit_of_everything.a_primary (` +
		`a_key` +
		`) VALUES (` +
		`:1` +
		`)`
	// run
	logf(sqlstr, ap.AKey)
	if _, err := db.ExecContext(ctx, sqlstr, ap.AKey); err != nil {
		return logerror(err)
	}
	// set exists
	ap._exists = true
	return nil
}