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: generate.go
    path of file: ./repos/infra/internal/server/data/table
    
    the code of the file until where you have to start completion: package table

import (
	"bytes"
	"fmt"
	"go/ast"
	"go/format"
	"go/parser"
	"go/token"
	"os"
	"path/filepath"
	"reflect"
	"runtime"
	"sort"
	"strings"
)

// GenerateMethods for a model struct. These methods allow the model to
// perform queries against a database table without repeating the names of
// columns and fields.
func GenerateMethods(model any, columns []string, filename string) error {
	rt := reflect.TypeOf(model)

	var fileset token.FileSet
	var mode = parser.ParseComments | parser.AllErr
    
func writeFile(fileset *token.FileSet, filename string, source *ast.File) error {
	var buf bytes.Buffer
	if err := format.Node(&buf, fileset, source); err != nil {
		return fmt.Errorf("failed to format file after update: %w", err)
	}

	fh, err := os.Create(filename)
	if err != nil {
		return fmt.Errorf("failed to open file %v: %w", filename, err)
	}
	if _, err = fh.Write(buf.Bytes()); err != nil {
		return fmt.Errorf("failed to write file %v: %w", filename, err)
	}
	if err := fh.Sync(); err != nil {
		return fmt.Errorf("failed to sync file %v: %w", filename, err)
	}
	return nil
}