User
DearDiary.get_user — Functionget_user(username::AbstractString)::Optional{User}Get an User by username.
Arguments
username::AbstractString: The username of the user to query.
Returns
An User object. If the record does not exist, return nothing.
get_user(id::Integer)::Optional{User}Get an User by id.
Arguments
id::Integer: The id of the user to query.
Returns
An User object. If the record does not exist, return nothing.
DearDiary.get_users — FunctionDearDiary.create_user — Functioncreate_user(first_name::AbstractString, last_name::AbstractString, username::AbstractString, password::AbstractString)::Tuple{Optional{<:Int64},UpsertResult}Create an User.
Arguments
first_name::AbstractString: The first name of the user.last_name::AbstractString: The last name of the user.username::AbstractString: The username of the user.password::AbstractString: The password of the user.
Returns
An UpsertResult. Created if the record was successfully created, Duplicate if the record already exists, Unprocessable if the record violates a constraint, and Error if an error occurred while creating the record.
DearDiary.update_user — Functionupdate_user(id::Integer, first_name::Optional{AbstractString}, last_name::Optional{AbstractString}, password::Optional{AbstractString}, is_admin::Optional{Bool})::UpsertResultUpdate an User.
Arguments
id::Integer: The id of the user to update.first_name::Optional{AbstractString}: The new first name of the user.last_name::Optional{AbstractString}: The new last name of the user.password::Optional{AbstractString}: The new password of the user.is_admin::Optional{Bool}: The new admin status of the user.
Returns
An UpsertResult. Updated if the record was successfully updated (or no fields were changed), Unprocessable if the record violates a constraint or if no fields were provided to update, and Error if an error occurred while updating the record.
DearDiary.delete_user — Functiondelete_user(id::Integer)::BoolDelete an User. Also deletes all associated UserPermission.
Arguments
id::Integer: The id of the user to delete.
Returns
true if the record was successfully deleted, false otherwise.