Liking cljdoc? Tell your friends :D

How seaquell Namespaces are Organized

Source Files

Here’s how the src files are organized.

core.clj

Defines the primary DSL syntax for creating, rendering, and executing SQL statements.

edit.clj

Provides a number of public API functions for altering existing select statements.

to_sql.clj

Transforms SQL statement values (maps) into SQL strings.

raw.clj

Transforms sequences of SQL tokens to SQL strings and provides a number of helper functions for defining parenthesized value tuples.

engine.clj

Executes SQL strings using the clojure.java.jdbc library.

util.clj

Provides a number of internal utility functions, mostly predicates, used by other seaquell namespaces.

spec.clj

Uses clojure.spec.alpha to define specs for some of the DSL.

sqlite.clj

Provides a few public functions for working with SQLite databases.

seaquell.zoo

Provides solutions to a number of SQLZoo tutorials on using select statements.

Test Files

Here’s how the test files are organized.

Core Tests

The two files below comprised the primary DSL tests in early versions of seaquell. This approach tested the generation of SQL values and the tranformation of SQL values separately. However, in my opinion, reading these tests is of more value to a developer than a user and recent tests are targeted more toward library users.

core_test

Tests that core DSL syntax functions produce the correct data value.

to_sql_test

Tests the transformation of SQL data values (statements, clauses, and properties) to SQL strings.

Supplemental Tests

edit_test

Incomplete testing of some of the functions used to edit select statements.

raw_fn_test

Tests the public raw function.

raw_test

Tests the use of SQL tokens.

sql_ex_pieces_providers

Uses an in-memory database to work through an exercise on using SQL CRUD operations.

sqlite_test

Tests some of the functions in the sqlite namespace.

Statement Tests

My testing philosophy has evolved since starting the project. With more recent commits, the primary purpose of the tests is to show how to use the DSL. The secondary purpose is to confirm the DSL works as intended. Newer tests exercise statement creation and rendering or execution together, rather than separately. As a consequence, newer tests may be closer to integration tests than unit tests, but they work better to document DSL usage.

The following seaquell namespaces use the new approach:

Can you improve this documentation?Edit on GitHub

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

× close