csvt

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package csvt provides a typed CSV parser

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	// the Header is the name of the column, as it exists in the CSV file
	Header string
	// ColumnType defines the type of the values in the column.
	// During parsing, the value is converted from a string to the appropriate type.
	ColumnType ColumnType
	// Label is the internal name for the column. It's used to represent a row as a map.
	Label string
}

Column represents a column in the CSV file

type ColumnType

type ColumnType interface {
	// contains filtered or unexported methods
}

type DateColumn

type DateColumn struct {
	Format string
}

type File

type File struct {
	SchemaName string
	Rows       []Row
	Schema
}

type IgnoreColumn

type IgnoreColumn struct{}

type NumberColumn

type NumberColumn struct{}

type Row

type Row []any

type Schema

type Schema struct {
	// Columns define the columns in the CSV file
	Columns []Column
	// Separator is the separator used in the CSV file for this Column
	Separator rune
}

func (Schema) GetColumns

func (s Schema) GetColumns() []string

func (Schema) ToMap

func (s Schema) ToMap(row Row) map[string]any

type Schemas

type Schemas map[string]Schema

func (Schemas) Parse

func (s Schemas) Parse(r io.Reader) (File, error)

type StringColumn

type StringColumn struct{}

Jump to

Keyboard shortcuts

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