Liking cljdoc? Tell your friends :D

Configuration

Though there are multiple options for customization, the only config parameter required for Phrag is a database connection.

Parameters

KeydescriptionRequiredDefault Value
:dbDatabase connection ({:connection object}) or data source object ({:datasource object}). Hikari-CP datasource is much more performant than a JDBC connection especially under loads.Yes
:tablesList of custom table definitions. Plz check Schema Data for details.No
:signalsMap of singal functions per table, operation and timing. Plz check Interceptor Signals for details.No
:signal-ctxAdditional context to be passed into signal functions. Plz check Interceptor Signals for details.No
:default-limitDefault number for SQL LIMIT value to be applied when there's no :limit argument is specified in a query.Nonil
:max-nest-levelMaximum nest level allowed. This is to avoid infinite nesting. Errors will be returned when nests in requests exceed the value.Nonil
:use-aggregationtrue if aggregation is desired on root entity queries and has-many relationships.Notrue
:scan-tablestrue if DB schema scan is desired for tables in GraphQL.Notrue
:scan-viewstrue if DB schema scan is desired for views in GraphQL.Notrue
:graphql-pathPath for Phrag's GraphQL when a route is desired through phrag.route functions.No/graphql

Schema Data

By default, Phrag retrieves DB schema data from a DB connection and it is sufficient to construct GraphQL. Yet it is also possible to provide custom schema data, which can be useful to exclude certain tables, columns and/or relationships from specific tables. Custom schema data can be specified as a list of tables under :tables key in the config map.

{:tables [
   {:name "users"
    :columns [{:name "id"
       	       :type "int"
               :notnull 0
               :dflt_value nil}
              {:name "image_id"
               :type "int"
               :notnull 1
               :dflt_value 1}
	           ;; ... more columns
	           ]
    :fks [{:table "images" :from "image_id" :to "id"}]
    :pks [{:name "id" :type "int"}]}
    ;; ... more tables
    ]}

Table Data Details:

KeyDescription
:nameTable name.
:columnsList of columns. A column can contain :name, :type, :notnull and :dflt_value parameters.
:fksList of foreign keys. A foreign key can contain :table, :from and :to parameters.
:pksList of primary keys. A primary key can contain :name and :type parameters.

Notes:

  • When :scan-schema is false, Phrag will construct GraphQL from the provided table data only.
  • When :scan-schema is true, provided table data will override scanned table data per table property: :name, :table-type, :columns, :fks and :pks.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close