downraws

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

downraws

导出数据为 csv文件或xlsx文件。
控制单个文件中的数据量,并压缩为zip包。

Export data to csv or xlsx.
Control the amount of data in a single file and package it as zip

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDriverIsNotRegister            = errors.New("driver is not register")
	ErrProhibitLimitGreaterThanMaxRaw = errors.New("Prohibit limit greater than maxRaw")
)
View Source
var Drivers = map[string]Driver{}

Functions

This section is empty.

Types

type DownRaws

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

func New

func New(driverName, filename string, fn func(ctx context.Context, limit, offset int) ([][]interface{}, error), options ...Option) (*DownRaws, error)

func (*DownRaws) LoadData

func (r *DownRaws) LoadData(ctx context.Context) error

func (*DownRaws) WriteTo

func (r *DownRaws) WriteTo(writer io.Writer) (int64, error)

type Driver

type Driver interface {
	NewWriter() Writer
	Suffix() string
}

type Option

type Option func(r *DownRaws)

func SetFields

func SetFields(fields ...string) Option

func SetLimit

func SetLimit(limit int) Option

func SetMaxRaw

func SetMaxRaw(maxRaw int) Option

func SetOffset

func SetOffset(offset int) Option

type Writer

type Writer interface {
	Write(...interface{}) error
	WriteTo(io.Writer) (int64, error)
}

Directories

Path Synopsis
drivers

Jump to

Keyboard shortcuts

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