csv

package
v0.0.0-...-83b8ea0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package csv provides a CSV data source for go-fastreport. It is the Go equivalent of FastReport.Data.CsvDataConnection.

Package csv is part of the go-fastreport library, a pure Go port of FastReport .NET.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVDataSource

type CSVDataSource struct {
	data.BaseDataSource
	// contains filtered or unexported fields
}

CSVDataSource is a DataSource backed by a CSV file or string. The first row is treated as a header row by default (HasHeader = true).

func New

func New(name string) *CSVDataSource

New creates a CSVDataSource with the given name.

func NewFromConnectionString

func NewFromConnectionString(name, connectionString string) *CSVDataSource

NewFromConnectionString creates a CSVDataSource from a FastReport connection string (e.g. "CsvFile=/data.csv;Separator=,;FieldNamesInFirstString=true"). This mirrors the C# CsvDataConnection constructor + property setters pattern, where each property setter calls CheckForChangeConnection(builder) to normalise and persist the connection string.

func (*CSVDataSource) CSV

func (c *CSVDataSource) CSV() string

CSV returns the raw CSV string.

func (*CSVDataSource) Comment

func (c *CSVDataSource) Comment() rune

Comment returns the comment character.

func (*CSVDataSource) ConvertFieldTypes

func (c *CSVDataSource) ConvertFieldTypes() bool

ConvertFieldTypes returns whether automatic type conversion is enabled.

func (*CSVDataSource) FilePath

func (c *CSVDataSource) FilePath() string

FilePath returns the CSV file path.

func (*CSVDataSource) HasHeader

func (c *CSVDataSource) HasHeader() bool

HasHeader returns whether the first row is treated as a header.

func (*CSVDataSource) Init

func (c *CSVDataSource) Init() error

Init loads and parses the CSV, populating the in-memory row store.

func (*CSVDataSource) LazyQuotes

func (c *CSVDataSource) LazyQuotes() bool

LazyQuotes returns whether relaxed quote parsing is enabled.

func (*CSVDataSource) Separator

func (c *CSVDataSource) Separator() rune

Separator returns the column delimiter.

func (*CSVDataSource) SetCSV

func (c *CSVDataSource) SetCSV(s string)

SetCSV sets a raw CSV string as the data source.

func (*CSVDataSource) SetComment

func (c *CSVDataSource) SetComment(r rune)

SetComment sets the comment character (0 = disabled).

func (*CSVDataSource) SetConvertFieldTypes

func (c *CSVDataSource) SetConvertFieldTypes(v bool)

SetConvertFieldTypes enables automatic type inference per column. When true, Init() will attempt to convert each column to int, float64, or time.Time — falling back to string — matching C# DetermineTypes logic. See csv_convert.go for the inference algorithm.

func (*CSVDataSource) SetFilePath

func (c *CSVDataSource) SetFilePath(path string)

SetFilePath sets the CSV file path.

func (*CSVDataSource) SetHasHeader

func (c *CSVDataSource) SetHasHeader(v bool)

SetHasHeader sets whether the first row is a header row (default: true).

func (*CSVDataSource) SetLazyQuotes

func (c *CSVDataSource) SetLazyQuotes(v bool)

SetLazyQuotes enables relaxed quote parsing.

func (*CSVDataSource) SetSeparator

func (c *CSVDataSource) SetSeparator(r rune)

SetSeparator sets the column delimiter rune (default: ',').

type ConnectionStringBuilder

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

func NewConnectionStringBuilder

func NewConnectionStringBuilder(connectionString string) *ConnectionStringBuilder

func (*ConnectionStringBuilder) Codepage

func (b *ConnectionStringBuilder) Codepage() int

func (*ConnectionStringBuilder) ConvertFieldTypes

func (b *ConnectionStringBuilder) ConvertFieldTypes() bool

func (*ConnectionStringBuilder) CsvFile

func (b *ConnectionStringBuilder) CsvFile() string

func (*ConnectionStringBuilder) CurrencyFormat

func (b *ConnectionStringBuilder) CurrencyFormat() string

func (*ConnectionStringBuilder) DateTimeFormat

func (b *ConnectionStringBuilder) DateTimeFormat() string

func (*ConnectionStringBuilder) FieldNamesInFirstString

func (b *ConnectionStringBuilder) FieldNamesInFirstString() bool

func (*ConnectionStringBuilder) NumberFormat

func (b *ConnectionStringBuilder) NumberFormat() string

func (*ConnectionStringBuilder) RemoveQuotationMarks

func (b *ConnectionStringBuilder) RemoveQuotationMarks() bool

func (*ConnectionStringBuilder) Separator

func (b *ConnectionStringBuilder) Separator() string

func (*ConnectionStringBuilder) SetCodepage

func (b *ConnectionStringBuilder) SetCodepage(v int)

SetCodepage sets the Codepage property.

func (*ConnectionStringBuilder) SetConvertFieldTypes

func (b *ConnectionStringBuilder) SetConvertFieldTypes(v bool)

SetConvertFieldTypes sets the ConvertFieldTypes property.

func (*ConnectionStringBuilder) SetCsvFile

func (b *ConnectionStringBuilder) SetCsvFile(v string)

SetCsvFile sets the CsvFile property.

func (*ConnectionStringBuilder) SetCurrencyFormat

func (b *ConnectionStringBuilder) SetCurrencyFormat(v string)

SetCurrencyFormat sets the CurrencyFormat locale property.

func (*ConnectionStringBuilder) SetDateTimeFormat

func (b *ConnectionStringBuilder) SetDateTimeFormat(v string)

SetDateTimeFormat sets the DateTimeFormat locale property.

func (*ConnectionStringBuilder) SetFieldNamesInFirstString

func (b *ConnectionStringBuilder) SetFieldNamesInFirstString(v bool)

SetFieldNamesInFirstString sets the FieldNamesInFirstString property.

func (*ConnectionStringBuilder) SetNumberFormat

func (b *ConnectionStringBuilder) SetNumberFormat(v string)

SetNumberFormat sets the NumberFormat locale property.

func (*ConnectionStringBuilder) SetRemoveQuotationMarks

func (b *ConnectionStringBuilder) SetRemoveQuotationMarks(v bool)

SetRemoveQuotationMarks sets the RemoveQuotationMarks property.

func (*ConnectionStringBuilder) SetSeparator

func (b *ConnectionStringBuilder) SetSeparator(v string)

SetSeparator sets the Separator property.

func (*ConnectionStringBuilder) String

func (b *ConnectionStringBuilder) String() string

String serialises the builder back to a FastReport connection string. Mirrors C# CsvConnectionStringBuilder.ToString() used by CheckForChangeConnection. Only keys that have been explicitly set are included.

Jump to

Keyboard shortcuts

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