GraphJin can be used as a library in an already existing project. The best part is that your API need not even be a GraphQL one. You can simply use GraphJin as an alternative to a GO ORM library or directly writing SQL. The following code is just a simple example:
The configuration is the same as that in yaml except for that it is obviously written in Go and is just about configuring the
core package (aka GraphJin library). We've tried to ensure that the config file is self-documenting and easy to work with. A config object is not required GraphJin can learn your database structure and be useful even when a config is not provided.
If you're using a Postgres schema other than the default
public then in addition to setting the
DBSchema config param you also have to set the
search_path runtime parameter on the DB connection itself. https://github.com/dosco/graphjin/issues/134#issuecomment-659562003