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: 9 Imported by: 0

Documentation

Overview

Package csv 提供写入 CSV 文件的 Sink

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// FilePath 输出文件路径
	FilePath string `json:"file_path"`
	// Separator 字段分隔符
	Separator string `json:"separator"`
	// Headers 指定列名顺序
	Headers []string `json:"headers"`
	// Append 是否追加模式
	Append bool `json:"append"`
	// FlushEvery 每写入多少条刷新一次
	FlushEvery int `json:"flush_every"`
}

Config Sink 的配置

type Sink

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

Sink 将数据写入 CSV 文件

func New

func New() *Sink

New 创建新的 Sink

func (*Sink) Close

func (s *Sink) Close() error

Close 关闭文件

func (*Sink) Consume

func (s *Sink) Consume(ctx context.Context, in <-chan types.Record) error

Consume 消费数据并写入 CSV 文件

func (*Sink) Count

func (s *Sink) Count() int

Count 返回已写入的记录数

func (*Sink) Init

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

Init 初始化 Sink

Jump to

Keyboard shortcuts

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