Skip to content

Add support for mapping struct fields by header index. #72

Open
@ArtuoS

Description

In scenarios where header names are randomly generated from an external source, it would be beneficial to unmarshal the CSV into a struct using the header index. Another scenario is when people use cleaning tools in the project (e.g., field alignment), the tool can reorganize the structs, making it difficult to maintain an exact order.

Struct example:

type User struct {
	Name string `index:"0"`
	Age  int    `index:"1"`
}

CSV example:

ax9KEfo,lo20dUta
James,22
Victoria,31

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions