Functions
makeSqlmancerSchema
Sqlmancer uses schema directives to do its magic, so these have to be added to your schema. This function is a convenient wrapper around makeExecutableSchema
that does that for you. For configuration options, see here.
createSqlmancerClient
This function builds a database client from your type definitions and an instance of Knex. The glob pattern you provide should match the relative path of any type definitions you want Sqlmancer to parse. The type definitions may either be plain text files (for example .graphql
files) or JavaScript or TypeScript files. If you target JavaScript or TypeScript files, make sure your type definitions are defined using the graphql-tag template literal tag.
The initialized client object includes a models
map. Each model exposes several CRUD methods, each of which will return an appropriate query builder instance. The available methods for these query builders are described here.
If you're using TypeScript, the type for your client instance can be generated using the CLI.