Miscellaneous
Database
DearDiary.initialize_database — Function
initialize_database(; file_name::String="deardiary.db")Open file_name (creating it if needed), run every pending Migration via apply_migrations, and re-seed the default user. Safe to call repeatedly: each migration runs at most once per database, and the default-user INSERT OR IGNORE is a no-op when the row already exists.
DearDiary.get_database — Function
get_database()::Union{SQLite.DB,Nothing}Returns a SQLite database connection. If the database has not been initialized, it returns nothing.
Returns
A SQLite.DB object, or nothing if the database is not initialized.
DearDiary.close_database — Function
close_database()Closes the database connection if it is open.
Enumerations
DearDiary.ExperimentStatus — Type
@enum ExperimentStatus IN_PROGRESS = 1 STOPPED = 2 FINISHED = 3An enumeration representing the lifecycle status of an Experiment.
DearDiary.IN_PROGRESS — Constant
IN_PROGRESS::ExperimentStatusAn enumeration value representing an experiment that is currently in progress.
DearDiary.STOPPED — Constant
STOPPED::ExperimentStatusAn enumeration value representing an experiment that has been stopped.
DearDiary.FINISHED — Constant
FINISHED::ExperimentStatusAn enumeration value representing an experiment that has finished.
DearDiary.IterationStatus — Type
@enum IterationStatus RUNNING = 1 SUCCEEDED = 2 FAILED = 3 KILLED = 4An enumeration representing the lifecycle status of an Iteration. A freshly created iteration is RUNNING; the value transitions to a terminal status (SUCCEEDED, FAILED, or KILLED) when the iteration ends.
DearDiary.RUNNING — Constant
RUNNING::IterationStatusAn enumeration value representing an Iteration that is still in progress. This is the value assigned when the iteration is created.
DearDiary.SUCCEEDED — Constant
SUCCEEDED::IterationStatusAn enumeration value representing an Iteration that ran to completion without raising an exception.
DearDiary.FAILED — Constant
FAILED::IterationStatusAn enumeration value representing an Iteration that ended because of an exception. The captured exception text is stored in error_message.
DearDiary.KILLED — Constant
KILLED::IterationStatusAn enumeration value representing an Iteration that was terminated externally (operator action, timeout, scheduler kill) rather than by a clean return or an exception.
Marker types
Upsert results
DearDiary.UpsertResult — Type
UpsertResultA marker abstract type for the result of an upsert operation.
DearDiary.Created — Type
CreatedA marker type indicating that a record was successfully created.
DearDiary.Updated — Type
Updated <: UpsertResultA marker type indicating that a record was successfully updated.
DearDiary.Duplicate — Type
Duplicate <: UpsertResultA marker type indicating that a record already exists.
DearDiary.Unprocessable — Type
Unprocessable <: UpsertResultA marker type indicating that a record violates a constraint and cannot be processed.
DearDiary.Error — Type
Error <: UpsertResultA marker type indicating that an error occurred while creating or updating a record.
Permission actions
DearDiary.PermissionAction — Type
PermissionActionAbstract supertype representing a CRUD action that a UserPermission can grant on a Project. Concrete subtypes are dispatched on by has_permission to read the matching boolean field.
DearDiary.CreatePermission — Type
CreatePermission <: PermissionActionAction that requires create_permission on the target Project.
DearDiary.ReadPermission — Type
ReadPermission <: PermissionActionAction that requires read_permission on the target Project.
DearDiary.UpdatePermission — Type
UpdatePermission <: PermissionActionAction that requires update_permission on the target Project.
DearDiary.DeletePermission — Type
DeletePermission <: PermissionActionAction that requires delete_permission on the target Project.
Error codes
DearDiary.ErrorCode — Type
ErrorCodeMarker abstract type for error codes returned in non-2xx response bodies.
Concrete subtypes pair with error_code to produce a stable, frontend-facing identifier (e.g., "NOT_FOUND", "PROJECT_PERMISSION_REQUIRED") that callers can switch on without parsing English messages.
DearDiary.NotFound — Type
NotFound <: ErrorCodeThe requested entity does not exist. Pairs with HTTP 404 Not Found.
DearDiary.InvalidCredentials — Type
InvalidCredentials <: ErrorCodeThe supplied username/password did not authenticate. Pairs with HTTP 401 Unauthorized.
DearDiary.TokenMissing — Type
TokenMissing <: ErrorCodeThe request did not include an Authorization header. Pairs with HTTP 401 Unauthorized.
DearDiary.TokenInvalid — Type
TokenInvalid <: ErrorCodeThe bearer token failed signature validation. Pairs with HTTP 401 Unauthorized.
DearDiary.TokenExpired — Type
TokenExpired <: ErrorCodeThe bearer token's exp claim is in the past. Pairs with HTTP 401 Unauthorized.
DearDiary.TokenPayloadInvalid — Type
TokenPayloadInvalid <: ErrorCodeThe bearer token decoded but its claims are missing or malformed. Pairs with HTTP 401.
DearDiary.UserNotFound — Type
UserNotFound <: ErrorCodeThe user identified by the credentials or token does not exist. Pairs with HTTP 401/404 depending on context.
DearDiary.AdminRequired — Type
AdminRequired <: ErrorCodeThe route requires administrative privileges. Pairs with HTTP 403 Forbidden.
DearDiary.SameUserRequired — Type
SameUserRequired <: ErrorCodeThe route can only be accessed by the targeted user (or an admin). Pairs with HTTP 403.
DearDiary.ProjectPermissionRequired — Type
ProjectPermissionRequired <: ErrorCodeThe user lacks the required CRUD permission on the project that scopes the route. Pairs with HTTP 403 Forbidden.
DearDiary.Conflict — Type
Conflict <: ErrorCodeA unique-constraint violation: the resource already exists. Pairs with HTTP 409 Conflict.
DearDiary.InvalidPayload — Type
InvalidPayload <: ErrorCodeThe request payload violates a constraint (foreign key, check, missing field). Pairs with HTTP 422 Unprocessable Entity.
DearDiary.ServerError — Type
ServerError <: ErrorCodeGeneric catch-all for unexpected failures. Pairs with HTTP 500 Internal Server Error.
Pagination
DearDiary.Pagination — Type
PaginationCursor for windowing a collection of records.
Fields
limit::Int64: Maximum number of records to return (capped at the route boundary).offset::Int64: Number of records to skip before the page starts.
DearDiary.PaginatedResponse — Type
PaginatedResponse{T} <: ResultTypeEnvelope returned by paginated list endpoints.
Fields
data::Array{T,1}: The records in this page.total::Int64: Total number of matching records (across all pages).limit::Int64: The page size used.offset::Int64: The offset used.