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

internal/dinosql: Emit Querier interface #240

Merged
merged 2 commits into from
Jan 10, 2020
Merged

internal/dinosql: Emit Querier interface #240

merged 2 commits into from
Jan 10, 2020

Conversation

kyleconroy
Copy link
Collaborator

@kyleconroy kyleconroy commented Jan 9, 2020

Fixes #235

When emit_interface is true, output a Querier interface in the generated package. For the ondeck example, this interface is:

type Querier interface {
	CreateCity(ctx context.Context, arg CreateCityParams) (City, error)
	CreateVenue(ctx context.Context, arg CreateVenueParams) (int32, error)
	DeleteVenue(ctx context.Context, slug string) error
	GetCity(ctx context.Context, slug string) (City, error)
	GetVenue(ctx context.Context, arg GetVenueParams) (Venue, error)
	ListCities(ctx context.Context) ([]City, error)
	ListVenues(ctx context.Context, city string) ([]Venue, error)
	UpdateCityName(ctx context.Context, arg UpdateCityNameParams) error
	UpdateVenueName(ctx context.Context, arg UpdateVenueNameParams) (int32, error)
	VenueCountByCity(ctx context.Context) ([]VenueCountByCityRow, error)
}

@kyleconroy
Copy link
Collaborator Author

@myles-mcdonnell Is this what you're looking for?

@kyleconroy kyleconroy merged commit 79ec914 into master Jan 10, 2020
@kyleconroy kyleconroy deleted the emit-interface branch January 10, 2020 01:50
@myles-mcdonnell
Copy link

Hi Kyle, yes exactly what I'm looking for, thanks.

Slight problem though, one of my queries includes a uuid and the emitted source doesn't include the import statement for github.com/google/uuid .. I had a look to see if I could find how to fix this and raise a PR but to no avail.

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.

Queries interface
2 participants