# `PgFlow.JobCompiler`
[🔗](https://github.com/agoodway/pgflow/blob/v0.1.0/lib/pgflow/job_compiler.ex#L1)

Compiles job definitions into SQL statements.

Delegates to `PgFlow.FlowCompiler` for base SQL generation (create_flow + add_step),
then appends an UPDATE statement to set `flow_type = 'job'` on the flow record.

## Example

    definition = MyApp.Jobs.SendEmail.__pgflow_definition__()
    sql_statements = PgFlow.JobCompiler.compile(definition)

    # Returns:
    # [
    #   "SELECT pgflow.create_flow('send_email', 1, 1, 30)",
    #   "SELECT pgflow.add_step('send_email', 'send_email', ARRAY[]::text[], NULL, NULL, NULL, NULL, 'single')",
    #   "UPDATE pgflow.flows SET flow_type = 'job' WHERE flow_slug = 'send_email'"
    # ]

# `compile`

```elixir
@spec compile(PgFlow.Flow.Definition.t()) :: [String.t()]
```

Compiles a job definition into a list of SQL statements.

Returns the same SQL as `FlowCompiler.compile/1` plus an additional UPDATE
to mark the flow as a job in the database.

# `cron_unschedule_sql`

```elixir
@spec cron_unschedule_sql(atom()) :: String.t()
```

Delegates to `FlowCompiler.cron_unschedule_sql/1` for generating unschedule SQL.

# `has_cron?`

```elixir
@spec has_cron?(module()) :: boolean()
```

Delegates to `FlowCompiler.has_cron?/1` to check if the module has cron configured.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
