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

Rework the type system #28

Merged
merged 1 commit into from
May 15, 2019
Merged

Rework the type system #28

merged 1 commit into from
May 15, 2019

Conversation

vektah
Copy link
Owner

@vektah vektah commented May 15, 2019

This is a pretty large refactor of dataloaden that allows arbitrary types for keys and values.

This removes -slice and -key entirely, and replaces them with 3 mandatory positional arguments:

  • name: The name to use when generating types and constructors
  • key type: the key type as a string in the format (*[])(package.)TypeName
  • value type: the key type as a string in the format (*[])(package.)TypeName

Unlike before with -slice and -ptr these can be nested arbitrarily deeply, for example *[][][]*github.com/my/damn.User is now valid.

for example what used to be

dataloaden -keys int -slice github.com/vektah/dataloaden/example.User	

is now

dataloaden UserSliceLoader int []github.com/vektah/dataloaden/example.User

Replaces #24
Fixes #20

@codecov
Copy link

codecov bot commented May 15, 2019

Codecov Report

Merging #28 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #28   +/-   ##
=======================================
  Coverage   85.57%   85.57%           
=======================================
  Files           2        2           
  Lines         104      104           
=======================================
  Hits           89       89           
  Misses         15       15
Impacted Files Coverage Δ
example/user.go 0% <ø> (ø) ⬆️
example/userloader_gen.go 94.68% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f86e10...a19b9a6. Read the comment docs.

@vektah vektah mentioned this pull request May 15, 2019
@vektah vektah merged commit 9d6b85c into master May 15, 2019
@vektah vektah deleted the rework-types branch May 15, 2019 04:50
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.

Ability to change the name of the generated loader
2 participants