Skip to content

Data transformers #14

@Shadowfiend

Description

@Shadowfiend

It's not unusual to need to do additional transformation on data before considering it ingestible by a db or other system. A classic example is needing to trim user input before using it for e.g. a name. The proposal here is to allow a data transformer to be attached to a field; in this case, it seems like map might be a good metaphor:

  val nameField = field[String](".selector").map(_.trim) // => a field that trims its values

This also introduces the question of whether field should always default to String and allow using map to do data transformation to another type… For example:

  val thingField = field(".thing-id").map(Thing.findById) // => field[Thing]

I suppose this is might be making fields functors, but I also may not know what I'm talking about…

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