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

Broken graphql.NoCache implementation #3331

Closed
adomaskizogian opened this issue Oct 15, 2024 · 1 comment · Fixed by #3332
Closed

Broken graphql.NoCache implementation #3331

adomaskizogian opened this issue Oct 15, 2024 · 1 comment · Fixed by #3332

Comments

@adomaskizogian
Copy link
Contributor

adomaskizogian commented Oct 15, 2024

graphql.NoCache[T,T2] struct implements graphql.Cache[T] interface but it is not assignable to any of the internally used fields. For example it is not possible to assign NoCache as apq cache. There's no way to instantiate NoCache with value type values. Only with pointer values.

Specifying key type on graphql.NoCache[T,T2], // NoCache[T any, T2 *T] forces the value of cache to be a pointer of key type. For example:
graphql.NoCache[string, *string].

A code snippet like bellow is not possible:

var cache graphql.Cache[string]
if config.UseAPQ {
  cache = &graphql.MapCache[string]{}
} else {
  cache = &graphql.NoCache[string]{}
}

Internally all caches use string type keys.

Type definitions were changed with #3179

@adomaskizogian
Copy link
Contributor Author

cc @sylr

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 a pull request may close this issue.

1 participant