API Reference for Jorm.jl

Jorm.RawSQLType
struct RawSQL  
    value: String

A struct to hold raw SQL Queries

source
Jorm.backup_postgresql_dbFunction
backup_postgresql_db(db_name::String, host::String="localhost", user::String="postgres", password::String="", backup_file::String="backup.sql") 
# Usage
backup_postgresql_db("mydb", "localhost", "postgres", "mypassword", "backup.sql")
source
Jorm.backup_sqlite_dbMethod
backup_sqlite_db(db::SQLite.DB, model) 
# usage
backup_sqlite_db("example.db", "example_backup.db")
source
Jorm.connectMethod
connect(connection_string::String)
    -> LibPQ.Connection

Establish a connection to an SQLite database using the provided connection string.

source
Jorm.connectMethod
connect(connection_string::String)
    -> SQLite.DB

Establish a connection to an SQLite database using the provided connection string.

source
Jorm.create_tableMethod
create_table(db::SQLite.DB, model, tableName)
Creates a table in the database based on the model.
source
Jorm.delete!Method
delete!(db::SQLite.DB, model, id)
Delete data for a given model
source
Jorm.delete_all!Method
delete_all(db::SQLite.DB, model) 
Deletes all data in the table for the given model
source
Jorm.delete_dbMethod
delete_db(connection_string::Jorm.PostgreSQLConnectionString)
Deletes or removes a an PostgreSQL database
source
Jorm.delete_dbMethod
delete_db(connection_string::Jorm.SQLiteConnectionString)
Deletes or removes a an sqlite database
source
Jorm.disconnectMethod
disconnect(db::LibPQ.Connection)
    -> Nothing

Close the connection to the PostgreSQL database.

source
Jorm.disconnectMethod
disconnect(db::SQLite.DB)
    -> Nothing

Close the connection to the SQLite database.

source
Jorm.drop_all_tablesMethod
drop_all_tables(connection_string::SQLiteConnectionString) 
Delete or Drop all tables for a given table
source
Jorm.execute_queryFunction
execute_query(db::SQLite.DB, query::RawSQL, params::Vector{Any}=Any[]) 
Returns the executed sql
source
Jorm.execute_queryFunction
execute_query(db::LibPQ.Connection, query::RawSQL, params::Vector{Any}=Any[]) 
Returns the executed sql
source
Jorm.filter_byMethod
filter_by(db::SQLite.DB, model, table_name; kwargs...) 
Returns the result of the given condition from the Database. This uses `SELECT`
source
Jorm.getfirstMethod
getfirst(db::SQLite.DB, model, column,value) 
Returns a given model object when given the column and the search value
source
Jorm.groupby_sqlMethod
groupby_sql(table_name; group_by_columns, select_columns = "*", having_conditions = nothing, order_by_columns = nothing) 
Returns the result of the given condition from the Database. This uses `SELECT`
source
Jorm.insert!Method
insert!(db::SQLite.DB, model::Type, data) 
Insert or Add data to the DB for a given model
source
Jorm.list_tablesMethod
list_tables(connection_string::SQLiteConnectionString) 
Returns the list of tables in DB
source
Jorm.ls_tablesMethod
ls_tables(connection_string::SQLiteConnectionString) 
Returns the list of tables in DB
source
Jorm.read_allMethod
read_all(db::SQLite.DB, model) 
Returns all data of a given model object
source
Jorm.read_oneMethod
read_one(db::SQLite.DB, model, id) 
Returns a given model object when given the ID
source
Jorm.serialize_to_listMethod
serialize_to_list(outputmodel::Type,queryresult)
Convert an SQL Query result into serialized list
outputmodel:: Same Model but with id::Int defined to handle auto generated ID 
from autoincrement
source
Jorm.tablenameMethod
tablename(model) 
Generate the table name for a given model. The table name is derived from the model's type name, converting it to lowercase and joining words with underscores.

struct MyModel end println(tablename(MyModel)) # Output: "my_model"

source
Jorm.update!Method
update!(db::SQLite.DB, model, id, data)
Update data to the DB for a given model
source
Jorm.@raw_sqlMacro
macro raw_sql(v::String)
    -> RawSQL

Create a RawSQL instance from a given SQL query string.

source