Documentation
¶
Index ¶
- Constants
- func NewExtendedSheetParser(ctx context.Context, protoPackage, locationName string, ...) *sheetParser
- func NewSheetExporter(outputDir string, output *options.ConfOutputOption, ...) *sheetExporter
- func NewSheetParser(ctx context.Context, protoPackage, locationName string, ...) *sheetParser
- func NewValidator(prFiles *protoregistry.Files) (protovalidate.Validator, error)
- func ParseFileOptions(fd protoreflect.FileDescriptor) (string, *tableaupb.WorkbookOptions)
- func ParseMessage(info *SheetInfo, messageCollector *xerrors.Collector, ...) (proto.Message, error)
- func ParseMessageOptions(md protoreflect.MessageDescriptor) (string, *tableaupb.WorksheetOptions)
- func Validate(msg proto.Message, validator protovalidate.Validator) error
- type Field
- type Generator
- type SheetInfo
- type SheetParserExtInfo
- type SourceLocation
Constants ¶
const Version = "0.10.0"
Variables ¶
This section is empty.
Functions ¶
func NewExtendedSheetParser ¶ added in v0.11.0
func NewExtendedSheetParser( ctx context.Context, protoPackage, locationName string, bookOpts *tableaupb.WorkbookOptions, sheetOpts *tableaupb.WorksheetOptions, extInfo *SheetParserExtInfo, source SourceLocation, ) *sheetParser
NewExtendedSheetParser creates a new sheet parser with extended info.
func NewSheetExporter ¶
func NewSheetExporter(outputDir string, output *options.ConfOutputOption, validator protovalidate.Validator, collector *xerrors.Collector) *sheetExporter
NewSheetExporter creates a new sheet exporter.
func NewSheetParser ¶
func NewSheetParser(ctx context.Context, protoPackage, locationName string, opts *tableaupb.WorksheetOptions) *sheetParser
NewSheetParser creates a new sheet parser.
func NewValidator ¶ added in v0.16.3
func NewValidator(prFiles *protoregistry.Files) (protovalidate.Validator, error)
NewValidator creates a protovalidate validator whose extension type resolver is built from prFiles, so custom predefined rules can be recognized. It is shared by both the confgen (generate) and load (checker) paths to keep validation behavior consistent.
func ParseFileOptions ¶ added in v0.9.0
func ParseFileOptions(fd protoreflect.FileDescriptor) (string, *tableaupb.WorkbookOptions)
ParseFileOptions parse the options of a protobuf definition file.
func ParseMessage ¶ added in v0.10.5
func ParseMessage(info *SheetInfo, messageCollector *xerrors.Collector, impInfos ...importer.ImporterInfo) (proto.Message, error)
ParseMessage parses multiple importer infos into one protomsg.
func ParseMessageOptions ¶ added in v0.9.0
func ParseMessageOptions(md protoreflect.MessageDescriptor) (string, *tableaupb.WorksheetOptions)
ParseMessageOptions parse the options of a protobuf message.
Types ¶
type Generator ¶
type Generator struct {
ProtoPackage string // protobuf package name.
InputDir string // input dir of workbooks.
OutputDir string // output dir of generated files.
LocationName string // TZ location name.
InputOpt *options.ConfInputOption // Input settings.
OutputOpt *options.ConfOutputOption // output settings.
ErrorLimitOpt *options.ErrorLimitOption // error collection limits.
// Sheet parser metrics.
SheetParserMetrics profile.SheetParserMetrics
// contains filtered or unexported fields
}
Generator converts workbook data for one generation run. Create a new Generator when another run is needed.
func NewGenerator ¶
func NewGeneratorWithOptions ¶ added in v0.9.14
func (*Generator) GenWorkbook ¶ added in v0.10.0
bookSpecifier can be:
- only workbook: excel/Item.xlsx
- with worksheet: excel/Item.xlsx#Item (To be implemented)
type SheetInfo ¶ added in v0.10.7
type SheetInfo struct {
ProtoPackage string
LocationName string
PrimaryBookName string
MD protoreflect.MessageDescriptor
BookOpts *tableaupb.WorkbookOptions
SheetOpts *tableaupb.WorksheetOptions
ExtInfo *SheetParserExtInfo
}
func (*SheetInfo) HasScatter ¶ added in v0.10.7
type SheetParserExtInfo ¶ added in v0.11.0
type SheetParserExtInfo struct {
InputDir string
SubdirRewrites map[string]string
PRFiles *protoregistry.Files
BookFormat format.Format // workbook format
DryRun options.DryRun
ErrorLimit *options.ErrorLimitOption // error collection limits
ReferredCache *fieldprop.ReferredCache
ImporterCache *importer.Cache
SheetParserMetrics *profile.SheetParserMetrics
}
SheetParserExtInfo holds dependencies shared by extended sheet parsers.
type SourceLocation ¶ added in v0.17.0
SourceLocation identifies the workbook and worksheet parsed by a sheet parser.