Documentation
¶
Overview ¶
Package model provides domain model for filesql
Index ¶
- Constants
- Variables
- func IsSupportedFile(fileName string) bool
- func SupportedFileExtPatterns() []string
- func TableFromFilePath(filePath string) string
- type CompressionType
- type DumpOptions
- type File
- func (f *File) IsBZ2() bool
- func (f *File) IsCSV() bool
- func (f *File) IsCompressed() bool
- func (f *File) IsGZ() bool
- func (f *File) IsLTSV() bool
- func (f *File) IsTSV() bool
- func (f *File) IsXZ() bool
- func (f *File) IsZSTD() bool
- func (f *File) Path() string
- func (f *File) ToTable() (*Table, error)
- func (f *File) Type() FileType
- type FileType
- type Header
- type OutputFormat
- type Record
- type Table
Constants ¶
const ( // ExtCSV is the CSV file extension ExtCSV = ".csv" // ExtTSV is the TSV file extension ExtTSV = ".tsv" // ExtLTSV is the LTSV file extension ExtLTSV = ".ltsv" // ExtGZ is the gzip compression extension ExtGZ = ".gz" // ExtBZ2 is the bzip2 compression extension ExtBZ2 = ".bz2" // ExtXZ is the xz compression extension ExtXZ = ".xz" // ExtZSTD is the zstd compression extension ExtZSTD = ".zst" )
File extensions
Variables ¶
var ErrDuplicateColumnName = errors.New("duplicate column name")
ErrDuplicateColumnName is returned when a file contains duplicate column names
Functions ¶
func IsSupportedFile ¶
IsSupportedFile checks if the file has a supported extension
func SupportedFileExtPatterns ¶ added in v0.1.0
func SupportedFileExtPatterns() []string
SupportedFileExtPatterns returns all supported file patterns for glob matching
func TableFromFilePath ¶
TableFromFilePath creates table name from file path
Types ¶
type CompressionType ¶ added in v0.0.4
type CompressionType int
CompressionType represents the compression type
const ( // CompressionNone represents no compression CompressionNone CompressionType = iota // CompressionGZ represents gzip compression CompressionGZ // CompressionBZ2 represents bzip2 compression CompressionBZ2 // CompressionXZ represents xz compression CompressionXZ // CompressionZSTD represents zstd compression CompressionZSTD )
func (CompressionType) Extension ¶ added in v0.0.4
func (c CompressionType) Extension() string
Extension returns the file extension for the compression type
func (CompressionType) String ¶ added in v0.0.4
func (c CompressionType) String() string
String returns the string representation of CompressionType
type DumpOptions ¶ added in v0.0.4
type DumpOptions struct {
// Format specifies the output file format
Format OutputFormat
// Compression specifies the compression type
Compression CompressionType
}
DumpOptions represents options for dumping database
func NewDumpOptions ¶ added in v0.0.4
func NewDumpOptions() DumpOptions
NewDumpOptions creates new DumpOptions with default values (CSV format, no compression)
func (DumpOptions) FileExtension ¶ added in v0.0.4
func (o DumpOptions) FileExtension() string
FileExtension returns the complete file extension including compression
func (DumpOptions) WithCompression ¶ added in v0.0.4
func (o DumpOptions) WithCompression(compression CompressionType) DumpOptions
WithCompression sets the compression type
func (DumpOptions) WithFormat ¶ added in v0.0.4
func (o DumpOptions) WithFormat(format OutputFormat) DumpOptions
WithFormat sets the output format
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents a file that can be converted to Table
func (*File) IsCompressed ¶
IsCompressed returns true if file is compressed
type OutputFormat ¶ added in v0.0.4
type OutputFormat int
OutputFormat represents the output file format
const ( // OutputFormatCSV represents CSV output format OutputFormatCSV OutputFormat = iota // OutputFormatTSV represents TSV output format OutputFormatTSV // OutputFormatLTSV represents LTSV output format OutputFormatLTSV )
func (OutputFormat) Extension ¶ added in v0.0.4
func (f OutputFormat) Extension() string
Extension returns the file extension for the format
func (OutputFormat) String ¶ added in v0.0.4
func (f OutputFormat) String() string
String returns the string representation of OutputFormat