8000 Custom Tag Name · Issue #27 · go-faker/faker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Custom Tag Name #27
Open
Open
@hohmannr

Description

@hohmannr

I am running currently into the following problem: I am trying to generate different fake data for different API endpoints, that revolve around the same data object, where the data object looks slightly different, depending from which endpoint it was created.

Example

type Data struct {
    Source string `faker:"source"`
    // ...
}

source is a custom tag, that returns a hard-coded string like "Gateway" or "InternalAPI". Since this string varies, I cannot easily generate custom fake data for all the sources. This would be solved if one could set the tag name when generating the data, ergo:

type Data struct {
    Source string `faker_api:"source_api" faker_gateway:"source_gateway"`
    // ...
}

The ability to set a custom tag name via the options.OptionFunc would be ideal to solve this use-case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0