sqlcx v1.0.0 Sqlcx

Summary

Functions

Create a new table name where table_opts are a list of table constraints and cols are a keyword list of columns. The following table constraints are supported: :temp and :primary_key. Example

Types

connection :: {:connection, reference, String.t}
sqlite_error :: {:error, {:sqlite_error, char_list}}
string_or_charlist :: String.t | char_list

Functions

close(db)

Specs

close(connection) :: :ok
create_table(db, name, table_opts \\ [], cols)

Create a new table name where table_opts are a list of table constraints and cols are a keyword list of columns. The following table constraints are supported: :temp and :primary_key. Example:

[:temp, {:primary_key, [:id]}]

Columns can be passed as:

  • name: :type
  • name: {:type, constraints}

where constraints is a list of column constraints. The following column constraints are supported: :primary_key, :not_null and :autoincrement. Example:

id: :integer, name: {:text, [:not_null]}

exec(db, sql)
open(path)

Specs

open(char_list) ::
  {:ok, connection} |
  {:error, {atom, char_list}}
open(String.t) :: {:ok, connection}
open_encrypted(path, password)
query(db, sql, opts \\ [])
query!(db, sql, opts \\ [])
rekey(db, password)

Specs

rekey(connection, String.t) :: :ok | sqlite_error
with_db(path, fun)
with_encrypted_db(path, password, fun)