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: ast.go
    path of file: ./repos/rill/runtime/pkg/duckdbsql
    
    the code of the file until where you have to start completion: package duckdbsql

import (
	"encoding/json"
	"fmt"
)

type AST struct {
	sql       string
	ast       astNode
	rootNodes []*selectNode
	aliases   map[string]bool
	added     map
    
func (a *AST) RewriteLimit(limit, offset int) error {
	if a.ast == nil {
		return fmt.Errorf("calling rewrite on failed parse")
	}

	if len(a.rootNodes) == 0 {
		return nil
	}

	// We only need to add limit to the top level query
	err := a.rootNodes[0].rewriteLimit(limit)
	if err != nil {
		return err
	}

	return nil
}