Skip to content

Why there are "each" versions of functions? #3

@mitar

Description

@mitar

I think it could be simplified so that one could do:

type PageData struct {
	Link    string   `pagser:"a->attr(href)"`
	Links   []string `pagser:"a->attr(href)"`
}

The package could inspect the type associated with the tag and if it is slice, automatically assume "each" behavior. In general I think all functions should be returning slices, which then optionally are converted to an individual value (by default the first one, but you could set using ->Eq some other index).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions