gin icon indicating copy to clipboard operation
gin copied to clipboard

TextUnmarshaler support for binding

Open ssoroka opened this issue 2 years ago • 19 comments

  • Adds encoding.TextUnmarshaler checking to support unmarshaling custom non-struct types.
  • Adds binding.BindUnmarshaler to support unmarshaling custom structs (from the suggestion in #2673)

As of this PR you can support any kind of custom type without breaking support for time.Time and other structs that might implement TextUnmarshaler

Closes #2673 Closes #2631

ssoroka avatar Feb 01 '22 18:02 ssoroka

@kszafran I think I've addressed all your feedback. Mind taking another look?

ssoroka avatar Mar 18 '22 03:03 ssoroka

@thinkerou when you have a chance, could you review/merge/tag another maintainer?

ssoroka avatar Mar 21 '22 15:03 ssoroka

Looks like an essential feature to have. @ssoroka Could you squash your commits as requested per CONTRIBUTING.md? @thinkerou @appleboy Could you check out this when you have time?

amahiwa-jp avatar Apr 06 '22 23:04 amahiwa-jp

@amahiwa-jp I've squashed the commits into a single commit

ssoroka avatar Apr 09 '22 01:04 ssoroka

ETA for this?

dcrystalj avatar Oct 12 '22 10:10 dcrystalj

Updates?

duaneking avatar Oct 12 '22 18:10 duaneking

Any update on when it can be merged?

brokeyourbike avatar Nov 09 '22 14:11 brokeyourbike

Is there anything I can contribute to help get this merged?

steveadams avatar Nov 23 '22 19:11 steveadams

To make it work with arrays []uuid.UUID we might add to func setWithProperType:

	case reflect.Array:
		if a, e := trySetCustom(val, value); a || e != nil {
			return e
		}
		return errUnknownType

AnatolyUA avatar Mar 16 '23 19:03 AnatolyUA

Any update on this?

eloyekunle avatar Apr 06 '23 00:04 eloyekunle

Any update?

minghan9456 avatar Apr 26 '23 02:04 minghan9456

What are the perf changes for this update?

How much does it slow down binding for other things?

duaneking avatar Apr 26 '23 16:04 duaneking

@appleboy @thinkerou @javierprovecho Any update on this?

phenixrizen avatar May 18 '23 17:05 phenixrizen

Again, What is the perf change of this?

Have you done the work to assure it does not slow other things down?

duaneking avatar May 19 '23 23:05 duaneking

I don't see any performance impact to this. I've been using this in production for a year and a half at this point. Maybe someone could pick it up, update it, and merge it?

ssoroka avatar Sep 07 '23 20:09 ssoroka

@ssoroka I don't know why I can't review the PR? Can you create a new PR?

appleboy avatar Apr 06 '24 14:04 appleboy