func (q *Query) InsertJoins(a []int64, b []int64) error {
	if len(a) == 0 || len(b) == 0 {
		return fmt.Errorf("Null data for joins insert %s", q.table())
	}
	values := ""
	for _, av := range a {
		for _, bv := range b {
			if av != 0 && bv != 0 {
				values += fmt.Sprintf("(%d,%d),", av, bv)
			}
		}
	}
	values = strings.TrimRight(values, ",")
	sql := fmt.Sprintf("INSERT into %s VALUES %s;", q.table(), values)
	if Debug {
		fmt.Printf("JOINS SQL:%s\n", sql)
	}
	_, err := database.Exec(sql)
	return err
}
InsertJoins using an array of ids (more general version of above)
This inserts joins for every possible relation between the ids
package query
import (
	"database/sql"
	"fmt"
	"sort"
	"strconv"
	"strings"
)
var Debug bool
func init() {
	Debug = false  
}
type Result map[string]interface{}
type Func func(q *Query) *Query
type Query struct {
	tablename  string
	primarykey string
	sql    string
	sel    string
	join   string
	where  string
	group  string
	having string
	order  string
	offset string
	limit  string
	args []interface{}
}
func New(t string, pk string) *Query {
	if database == nil {
		return nil
	}
	q := &Query{
		tablename:  t,
		primarykey: pk,
	}
	return q
}
func Exec(sql string, args ...interface{}) (sql.Result, error) {
	results, err := database.Exec(sql, args...)
	return results, err
}
func Rows(sql string, args ...interface{}) (*sql.Rows, error) {
	results, err := database.Query(sql, args...)
	return results, err
}
func (q *Query) Copy() *Query {
	return &Query{
		tablename:  q.tablename,
		primarykey: q.primarykey,
		sql:        q.sql,
		sel:        q.sel,
		join:       q.join,
		where:      q.where,
		group:      q.group,
		having:     q.having,
		order:      q.order,
		offset:     q.offset,
		limit:      q.limit,
		args:       q.args,
	}
}
func (q *Query) InsertJoin(a int64, b int64) error {
	return q.InsertJoins([]int64{a}, []int64{b})
}