github.com/tobgu/qframe@v0.4.0/internal/ncolumn/column.go (about)

     1  package ncolumn
     2  
     3  /*
     4  Package ncolumn contains a "null implementation" of the Column interface. It is typeless and of size 0.
     5  
     6  It is for example used when reading zero row CSVs without type hints.
     7  */
     8  
     9  import (
    10  	"github.com/tobgu/qframe/config/rolling"
    11  	"github.com/tobgu/qframe/internal/column"
    12  	"github.com/tobgu/qframe/internal/index"
    13  	"github.com/tobgu/qframe/qerrors"
    14  	"github.com/tobgu/qframe/types"
    15  )
    16  
    17  type Column struct{}
    18  
    19  func (c Column) String() string {
    20  	return "[]"
    21  }
    22  
    23  func (c Column) Filter(index index.Int, comparator interface{}, comparatee interface{}, bIndex index.Bool) error {
    24  	return nil
    25  }
    26  
    27  func (c Column) Subset(index index.Int) column.Column {
    28  	return c
    29  }
    30  
    31  func (c Column) Equals(index index.Int, other column.Column, otherIndex index.Int) bool {
    32  	return false
    33  }
    34  
    35  func (c Column) Comparable(reverse, equalNull, nullLast bool) column.Comparable {
    36  	return Comparable{}
    37  }
    38  
    39  func (c Column) Aggregate(indices []index.Int, fn interface{}) (column.Column, error) {
    40  	return c, nil
    41  }
    42  
    43  func (c Column) StringAt(i uint32, naRep string) string {
    44  	return naRep
    45  }
    46  
    47  func (c Column) AppendByteStringAt(buf []byte, i uint32) []byte {
    48  	return buf
    49  }
    50  
    51  func (c Column) ByteSize() int {
    52  	return 0
    53  }
    54  
    55  func (c Column) Len() int {
    56  	return 0
    57  }
    58  
    59  func (c Column) Apply1(fn interface{}, ix index.Int) (interface{}, error) {
    60  	return c, nil
    61  }
    62  
    63  func (c Column) Apply2(fn interface{}, s2 column.Column, ix index.Int) (column.Column, error) {
    64  	return c, nil
    65  }
    66  
    67  func (c Column) Rolling(fn interface{}, ix index.Int, config rolling.Config) (column.Column, error) {
    68  	return c, nil
    69  }
    70  
    71  func (c Column) FunctionType() types.FunctionType {
    72  	return types.FunctionTypeUndefined
    73  }
    74  
    75  func (c Column) DataType() types.DataType {
    76  	return types.Undefined
    77  }
    78  
    79  type Comparable struct{}
    80  
    81  func (c Comparable) Compare(i, j uint32) column.CompareResult {
    82  	return column.NotEqual
    83  }
    84  
    85  func (c Comparable) Hash(i uint32, seed uint64) uint64 {
    86  	return 0
    87  }
    88  
    89  func (c Column) Append(cols ...column.Column) (column.Column, error) {
    90  	// TODO Append
    91  	return nil, qerrors.New("Append", "Not implemented yet")
    92  }