-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new query API implementing a first version of generic filters. Some things are missing: - No subscriptions yet, almost there - No filters for multi type fields like messages, still thinking about how to implement the API to make it user friendly. Please, any feedback is welcome! Signed-off-by: Antonio Navarro Perez <[email protected]>
- Loading branch information
Showing
13 changed files
with
6,064 additions
and
585 deletions.
There are no files selected for viewing
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// go:build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/99designs/gqlgen/api" | ||
"github.com/99designs/gqlgen/codegen/config" | ||
"github.com/ajnavarro/gqlfiltergen" | ||
) | ||
|
||
func main() { | ||
cfg, err := config.LoadConfigFromDefaultLocations() | ||
if err != nil { | ||
fmt.Fprintln(os.Stderr, "failed to load config", err.Error()) | ||
os.Exit(2) | ||
} | ||
|
||
err = api.Generate(cfg, | ||
api.AddPlugin(gqlfiltergen.NewPlugin(&gqlfiltergen.Options{ | ||
Queries: []string{ | ||
` | ||
""" | ||
Fetches Blocks matching the specified where criteria. Incomplete results due to errors return both the partial Blocks and the associated errors. | ||
""" | ||
getBlocks(where: FilterBlock!): [Block!] | ||
`, ` | ||
""" | ||
Retrieves a list of Transactions that match the given where criteria. If the result is incomplete due to errors, both partial results and errors are returned. | ||
""" | ||
getTransactions(where: FilterTransaction!): [Transaction!] | ||
`, | ||
}, | ||
})), | ||
) | ||
if err != nil { | ||
fmt.Fprintln(os.Stderr, err.Error()) | ||
os.Exit(3) | ||
} | ||
} |
Oops, something went wrong.