csv

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package csv 提供从 CSV 文件读取数据的 Source

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// FilePath CSV 文件路径,支持 glob 模式
	FilePath string `json:"file_path"`
	// Separator 字段分隔符,默认为逗号
	Separator string `json:"separator"`
	// HasHeader 是否有标题行,默认 true
	HasHeader bool `json:"has_header"`
	// SkipRows 跳过的行数(在标题行之前)
	SkipRows int `json:"skip_rows"`
	// ColumnTypes 列类型映射,如 {"id": "int", "price": "float"}
	ColumnTypes map[string]string `json:"column_types"`
}

Config Source 的配置

type Source

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

Source 从 CSV 文件读取数据

func New

func New() *Source

New 创建新的 Source

func (*Source) Init

func (s *Source) Init(config []byte) error

Init 初始化 Source

func (*Source) Read

func (s *Source) Read(ctx context.Context, out chan<- types.Record) (int64, error)

Read 从 CSV 文件读取数据

Jump to

Keyboard shortcuts

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