Liking cljdoc? Tell your friends :D

fulcro-sql.core


column-speccljmultimethod

Get the column query specification for a given om prop. The omprop will be converted to an SQL :table/col property that may be a scalar value on table or a join. If it is a join, it will only return a value if the join has data on the table implied (e.g. isn't a reverse FK reference).

Get the column query specification for a given om prop. The omprop will be converted to an SQL :table/col property
that may be a scalar value on `table` or a join. If it is a join, it will only return a value if the join has
data on the `table` implied (e.g. isn't a reverse FK reference). 
sourceraw docstring

create-poolclj

(create-pool properties-file)

Create a HikariDataSource for connection pooling from a properties filename.

Create a HikariDataSource for connection pooling from a properties filename.
sourceraw docstring

id-columnsclj

(id-columns {:keys [:fulcro-sql.core/pks] :as schema})

Returns a set of table-namespaced keywords that are the ID columns for all tables.

Returns a set of table-namespaced keywords that are the ID columns for all tables.
sourceraw docstring

next-idclj

(next-id db schema table-kw)

Get the next generated ID for the given table.

NOTE: IF you specify the Java System Property dev, then this function will assume you are writing tests and will allocate extra IDs in order to prevent assertions on your generated IDs across tables from giving false positives (since all tables will start from ID 1). It does this by throwing away a random number of IDs, so that IDs across tables are less likely to be identical when an equal number of rows are inserted.

Get the next generated ID for the given table.

NOTE: IF you specify the Java System Property `dev`, then this function will assume you are writing tests and will
allocate extra IDs in order to prevent assertions on your generated IDs across
tables from giving false positives (since all tables will start from ID 1). It does this by throwing away a
random number of IDs, so that IDs across tables are less likely to be identical when an equal number of rows
are inserted.
sourceraw docstring

next-id*cljmultimethod

source

pk-columnclj

(pk-column schema table)
source

seed!clj

(seed! db schema rows)

Seed the given seed-row and seed-update items into the given database. Returns a map whose values will be the keyword placeholders for generated PK ids, and whose values are the real numeric generated ID:

(let [{:keys [id/sam id/joe]} (seed! db schema [(seed-row :account {:id :id/joe ...})
                                                (seed-row :account {:id :id/sam ...})]
  ...)
Seed the given seed-row and seed-update items into the given database. Returns a map whose values will be the
keyword placeholders for generated PK ids, and whose values are the real numeric generated ID:

```
(let [{:keys [id/sam id/joe]} (seed! db schema [(seed-row :account {:id :id/joe ...})
                                                (seed-row :account {:id :id/sam ...})]
  ...)
```
sourceraw docstring

seed-rowclj

(seed-row table value)

Generate an instruction to insert a seed row for a table, which can contain keyword placeholders for IDs. It is recommended you namespace your generated IDs into id so that substitution during seeding doesn't cause surprises. For example:

(seed-row :account {:id :id/joe ...})

If the generated IDs appear in a PK location, they will be generated (must be unique per seed set). If they are in a value column, then the current generated value (which must have already been seeded) will be used.

See also seed-update for resolving circular references.

Generate an instruction to insert a seed row for a table, which can contain keyword placeholders for IDs. It is
 recommended you namespace your generated IDs into `id` so that substitution during seeding doesn't cause surprises.
 For example:

```
(seed-row :account {:id :id/joe ...})
```

If the generated IDs appear in a PK location, they will be generated (must be unique per seed set). If they
are in a value column, then the current generated value (which must have already been seeded) will be used.

See also `seed-update` for resolving circular references.
sourceraw docstring

seed-updateclj

(seed-update table id value)

Generates an instruction to update a seed row (in the same seed set) that already appeared. This may be necessary if your database has referential loops.

(seed-row :account {:id :id/joe ...})
(seed-row :account {:id :id/sam ...})
(seed-update :account :id/joe {:last_edited_by :id/sam })

table should be a keyword form of the table in your database. id can be a real ID or a generated ID placeholder keyword (recommended: namespace it with id). value is a map of col/value pairs to update on the row.

Generates an instruction to update a seed row (in the same seed set) that already appeared. This may be necessary if your database has
referential loops.

```
(seed-row :account {:id :id/joe ...})
(seed-row :account {:id :id/sam ...})
(seed-update :account :id/joe {:last_edited_by :id/sam })
```

`table` should be a keyword form of the table in your database.
`id` can be a real ID or a generated ID placeholder keyword (recommended: namespace it with `id`).
`value` is a map of col/value pairs to update on the row.
sourceraw docstring

SQLDatabaseManagercljprotocol

get-dbspecclj

(get-dbspec this database-kw)

Get a clojure jdbc dbspec for the given database-kw.

Get a clojure jdbc dbspec for the given database-kw.

start-databasesclj

(start-databases this)

Create the connection pools and (optionally) run the migrations.

Create the connection pools and (optionally) run the migrations.
source

sqlizeclj

(sqlize schema kw)

Convert a keyword in clojure-form to sql-form. E.g. :account-id to :account_id

Convert a keyword in clojure-form to sql-form. E.g. :account-id to :account_id
sourceraw docstring

sqlize*cljmultimethod

source

table-forclj

(table-for schema query)

Scans the given Om query and tries to determine which table is to be used for the props within it.

Scans the given Om query and tries to determine which table is to be used for the props within it.
sourceraw docstring

table-for*cljmultimethod

source

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

× close