Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ID to use field.Other with custom types #2309

Merged
merged 4 commits into from
Feb 10, 2022
Merged

Conversation

crossworth
Copy link
Contributor

When using field.Other the generated code would cause problems on two instances:

https://github.com/crossworth/entissue2290/blob/042ee692b298775220878f08082e6592575eef58/ent/user_create.go#L231
image

https://github.com/crossworth/entissue2290/blob/042ee692b298775220878f08082e6592575eef58/ent/user.go#L56
image
Line 56: conversion from int64 to ID (string) yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)

I'm not sure if this is the best way to solve the problem, but I think we can assume that when the user use a field.Other it would not be ~int64.

This WILL NOT fix the problem when using GoType. The same problem happens, but I don't know how to solve, maybe a better approach would be to check the type.

Partial fix for: #2290

Copy link
Member

@a8m a8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing @crossworth ❤️

Thanks for the contribution!

entc/integration/customid/ent/schema/other.go Outdated Show resolved Hide resolved
crossworth and others added 2 commits February 9, 2022 19:27
Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
@a8m a8m merged commit f45d29b into ent:master Feb 10, 2022
@a8m
Copy link
Member

a8m commented Feb 10, 2022

@all-contributors please add @crossworth for code

@allcontributors
Copy link
Contributor

@a8m

I've put up a pull request to add @crossworth! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants