vitess.io/vitess@v0.16.2/go/vt/vtgate/semantics/vindex_table.go (about)

     1  /*
     2  Copyright 2021 The Vitess Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package semantics
    18  
    19  import (
    20  	"vitess.io/vitess/go/vt/sqlparser"
    21  	"vitess.io/vitess/go/vt/vtgate/vindexes"
    22  )
    23  
    24  // VindexTable contains a vindexes.Vindex and a TableInfo. The former represents the vindex
    25  // we are keeping information about, and the latter represents the additional table information
    26  // (usually a RealTable or an AliasedTable) of our vindex.
    27  type VindexTable struct {
    28  	Table  TableInfo
    29  	Vindex vindexes.Vindex
    30  }
    31  
    32  var _ TableInfo = (*VindexTable)(nil)
    33  
    34  // dependencies implements the TableInfo interface
    35  func (v *VindexTable) dependencies(colName string, org originable) (dependencies, error) {
    36  	return v.Table.dependencies(colName, org)
    37  }
    38  
    39  // GetTables implements the TableInfo interface
    40  func (v *VindexTable) getTableSet(org originable) TableSet {
    41  	return v.Table.getTableSet(org)
    42  }
    43  
    44  // GetExprFor implements the TableInfo interface
    45  func (v *VindexTable) getExprFor(_ string) (sqlparser.Expr, error) {
    46  	panic("implement me")
    47  }
    48  
    49  // GetVindexTable implements the TableInfo interface
    50  func (v *VindexTable) GetVindexTable() *vindexes.Table {
    51  	return v.Table.GetVindexTable()
    52  }
    53  
    54  // Matches implements the TableInfo interface
    55  func (v *VindexTable) matches(name sqlparser.TableName) bool {
    56  	return v.Table.matches(name)
    57  }
    58  
    59  // Authoritative implements the TableInfo interface
    60  func (v *VindexTable) authoritative() bool {
    61  	return true
    62  }
    63  
    64  // Name implements the TableInfo interface
    65  func (v *VindexTable) Name() (sqlparser.TableName, error) {
    66  	return v.Table.Name()
    67  }
    68  
    69  // GetExpr implements the TableInfo interface
    70  func (v *VindexTable) getExpr() *sqlparser.AliasedTableExpr {
    71  	return v.Table.getExpr()
    72  }
    73  
    74  // GetColumns implements the TableInfo interface
    75  func (v *VindexTable) getColumns() []ColumnInfo {
    76  	return v.Table.getColumns()
    77  }
    78  
    79  // IsInfSchema implements the TableInfo interface
    80  func (v *VindexTable) IsInfSchema() bool {
    81  	return v.Table.IsInfSchema()
    82  }