github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/cat/family.go (about)

     1  // Copyright 2019 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package cat
    12  
    13  import "github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
    14  
    15  // Family is an interface to a table column family, exposing only the
    16  // information needed by the query optimizer.
    17  type Family interface {
    18  	// ID is the stable identifier for this family that is guaranteed to be
    19  	// unique within the owning table. See the comment for StableID for more
    20  	// detail.
    21  	ID() StableID
    22  
    23  	// Name is the name of the family.
    24  	Name() tree.Name
    25  
    26  	// Table returns a reference to the table with which this family is
    27  	// associated.
    28  	Table() Table
    29  
    30  	// ColumnCount returns the number of columns in the family.
    31  	ColumnCount() int
    32  
    33  	// Column returns the ith FamilyColumn within the family, where
    34  	// i < ColumnCount.
    35  	Column(i int) FamilyColumn
    36  }
    37  
    38  // FamilyColumn describes a single column that is part of a family definition.
    39  type FamilyColumn struct {
    40  	// Column is a reference to the column returned by Table.Column, given the
    41  	// column ordinal.
    42  	Column
    43  
    44  	// Ordinal is the ordinal position of the family column in the table. It is
    45  	// always >= 0 and < Table.ColumnCount.
    46  	Ordinal int
    47  }