You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to map the data to the collect structure when parsing the ImportExtension field, so that I can quickly determine whether the table is supported at runtime. Unfortunately, I have tried a lot of methods and cannot call back the UnmarshalText method during parsing. What should I do? I can't parse the data through the UnmarshalTOML implementation interface because I actually have a lot of configuration
Example:
package main
import (
"github.com/BurntSushi/toml"
"log"
)
type collect struct {
Set map[string]any
}
type contacts struct {
Source string
ImportExtension collect
}
func (c *collect) UnmarshalText(v []byte) error {
// It won't be called here
return nil
}
func main() {
blob := `
source = "./samples/"
import_extension = ["csv", "xlsx"]
`
var c contacts
_, err := toml.Decode(blob, &c)
if err != nil {
log.Fatal(err)
}
}
The text was updated successfully, but these errors were encountered:
I want to map the data to the collect structure when parsing the ImportExtension field, so that I can quickly determine whether the table is supported at runtime. Unfortunately, I have tried a lot of methods and cannot call back the UnmarshalText method during parsing. What should I do? I can't parse the data through the UnmarshalTOML implementation interface because I actually have a lot of configuration
Example:
The text was updated successfully, but these errors were encountered: