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: main.go
    path of file: ./repos/bun/example/pg-faceted-search
    
    the code of the file until where you have to start completion: package main

import (
	"context"
	"database/sql"
	"fmt"
	"os"
	"strings"

	"github.com/davecgh/go-spew/spew"
	"github.com/uptrace/bun"
	"github.com/uptrace/bun/dbfixture"
	"github.com/uptrace/bun/dialect/pgdialect"
	"github.com/uptrace/bun/driver/pgdriver"
	"github.com/uptrace/bun/extra/bundebug"
)

type Book struct {
	ID   uint64 `bun:",pk,autoincrement"`
	Name string
	Tags []string
}

var _ bun.BeforeCreateTableHook = (*Book)(nil)

func (*Book) BeforeCreateTable(ctx context.Context, q *bun.CreateTableQuery) error {
	q.ColumnExpr("tsv tsvector")
	return nil
}

var _ bun.AfterCreateTableHook = (*Book)(nil)

func (*Book) AfterCreateTable(ctx context.Context, query *bun.CreateT
    
func selectFacets(ctx context.Context, db *bun.DB, tags ...string) (FacetMap, error) {
	q := db.NewSelect().
		Column("tsv").
		Model((*Book)(nil))

	for _, tag := range tags {
		tag = strings.ReplaceAll(tag, ":", "\\:")
		q = q.Where("tsv @@ ?::tsquery", tag)
	}

	var facets []*Facet

	if err := db.NewSelect().
		ColumnExpr("split_part(word, ':', 1) AS key").
		ColumnExpr("split_part(word, ':', 2) AS value").
		ColumnExpr("ndoc AS count").
		ColumnExpr("row_number() OVER ("+
			"PARTITION BY split_part(word, ':', 1) "+
			"ORDER BY ndoc DESC"+
			") AS _rank").
		TableExpr("ts_stat($$ ? $$)", q).
		OrderExpr("_rank DESC").
		Scan(ctx, &facets); err != nil {
		return nil, err
	}

	m := make(FacetMap)

	for _, facet := range facets {
		m[facet.Key] = append(m[facet.Key], facet)
	}

	return m, nil
}