types

package
Version: v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package types tracks all the Pixie types used in the Go API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BooleanValue

type BooleanValue struct {
	ValueType
	// contains filtered or unexported fields
}

BooleanValue is the concrete type that holds an boolean value.

func NewBooleanValue

func NewBooleanValue(schema *ColSchema) *BooleanValue

NewBooleanValue constructs a BooleanValue.

func (*BooleanValue) ScanBool

func (v *BooleanValue) ScanBool(data bool)

ScanBool scans bool value and write it to the internal data.

func (BooleanValue) String

func (v BooleanValue) String() string

String returns the string representation.

func (BooleanValue) Value

func (v BooleanValue) Value() bool

Value returns the data as a bool

type ColSchema

type ColSchema struct {
	// Name of the column.
	Name string
	// Type of the column.
	Type DataType
	// SemanticType of the column.
	SemanticType SemanticType
}

ColSchema has the per column schema.

type DataType

type DataType = vizierpb.DataType

DataType referes to the underlying Pixie datatype.

type Datum

type Datum interface {
	// String returns the string representation, regardless of the type.
	String() string
	// Type returns the Pixie data type.
	Type() DataType
	// TODO(zasgar): Enabled the formatted value interface. The goal for this function
	// will be to provide the canonical value with units.
	// FormattedValue() FormattedValue
	// SemanticType returns the Pixie semantic type.
	SemanticType() SemanticType
}

Datum is a base type use to wrap all underlying Pixie types.

type Float64Value

type Float64Value struct {
	ValueType
	// contains filtered or unexported fields
}

Float64Value is the concrete type that holds an float64 value.

func NewFloat64Value

func NewFloat64Value(schema *ColSchema) *Float64Value

NewFloat64Value constructs a Float64Value.

func (*Float64Value) ScanFloat64

func (v *Float64Value) ScanFloat64(data float64)

ScanFloat64 stores the float64 data.

func (Float64Value) String

func (v Float64Value) String() string

String returns the string representation.

func (Float64Value) Value

func (v Float64Value) Value() float64

Value returns the data as a float64.

type Int64Value

type Int64Value struct {
	ValueType
	// contains filtered or unexported fields
}

Int64Value is the concrete type that holds an int64 value.

func NewInt64Value

func NewInt64Value(schema *ColSchema) *Int64Value

NewInt64Value constructs an Int64Value.

func (*Int64Value) ScanInt64

func (v *Int64Value) ScanInt64(data int64)

ScanInt64 writes the int64 to the internal data structure.

func (Int64Value) String

func (v Int64Value) String() string

String returns the string representation.

func (Int64Value) Value

func (v Int64Value) Value() int64

Value returns the data as an int64.

type Record

type Record struct {
	// Data is the array index type erased values.
	Data []Datum
	// TableMetadata stores a pointer to underlying table metadata.
	TableMetadata *TableMetadata
}

Record stores information about a single record.

func (*Record) GetDatum

func (r *Record) GetDatum(colName string) Datum

GetDatum returns the value of the given column.

func (*Record) GetDatumByIdx

func (r *Record) GetDatumByIdx(idx int64) Datum

GetDatumByIdx returns the data at a given column index.

type SemanticType

type SemanticType = vizierpb.SemanticType

SemanticType stores semantic information about the underlying data. For example, the value represents a throughput, or K8s entity, etc.

type StringValue

type StringValue struct {
	ValueType
	// contains filtered or unexported fields
}

StringValue is the concrete type that holds an string value.

func NewStringValue

func NewStringValue(schema *ColSchema) *StringValue

NewStringValue constructs a StringValue.

func (*StringValue) ScanString

func (v *StringValue) ScanString(data string)

ScanString store the passed in string.

func (StringValue) String

func (v StringValue) String() string

String returns the string representation.

func (StringValue) Value

func (v StringValue) Value() string

Value returns the string.

type TableMetadata

type TableMetadata struct {
	// Name of the TableMetadata.
	Name string
	// ColInfo has the array index schemas of each column.
	ColInfo []ColSchema
	// ColIdxByName has the mapping from column names to column indices.
	ColIdxByName map[string]int64
}

TableMetadata contains the table metadata state.

func (*TableMetadata) IndexOf

func (t *TableMetadata) IndexOf(colName string) int64

IndexOf returns the index of a column by name. -1 is returned if the column does not exist.

type Time64NSValue

type Time64NSValue struct {
	ValueType
	// contains filtered or unexported fields
}

Time64NSValue is the concrete type that holds an time value.

func NewTime64NSValue

func NewTime64NSValue(schema *ColSchema) *Time64NSValue

NewTime64NSValue constructs a NewTime64NSValue.

func (*Time64NSValue) ScanInt64

func (v *Time64NSValue) ScanInt64(data int64)

ScanInt64 stores the int64 data.

func (Time64NSValue) String

func (v Time64NSValue) String() string

String returns the string representation.

func (Time64NSValue) Value

func (v Time64NSValue) Value() time.Time

Value returns the data as a time.

type UInt128Value

type UInt128Value struct {
	ValueType
	// contains filtered or unexported fields
}

UInt128Value is the concrete type that holds an time value.

func NewUint128Value

func NewUint128Value(schema *ColSchema) *UInt128Value

NewUint128Value constructs a UInt128Value.

func (*UInt128Value) ScanUInt128

func (v *UInt128Value) ScanUInt128(data *vizierpb.UInt128)

ScanUInt128 stores the passed in proto UInt128.

func (UInt128Value) String

func (v UInt128Value) String() string

String returns the string representation.

func (UInt128Value) Value

func (v UInt128Value) Value() []byte

Value returns the data as bytes.

type ValueType

type ValueType struct {
	// ColInfo is a pointer to the column schema. We maintain this as a pointer here
	// since the col schema is duplicated from the table structure.
	ColInfo *ColSchema
}

ValueType is the shared structure of values.

func (ValueType) SemanticType

func (v ValueType) SemanticType() SemanticType

SemanticType returns the Pixie semantic type.

func (ValueType) Type

func (v ValueType) Type() DataType

Type returns the Pixie data type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL