github.com/dolthub/go-mysql-server@v0.18.0/enginetest/query_engine.go (about)

     1  // Copyright 2023 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package enginetest
    16  
    17  import (
    18  	"github.com/dolthub/vitess/go/vt/proto/query"
    19  	"github.com/dolthub/vitess/go/vt/sqlparser"
    20  
    21  	sqle "github.com/dolthub/go-mysql-server"
    22  	"github.com/dolthub/go-mysql-server/sql"
    23  	"github.com/dolthub/go-mysql-server/sql/analyzer"
    24  )
    25  
    26  type QueryEngine interface {
    27  	PrepareQuery(*sql.Context, string) (sql.Node, error)
    28  	AnalyzeQuery(*sql.Context, string) (sql.Node, error)
    29  	Query(ctx *sql.Context, query string) (sql.Schema, sql.RowIter, error)
    30  	// TODO: get rid of this, should not be exposed to engine tests
    31  	EngineAnalyzer() *analyzer.Analyzer
    32  	// TODO: get rid of this, should not be exposed to engine tests
    33  	EnginePreparedDataCache() *sqle.PreparedDataCache
    34  	QueryWithBindings(ctx *sql.Context, query string, parsed sqlparser.Statement, bindings map[string]*query.BindVariable) (sql.Schema, sql.RowIter, error)
    35  	CloseSession(connID uint32)
    36  	Close() error
    37  }
    38  
    39  var _ QueryEngine = (*sqle.Engine)(nil)