-
Notifications
You must be signed in to change notification settings - Fork 9
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
dotnet edgeql tool #3
Open
quinchs
wants to merge
42
commits into
dev
Choose a base branch
from
feat/cli-tool
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
quinchs
force-pushed
the
feat/cli-tool
branch
from
November 7, 2022 19:16
68f82a0
to
a214b21
Compare
@quinchs I'd like to propose us adding another callable to the .NET domain for CLI commands and adding a new documentation page surrounding usage of all commands. EdgeDB already have a Sphinx reference as |
Is this tool already available or still in the works? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
As outlined in quinchs/EdgeDB.Net#21, this tool provides a way to create
.cs
files from.edgeql
files. All commands/parameters are up for change to meet consistency with other edgedb toolsCommands
The dotnet tools cli name is
edgedb-net
, mimic'ing the pythonsedgedb-py
command name.Generate
generate
is the main command to generate source files from edgeql.Arguments
Example
$ edgedb-net generate -o ~/myproject/src/generated
Connection uses the same resolution logic as the edgedb CLI tool, as well as the same arguments for specifying connection parameters.
Watch
The
watch
command is simply to start/stop/view the watcher for the current project.Arguments
Example
$ edgedb-net watch [18:56:09 INF] Watcher started for /My/Awesome/Project
Project root is located from the output directory, if none is specified then the current directory + namespace is used.
Generation structure
Code generation will generate a source file per edgeql file, ignoring files in
./dbschema/migrations/*
, each generated source file contains a class representing the result and a class containing execute methods. Here's an example:EdgeQL
Source file
A user consuming this generated file has two ways of using it:
Example app
An example application was made to test out the flow of code generation, this was the command used to generate
./EdgeDB.Generated
in that app: