web-ridge / gqlgen-sqlboiler

This is a plugin for gqlgen to generate converts + filter queries and resolvers for sqlboiler
MIT License
74 stars 13 forks source link

Order of createdAt, deletedAt and updatedAt have different order if schema.graphql is re-generated #45

Closed frederikhors closed 3 years ago

frederikhors commented 3 years ago

I see some fields in the schema.graphql are written everytime in different order.

Example

  1. First time:
input UserWhere {
  id: IDFilter
  email: StringFilter
  password: StringFilter
  updatedAt: IntFilter // this is here now
  createdAt: IntFilter
}
  1. Second time:
input UserWhere {
  id: IDFilter
  email: StringFilter
  password: StringFilter
  createdAt: IntFilter
  updatedAt: IntFilter // this is here now
}

And so on...

This is a problem as you can imagine.

RichardLindhout commented 3 years ago

This is indeed a bug It's because the process interferes here and add the createdAt and updatedAt later https://github.com/web-ridge/gqlgen-sqlboiler/blob/main/sqlboiler.go#L241

But it does not work since golang maps are randomly sorted so this needs to change, I'm a little short on time at the moment maybe you could create a PR to fix this.

I think it would be fixed if instead of 1000000 + i we would do 100 * i

RichardLindhout commented 3 years ago

This should be fixed in development, will let you know when it is released

RichardLindhout commented 3 years ago

Should be fixed in 3.1.0