Module PostgresORM

PostgresORM.create_entity!Function
create_entity!(new_object::IEntity,
               dbconn::LibPQ.Connection;
               creator::Union{IEntity,Missing} = missing)

Persists an instance to the database. Properties of type vector of IEntity are not persisted (see function update_vector_property! for that usage). The instance gets enriched by the values generated by the database in the process (eg. autogenerated primary keys). If the optional argument 'creator' is given and that the ORM module of the class is configured to track the creator then a entry will be inserted in the modification table

PostgresORM.create_in_bulk_using_copyFunction
create_in_bulk_using_copy(entities::Vector{T},
                                   dbconn::LibPQ.Connection) where T <: IEntity

Persists many instances to the database using PostgreSQL 'COPY'

PostgresORM.retrieve_entityFunction
retrieve_entity(filter_object::IEntity,
                retrieve_complex_props::Bool,
                dbconn::LibPQ.Connection)

Retrieves a vector or T instances that match the filter. If there is no match, it returns an empty vector. If retrieve_complex_props is true then a complex prop (i.e. a property of type IEntity) is fully loaded using an additional query to the database ; if not, an instance of IEntity is simply created using the values of the foreign key, the other properties are left to missing.

PostgresORM.retrieve_one_entityFunction
retrieve_one_entity(filter_object::T,
                    retrieve_complex_props::Bool,
                    dbconn::LibPQ.Connection)

Retrieves an instance ot T that matches the filter. If there is no match then the function returns missing. If there are more than one match, an error is thrown. If retrieve_complex_props is true then a complex prop (i.e. a property of type IEntity) is fully loaded using an additional query to the database ; if not, an instance of IEntity is simply created using the values of the foreign key, the other properties are left to missing.

PostgresORM.update_entity!Function
update_entity!(updated_object::IEntity,
               dbconn::LibPQ.Connection;
               editor::Union{IEntity,Missing} = missing)

Updates an instance to the database. Properties of type vector of IEntity are not updated (see function update_vector_property! for that usage). The instance gets enriched by the values generated by the database in the process (eg. values generated by triggers). If the optional argument 'editor' is given and that the ORM module of the class is configured to track the editor then a entry will be inserted in the modification table

PostgresORM.update_vector_property!Function
update_vector_property!(updated_object::IEntity,
                        updated_property::Symbol,
                        dbconn::Union{Missing, LibPQ.Connection};
                        editor::Union{Missing, IEntity} = missing)

Updates a property of type vector of IEntity

PostgresORM.delete_entityFunction
delete_entity(deleted_object::IEntity,
              dbconn::LibPQ.Connection;
              editor::Union{IEntity,Missing} = missing)

Deletes an entity on the basis of its ID

PostgresORM.delete_entity_alikeFunction
delete_entity_alike(filter_object::IEntity,
                    dbconn::LibPQ.Connection;
                    editor::Union{IEntity,Missing} = missing)

Deletes all entities matching the the filter

PostgresORM.execute_plain_queryFunction

executeplainquery(querystring::String, queryargs::Union{Vector,Missing}, dbconn::LibPQ.Connection)

Execute a query and with the given arguments returns a dataframe

PostgresORM.execute_query_and_handle_resultFunction

executequeryandhandleresult(querystring::String, datatype::DataType, queryargs::Union{Vector,Missing}, retrievecomplex_props::Bool, dbconn::LibPQ.Connection)

Execute a query and with the given arguments and convert the rows to the given datatype in the same way that `retrieveentity` would do it.