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

     1  // Copyright 2021 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 mysqlshim
    16  
    17  import (
    18  	"io"
    19  
    20  	"github.com/dolthub/go-mysql-server/sql"
    21  )
    22  
    23  // tablePartitionIter is used as a sql.PartitionIter.
    24  type tablePartitionIter struct {
    25  	returned bool
    26  }
    27  
    28  // tablePartition is used as a sql.Partition.
    29  type tablePartition struct{}
    30  
    31  var _ sql.PartitionIter = (*tablePartitionIter)(nil)
    32  
    33  var _ sql.Partition = tablePartition{}
    34  
    35  // Next implements the interface sql.PartitionIter.
    36  func (t *tablePartitionIter) Next(*sql.Context) (sql.Partition, error) {
    37  	if t.returned {
    38  		return nil, io.EOF
    39  	}
    40  	t.returned = true
    41  	return tablePartition{}, nil
    42  }
    43  
    44  // Close implements the interface sql.PartitionIter.
    45  func (t *tablePartitionIter) Close(ctx *sql.Context) error {
    46  	return nil
    47  }
    48  
    49  // Key implements the interface sql.Partition.
    50  func (t tablePartition) Key() []byte {
    51  	return nil
    52  }