xlsx

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package xlsx mainly implements the stream/file interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInStream

func NewInStream(filename string) (file.InStream, error)

NewInStream - Creates an XLSX input stream named 'filename'.

func NewOutStream

func NewOutStream(filename string) (file.OutStream, error)

NewOutStream - Creates an XLSX output stream named 'filename'.

func NewWriter

func NewWriter(f *excelize.File, c *config.JSON) (file.StreamWriter, error)

NewWriter - Creates an XLSX stream writer using the file handle 'f' and configuration 'c'.

Types

type Column

type Column struct {
	Index  string `json:"index"`  // Column index, e.g., A, B, C, ..., AA, ...
	Type   string `json:"type"`   // Type (bool, bigInt, decimal, string, time)
	Format string `json:"format"` // Joda time format
	// contains filtered or unexported fields
}

Column represents column information

type Creator

type Creator struct {
}

Creator - A utility for creating XLSX output streams.

func (*Creator) Create

func (c *Creator) Create(filename string) (file.OutStream, error)

Create - Creates an XLSX output stream named 'filename'.

type InConfig

type InConfig struct {
	Columns    []Column `json:"column"`     // Column information array
	Sheet      string   `json:"sheet"`      // Sheet name
	NullFormat string   `json:"nullFormat"` // Null text
	StartRow   int      `json:"startRow"`   // Starting row for reading, starting from the 1st row
}

InConfig represents the input XLSX configuration

func NewInConfig

func NewInConfig(conf *config.JSON) (c *InConfig, err error)

NewInConfig creates a new input XLSX configuration based on the JSON configuration conf

type Opener

type Opener struct {
}

Opener - A utility for opening XLSX input streams.

func (*Opener) Open

func (o *Opener) Open(filename string) (file.InStream, error)

Open - Opens an XLSX input stream named 'filename'.

type OutConfig

type OutConfig struct {
	Columns    []Column `json:"column"`     // Column information array
	Sheets     []string `json:"sheets"`     // Sheet name
	NullFormat string   `json:"nullFormat"` // Null text
	HasHeader  bool     `json:"hasHeader"`  // Whether there is a column header
	Header     []string `json:"header"`     // Column header
	SheetRow   int      `json:"sheetRow"`   // Maximum number of rows in the sheet
}

OutConfig represents the output XLSX configuration

func NewOutConfig

func NewOutConfig(conf *config.JSON) (c *OutConfig, err error)

NewOutConfig creates a new output XLSX configuration based on the JSON configuration conf

type Rows

type Rows struct {
	*excelize.Rows
	// contains filtered or unexported fields
}

Rows - Represents a row reader for CSV data.

func NewRows

func NewRows(f *excelize.File, c *config.JSON) (rows *Rows, err error)

NewRows - Creates a row reader using the file handle 'f' and configuration 'c'.

func (*Rows) Scan

func (r *Rows) Scan() (columns []element.Column, err error)

Scan - Scans the data into columns.

type Stream

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

Stream - Represents an XLSX file stream.

func (*Stream) Close

func (s *Stream) Close() (err error)

Close - Closes the file stream.

func (*Stream) Rows

func (s *Stream) Rows(conf *config.JSON) (file.Rows, error)

Rows - Creates a new CSV row reader with the given configuration 'conf'.

func (*Stream) Writer

func (s *Stream) Writer(conf *config.JSON) (file.StreamWriter, error)

Writer - Creates a new XLSX stream writer with the given configuration 'conf'.

type Writer

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

Writer - Represents an XLSX stream writer.

func (*Writer) Close

func (w *Writer) Close() (err error)

Close - Closes the writer. If 'w.writer' is potentially null, flushes the file memory to a temporary file.

func (*Writer) Flush

func (w *Writer) Flush() (err error)

Flush - No flushing.

func (*Writer) Write

func (w *Writer) Write(record element.Record) (err error)

Write - Writes the record 'record' to the XLSX file.

Jump to

Keyboard shortcuts

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