typeof

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unsupported = Type(iota)
	Int32
	Int64
	Float64
	String
	Bool
	Timestamp
	JSON
)

The types of the columns supported

Variables

This section is empty.

Functions

func Parse added in v1.2.5

func Parse(s string, typ Type) (interface{}, bool)

Parse attempts to parse the string to a specific type

Types

type Schema

type Schema map[string]Type

Schema represents a mapping between columns and their types

func (*Schema) Clone

func (s *Schema) Clone() (c Schema)

Clone clones the schema

func (Schema) Columns

func (s Schema) Columns() []string

Columns returns the columns in the schema

func (Schema) Compare

func (s Schema) Compare(desired Schema) (Schema, bool)

Compare the schema against a desired schema and returns mismatching columns/types.

func (Schema) Contains

func (s Schema) Contains(key string, typ Type) bool

Contains checks if the schema contains a specific key

func (Schema) Except

func (s Schema) Except(other Schema) Schema

Except returns a subset of the schema which does not contain the specified schema

func (Schema) HasConvertible added in v1.2.5

func (s Schema) HasConvertible(key string, typ Type) bool

HasConvertible checks if the schema contains a specific key or can be converted to

func (Schema) String

func (s Schema) String() string

String returns the string representation of the schema

func (Schema) Union

func (s Schema) Union(other Schema) (Schema, bool)

Union combines two schemas together. It returns a true if a union has mismatched types or not in case of a type mismatch.

type Type

type Type byte

Type represents the type enum

func FromOrc

func FromOrc(desc *orc.TypeDescription) (Type, bool)

FromOrc maps the orc type description to our type.

func FromParquet added in v1.2.6

func FromParquet(desc *parquet.Type) (Type, bool)

FromParquet maps the parquet type description to our type.

func FromType

func FromType(rt reflect.Type) (Type, bool)

FromType gets the type from a reflect.Type

func (Type) Category

func (t Type) Category() orc.Category

Category returns the corresponding orc.Category

func (Type) MarshalJSON

func (t Type) MarshalJSON() ([]byte, error)

MarshalJSON encodes the type to JSON

func (*Type) MarshalText

func (t *Type) MarshalText() ([]byte, error)

MarshalText encodes the type to text

func (Type) Reflect

func (t Type) Reflect() reflect.Type

Reflect returns the corresponding reflect.Type

func (Type) SQL

func (t Type) SQL() string

SQL converts reflect type to SQL type

func (Type) String

func (t Type) String() string

String returns the name of the type

func (*Type) UnmarshalJSON

func (t *Type) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the json-encoded type

func (*Type) UnmarshalText

func (t *Type) UnmarshalText(text []byte) error

UnmarshalText unmarshals the type from text

Jump to

Keyboard shortcuts

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