picker

package
v1.1.25 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcatItems

type ConcatItems struct {
	// contains filtered or unexported fields
}

func (*ConcatItems) Add

func (ci *ConcatItems) Add(items ...any) (err error)

func (*ConcatItems) AddConstant

func (ci *ConcatItems) AddConstant(constant string) error

func (*ConcatItems) AddIndex

func (ci *ConcatItems) AddIndex(index int) error

func (ConcatItems) Len

func (ci ConcatItems) Len() int

type ConcatPicker

type ConcatPicker struct {
	// contains filtered or unexported fields
}

func (ConcatPicker) Pick

func (cp ConcatPicker) Pick(record []string) (*Value, error)

type Config

type Config struct {
	ConcatItems  []any              // Concat index column, constant, or mixed. int for index column, string for constant.
	Indices      []int              // Set index columns, the first non-null.
	Nullable     func(string) bool  // Determine whether it is null. Optional.
	NullValue    string             // Set null value when it is null. Optional.
	DefaultValue *string            // Set default value when it is null. Optional.
	Type         string             // Set the type of value.
	Function     *string            // Set the conversion function of value.
	CheckOnPost  func(*Value) error // Set the value check function on post.
}

Config is the configuration to build Picker The priority is as follows:

ConcatItems > Indices
Nullable
DefaultValue
NullValue, if set to null, subsequent conversions will be skipped.
Type
Function
CheckOnPost

func (*Config) Build

func (c *Config) Build() (Picker, error)

type ConstantPicker

type ConstantPicker string

func (ConstantPicker) Pick

func (cp ConstantPicker) Pick(_ []string) (*Value, error)

type Converter

type Converter interface {
	Convert(*Value) (*Value, error)
}

func NewTypeConverter

func NewTypeConverter(t string) (Converter, error)

type ConverterFunc

type ConverterFunc func(v *Value) (*Value, error)

func (ConverterFunc) Convert

func (f ConverterFunc) Convert(v *Value) (*Value, error)

type ConverterPicker

type ConverterPicker struct {
	// contains filtered or unexported fields
}

func (ConverterPicker) Pick

func (cp ConverterPicker) Pick(record []string) (*Value, error)

type Converters

type Converters []Converter

func (Converters) Convert

func (cs Converters) Convert(v *Value) (*Value, error)

type DefaultConverter

type DefaultConverter struct {
	Value string
}

func (DefaultConverter) Convert

func (dc DefaultConverter) Convert(v *Value) (*Value, error)

type FunctionBoolConverter added in v1.0.15

type FunctionBoolConverter struct{}

func (FunctionBoolConverter) Convert added in v1.0.15

func (FunctionBoolConverter) Convert(v *Value) (*Value, error)

type FunctionConverter

type FunctionConverter struct {
	Name string
}

func (FunctionConverter) Convert

func (fc FunctionConverter) Convert(v *Value) (*Value, error)

type FunctionDateConverter added in v1.0.14

type FunctionDateConverter struct {
	Name string
}

func (FunctionDateConverter) Convert added in v1.0.14

func (fc FunctionDateConverter) Convert(v *Value) (*Value, error)

type FunctionDateTimeConverter added in v1.0.13

type FunctionDateTimeConverter struct {
	Name string
}

func (FunctionDateTimeConverter) Convert added in v1.0.13

func (fc FunctionDateTimeConverter) Convert(v *Value) (*Value, error)

type FunctionDoubleConverter added in v1.0.14

type FunctionDoubleConverter struct{}

func (FunctionDoubleConverter) Convert added in v1.0.14

func (FunctionDoubleConverter) Convert(v *Value) (*Value, error)

type FunctionFloatConverter added in v1.0.14

type FunctionFloatConverter struct{}

func (FunctionFloatConverter) Convert added in v1.0.14

func (FunctionFloatConverter) Convert(v *Value) (*Value, error)

type FunctionIntConverter added in v1.0.14

type FunctionIntConverter struct{}

func (FunctionIntConverter) Convert added in v1.0.14

func (FunctionIntConverter) Convert(v *Value) (*Value, error)

type FunctionStringConverter

type FunctionStringConverter struct {
	Name string
}

func (FunctionStringConverter) Convert

func (fc FunctionStringConverter) Convert(v *Value) (*Value, error)

type FunctionTimeConverter added in v1.0.13

type FunctionTimeConverter struct {
	Name string
}

func (FunctionTimeConverter) Convert added in v1.0.13

func (fc FunctionTimeConverter) Convert(v *Value) (*Value, error)

type IndexPicker

type IndexPicker int

func (IndexPicker) Pick

func (ip IndexPicker) Pick(record []string) (*Value, error)

type NonConverter

type NonConverter struct{}

func (NonConverter) Convert

func (NonConverter) Convert(v *Value) (*Value, error)

type NullConverter

type NullConverter struct {
	Value string
}

func (NullConverter) Convert

func (nc NullConverter) Convert(v *Value) (*Value, error)

type NullableConverter

type NullableConverter struct {
	Nullable func(string) bool
}

func (NullableConverter) Convert

func (nc NullableConverter) Convert(v *Value) (*Value, error)

type NullableConverters

type NullableConverters []Converter

func (NullableConverters) Convert

func (ncs NullableConverters) Convert(v *Value) (*Value, error)

type NullablePickers

type NullablePickers []Picker

func (NullablePickers) Pick

func (nps NullablePickers) Pick(record []string) (v *Value, err error)

type Picker

type Picker interface {
	Pick([]string) (*Value, error)
}

type PickerFunc

type PickerFunc func(record []string) (*Value, error)

func (PickerFunc) Pick

func (f PickerFunc) Pick(record []string) (*Value, error)

type TypeBoolConverter

type TypeBoolConverter = FunctionBoolConverter

type TypeDateConverter

type TypeDateConverter = FunctionDateConverter

type TypeDatetimeConverter

type TypeDatetimeConverter = FunctionDateTimeConverter

type TypeDoubleConverter

type TypeDoubleConverter = FunctionDoubleConverter

type TypeFloatConverter

type TypeFloatConverter = FunctionFloatConverter

type TypeGeoConverter

type TypeGeoConverter = FunctionStringConverter

type TypeGeoLineStringConverter

type TypeGeoLineStringConverter = FunctionStringConverter

type TypeGeoPointConverter

type TypeGeoPointConverter = FunctionStringConverter

type TypeGeoPolygonConverter

type TypeGeoPolygonConverter = FunctionStringConverter

type TypeIntConverter

type TypeIntConverter = FunctionIntConverter

type TypeStringConverter

type TypeStringConverter struct {
}

func (TypeStringConverter) Convert

func (TypeStringConverter) Convert(v *Value) (*Value, error)

type TypeTimeConverter

type TypeTimeConverter = FunctionTimeConverter

type TypeTimestampConverter

type TypeTimestampConverter struct {
	// contains filtered or unexported fields
}

func (TypeTimestampConverter) Convert

func (tc TypeTimestampConverter) Convert(v *Value) (*Value, error)

type Value

type Value struct {
	Val    string
	IsNull bool
	// contains filtered or unexported fields
}

func NewValue

func NewValue(val string) *Value

func (*Value) Release

func (v *Value) Release()

Jump to

Keyboard shortcuts

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