github.com/tobgu/qframe@v0.4.0/types/types.go (about)

     1  package types
     2  
     3  // DataType represents any of the data types valid in a QFrame.
     4  type DataType string
     5  
     6  const (
     7  	// None represents an unknown data type.
     8  	// This is mainly used to indicate that the type of a column should be auto detected.
     9  	None DataType = ""
    10  
    11  	// Int translates into the Go int type. Missing values cannot be represented explicitly.
    12  	Int = "int"
    13  
    14  	// String translates into the Go *string type. nil represents a missing value.
    15  	// Internally a string currently has an overhead of eight bytes (64 bits) in
    16  	// addition to the bytes actually used to hold the string.
    17  	String = "string"
    18  
    19  	// Float translates into the Go float64 type. NaN represents a missing value.
    20  	Float = "float"
    21  
    22  	// Bool translates into the Go bool type. Missing values cannot be represented explicitly.
    23  	Bool = "bool"
    24  
    25  	// Enum translates into the Go *string type. nil represents a missing value.
    26  	// An enum column can, at most, have 254 distinct values.
    27  	Enum = "enum"
    28  
    29  	// Undefined represents an unspecified data type.
    30  	// This is used for zero length columns where the datatype could not be identified.
    31  	Undefined DataType = "Undefined"
    32  )
    33  
    34  // FunctionType represents the different types of input that functions operating on columns can take.
    35  type FunctionType byte
    36  
    37  const (
    38  	FunctionTypeUndefined FunctionType = iota
    39  	FunctionTypeInt
    40  	FunctionTypeFloat
    41  	FunctionTypeBool
    42  	FunctionTypeString
    43  )
    44  
    45  func (t FunctionType) String() string {
    46  	switch t {
    47  	case FunctionTypeInt:
    48  		return "Int function"
    49  	case FunctionTypeBool:
    50  		return "Bool function"
    51  	case FunctionTypeString:
    52  		return "String function"
    53  	case FunctionTypeFloat:
    54  		return "Float function"
    55  	case FunctionTypeUndefined:
    56  		return "Undefined type function"
    57  	default:
    58  		return "Unknown function"
    59  	}
    60  }