Skip to content

proposal: Allow for primitives & fmt.Stringer in addition to string in templates #746

@delaneyj

Description

@delaneyj

Discussion happened previous at #609 but focused on integers. I understand @a-h position on clarity around integers and currency. It seems like in the currency case having a type Currency int64 with a String() string function would allow it to be a valid fmt.Stringer and avoid ambiguity. Personally i'd like to see all primitive types and fmt.Stringer accepted by the template. Since the code is generated you aren't paying the reflection cost each time. strconv already has functions for Bool, Float, Int, etc. If you want to have more control, implement the Stringer interface

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