Documentation ¶
Overview ¶
Package load provides functions to load a protobuf message from different formats:
- generated fomats: json, bin, txt
- origin formats: xlsx, csv, xml, yaml.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FilterFunc ¶ added in v0.11.0
FilterFunc filter in messagers if returned value is true.
NOTE: name is the protobuf message name, e.g.: "message ItemConf{...}".
type Option ¶ added in v0.9.16
type Option func(*Options)
Option is the functional option type.
func Filter ¶ added in v0.11.0
func Filter(filter FilterFunc) Option
Filter can only filter in certain specific messagers based on the condition that you provide.
NOTE: only used in https://github.com/tableauio/loader.
func IgnoreUnknownFields ¶ added in v0.10.6
func IgnoreUnknownFields() Option
IgnoreUnknownFields ignores unknown JSON fields during parsing.
func LocationName ¶ added in v0.10.5
LocationName sets TZ location name for parsing datetime format.
func PatchPaths ¶ added in v0.11.0
PatchPaths maps each messager name to a corresponding patch file path. If specified, then main messager will patched.
NOTE: only JSON, Bin, and Text formats are supported.
func Paths ¶ added in v0.11.0
Paths maps each messager name to a corresponding config file path. If specified, then the main messager will be parsed from the file directly, other than the specified load dir.
NOTE: only JSON, Bin, and Text formats are supported.
func SubdirRewrites ¶ added in v0.9.16
SubdirRewrites rewrites subdir paths (relative to workbook name option in .proto file).
type Options ¶ added in v0.9.16
type Options struct { // Filter can only filter in certain specific messagers based on the // condition that you provide. // // NOTE: only used in https://github.com/tableauio/loader. // // Default: nil. Filter FilterFunc // Location represents the collection of time offsets in use in // a geographical area. // // If the name is "" or "UTC", LoadLocation returns UTC. // If the name is "Local", LoadLocation returns Local. // // Default: "Local". LocationName string // IgnoreUnknownFields signifies whether to ignore unknown JSON fields // during parsing. // // Default: false. IgnoreUnknownFields bool // SubdirRewrites rewrites subdir paths (relative to workbook name option // in .proto file). // // Default: nil. SubdirRewrites map[string]string // Paths maps each messager name to a corresponding config file path. // If specified, then the main messager will be parsed from the file // directly, other than the specified load dir. // // NOTE: only JSON, Bin, and Text formats are supported. // // Default: nil. Paths map[string]string // PatchPaths maps each messager name to a corresponding patch file path. // If specified, then main messager will patched. // // NOTE: only JSON, Bin, and Text formats are supported. // // Default: nil. PatchPaths map[string]string // PatchDir specifies the directory path for config patching. // // Default: "". PatchDir string }
func ParseOptions ¶ added in v0.9.16
ParseOptions parses functional options and merge them to default Options.