func (e *Employee) Insert(ctx context.Context, db DB) error {
	switch {
	case e._exists:  
		return logerror(&ErrInsertFailed{ErrAlreadyExists})
	case e._deleted:  
		return logerror(&ErrInsertFailed{ErrMarkedForDeletion})
	}
	const sqlstr = `INSERT INTO public.employees (` +
		`employee_id, last_name, first_name, title, title_of_courtesy, birth_date, hire_date, address, city, region, postal_code, country, home_phone, extension, photo, notes, reports_to, photo_path` +
		`) VALUES (` +
		`$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18` +
		`)`
	logf(sqlstr, e.EmployeeID, e.LastName, e.FirstName, e.Title, e.TitleOfCourtesy, e.BirthDate, e.HireDate, e.Address, e.City, e.Region, e.PostalCode, e.Country, e.HomePhone, e.Extension, e.Photo, e.Notes, e.ReportsTo, e.PhotoPath)
	if _, err := db.ExecContext(ctx, sqlstr, e.EmployeeID, e.LastName, e.FirstName, e.Title, e.TitleOfCourtesy, e.BirthDate, e.HireDate, e.Address, e.City, e.Region, e.PostalCode, e.Country, e.HomePhone, e.Extension, e.Photo, e.Notes, e.ReportsTo, e.PhotoPath); err != nil {
		return logerror(err)
	}
	e._exists = true
	return nil
}
Insert inserts the Employee to the database.
package models
import (
	"context"
	"database/sql"
)
type Employee struct {
	EmployeeID      int16          `json:"employee_id"`        
	LastName        string         `json:"last_name"`          
	FirstName       string         `json:"first_name"`         
	Title           sql.NullString `json:"title"`              
	TitleOfCourtesy sql.NullString `json:"title_of_courtesy"`  
	BirthDate       sql.NullTime   `json:"birth_date"`         
	HireDate        sql.NullTime   `json:"hire_date"`          
	Address         sql.NullString `json:"address"`            
	City            sql.NullString `json:"city"`               
	Region          sql.NullString `json:"region"`             
	PostalCode      sql.NullString `json:"postal_code"`        
	Country         sql.NullString `json:"country"`            
	HomePhone       sql.NullString `json:"home_phone"`         
	Extension       sql.NullString `json:"extension"`          
	Photo           []byte         `json:"photo"`              
	Notes           sql.NullString `json:"notes"`              
	ReportsTo       sql.NullInt64  `json:"reports_to"`         
	PhotoPath       sql.NullString `json:"photo_path"`         
	_exists, _deleted bool
}
func (e *Employee) Exists() bool {
	return e._exists
}
func (e *Employee) Deleted() bool {
	return e._deleted
}