Describe the feature

  1. Allow callers to specify how to generate utils.ToStringKey if foreignKey is a string.

Motivation

  • MySQL is not case-sensitive unless you add the "BINARY" setting.
  • For this reason, if the foreignKey type is string, the Association feature is not available.
  • Therefore, we would like to be able to operate on key that are generated from foreignKey in utils.ToStringKey with functional pattern.

Related Issues

Comment From: github-actions[bot]

This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days

Comment From: twocs

@shinngohamatani Is this the same issue? In mysql with string keys, sometimes they are "On Sale" and other times "On sale" (notice capital Sale and lowercase sale), and when we preload, we see an error: failed to assign association \u0026main.Tag{KeyName:\"tags\", Value:\"On Sale\"}, make sure foreign fields exists To fix the problem I need to update all Value to exact match (case sensitive) but I expect that it should be case insensitive.

Comment From: infklinger

@shinngohamatani Is this the same issue? In mysql with string keys, sometimes they are "On Sale" and other times "On sale" (notice capital Sale and lowercase sale), and when we preload, we see an error: failed to assign association \u0026main.Tag{KeyName:\"tags\", Value:\"On Sale\"}, make sure foreign fields exists To fix the problem I need to update all Value to exact match (case sensitive) but I expect that it should be case insensitive.

I think it is, we have the same problem. Very annoying to get around this.

Comment From: cajund

I've verified this - using UUID strings as FK's - all need to be the same case, or this error happens. I'm using Preload to get my child records.