util

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertAnyToType added in v0.0.7

func ConvertAnyToType(v any, to tablecolumn.Type) any

func ConvertStringToType added in v0.0.7

func ConvertStringToType(v string, to tablecolumn.Type) (any, error)

func TryDecodeJsonArray

func TryDecodeJsonArray[T any](raw string) ([]T, error)

TryDecodeJsonArray attempts to decode a JSON array from a raw string into a slice of type T. If any elements fail to decode, it continues processing the remaining elements and returns the first encountered error (or joins multiple errors). The successfully decoded elements are still included in the result.

func ZeroValue added in v0.1.4

func ZeroValue(tp tablecolumn.Type) (any, error)

Types

type CellValueTyped added in v0.4.0

type CellValueTyped struct {
	Value any              `json:"value"`
	Type  tablecolumn.Type `json:"type"`
}

type ColumnIndexer

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

func NewColumnIndexer

func NewColumnIndexer(columns []*ent.TableColumn) *ColumnIndexer

func (*ColumnIndexer) ColumnNames

func (ci *ColumnIndexer) ColumnNames() []string

func (*ColumnIndexer) GetColumnByIndex

func (ci *ColumnIndexer) GetColumnByIndex(index int) (*ent.TableColumn, error)

func (*ColumnIndexer) GetColumnByNanoid

func (ci *ColumnIndexer) GetColumnByNanoid(id string) (*ent.TableColumn, error)

func (*ColumnIndexer) GetColumnIndexByNanoid

func (ci *ColumnIndexer) GetColumnIndexByNanoid(id string) (int, error)

func (*ColumnIndexer) RowMapToSlice

func (ci *ColumnIndexer) RowMapToSlice(row map[string]*schema.CellValue) ([]*schema.CellValue, error)

func (*ColumnIndexer) SliceToRowMap added in v0.3.1

func (ci *ColumnIndexer) SliceToRowMap(row []*schema.CellValue) (map[string]*schema.CellValue, error)

func (*ColumnIndexer) ToAPIRow added in v0.0.3

func (ci *ColumnIndexer) ToAPIRow(row map[string]*schema.CellValue) (map[string]any, error)

APIRow return a map of [columnID]cellValue

func (*ColumnIndexer) ToAPIRowWIthType added in v0.4.0

func (ci *ColumnIndexer) ToAPIRowWIthType(row map[string]*schema.CellValue) (map[string]CellValueTyped, error)

APIRow return a map of [columnName]CellValueTyped, used in worklfow terminal only

func (*ColumnIndexer) ToDisplayRow added in v0.0.2

func (ci *ColumnIndexer) ToDisplayRow(row map[string]*schema.CellValue) (map[string]any, error)

ToDisplayRow return a map of [columnName]cellValue

type Item

type Item struct {
	XMLName xml.Name
	Value   map[string]any
}

Item represents a single map entry with custom XML marshaling.

func (Item) MarshalXML

func (i Item) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML customizes the XML marshaling for the Item type.

Jump to

Keyboard shortcuts

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