yesodweb / yesodweb/persistent

Per entity field prefix?

Open
#776 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Newcomer
Dominant language
Haskell
Stars
486
Forks
306
PR merge metrics
No merged PRs in 30d

Description

I found out about mpsPrefixFields setting, making it possible to control prefixing of fields with entity name. I wonder if its possible to prefix field accessors / lenses, per entity, with something else than entity name? Ive a bunch of types with accessors prefixed by "_" <acronym> "_". Like User's "name" field is _u_name and GameLog "command" field is _gl_command.

...and keep sql column names and json fields use the non prefixed names. Ie. if ive provided "name" in my record descripton that will be used, as is, for sql and json.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing mpsPrefixFields setting and how entity field accessors or lenses are generated. Define how a per-entity accessor prefix would work while keeping the record description's names unchanged for SQL columns and JSON fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.