gocarina / gocsv

The GoCSV package aims to provide easy CSV serialization and deserialization to the golang programming language
MIT License
1.99k stars 245 forks source link

Respect csv ignore tag #224

Closed MJacred closed 2 years ago

MJacred commented 2 years ago

We auto-create structs using https://github.com/volatiletech/sqlboiler.
And load in data using e.g. csv via gocsv.

For sqlboiler to work, they have R and L fields. Those fields are other structs (or pointer to them). And the relation can circle.

This results for some structs in infinity loops.

Respecting the csv ignore "-" would resolve this.
This PR aims to do that.
After running our code we get no more infinity loops.

example output struct

type Pilot struct {
  ID   int    `boil:"id" json:"id" toml:"id" yaml:"id"`
  Name string `boil:"name" json:"name" toml:"name" yaml:"name"`

  R *pilotR `boil:"-" json:"-" toml:"-" yaml:"-"`
  L pilotR  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Probably fixes #168

pikanezi commented 2 years ago

Make sure that the tests pass, then I will merge it.

Thanks

pikanezi commented 2 years ago

thanks