xlsxgen

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestParseFileOptions

func TestParseFileOptions(fd protoreflect.FileDescriptor) (string, *tableaupb.WorkbookOptions)

TestParseFileOptions is aimed to parse the options of a protobuf definition file.

func TestParseMessageOptions

func TestParseMessageOptions(md protoreflect.MessageDescriptor) (string, string, int32, int32, int32, bool)

TestParseMessageOptions is aimed to parse the options of a protobuf message.

Types

type Cell

type Cell struct {
	Data string
}

type Generator

type Generator struct {
	ProtoPackage string // protobuf package name.
	InputDir     string // input dir of workbooks.
	OutputDir    string // output dir of generated protoconf files.
	Workbook     string // Workbook name
}

func (*Generator) ExportSheet

func (gen *Generator) ExportSheet(metaSheet *MetaSheet) error

ExportSheet export a worksheet.

func (*Generator) Generate

func (gen *Generator) Generate()

func (*Generator) TestParseFieldOptions

func (gen *Generator) TestParseFieldOptions(md protoreflect.MessageDescriptor, row *[]Cell, depth int, prefix string)

TestParseFieldOptions is aimed to parse the options of all the fields of a protobuf message.

type MetaSheet

type MetaSheet struct {
	Worksheet string // worksheet name
	options.HeaderOption
	Transpose bool // interchange the rows and columns

	Rows []Row
	// contains filtered or unexported fields
}

func NewMetaSheet

func NewMetaSheet(worksheet string, header *options.HeaderOption, transpose bool) *MetaSheet

func (*MetaSheet) Cell

func (sheet *MetaSheet) Cell(row int, col int, name string) *Cell

Cell get the cell named `name` in the row `row` If not exists, insert empty type and note to the cell located in (row, col)

func (*MetaSheet) ForEachCol

func (sheet *MetaSheet) ForEachCol(rowId int, f func(name string, cell *Cell) error) error

func (*MetaSheet) GetColType

func (sheet *MetaSheet) GetColType(col string) string

func (*MetaSheet) GetDefaultValue

func (sheet *MetaSheet) GetDefaultValue(col string) string

func (*MetaSheet) GetLastColName

func (sheet *MetaSheet) GetLastColName() string

func (*MetaSheet) HasCol added in v0.9.1

func (sheet *MetaSheet) HasCol(name string) bool

func (*MetaSheet) NewRow

func (sheet *MetaSheet) NewRow() *Row

func (*MetaSheet) SetColNote

func (sheet *MetaSheet) SetColNote(col, note string)

func (*MetaSheet) SetColType

func (sheet *MetaSheet) SetColType(col, typ string)

func (*MetaSheet) SetDefaultValue

func (sheet *MetaSheet) SetDefaultValue(col, defaultVal string)

type Row

type Row struct {
	Cells []Cell
	Index int
}

Jump to

Keyboard shortcuts

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