View Source Bind.Parse (bind v0.11.0)

Summary

Functions

Parses the sort parameter to determine the sort direction and field.

Parses a where parameter to extract the field name and constraint. Supports

Functions

Parses the sort parameter to determine the sort direction and field.

Parameters

  • param: The sort parameter as a string.

Examples

> Bind.Parse.sort_field("-age")
[desc: :age]

> Bind.Parse.sort_field("name")
[asc: :name]

Parses a where parameter to extract the field name and constraint. Supports:

  • Regular fields: "name[eq]" -> [:name, "eq"]
  • JSONB dot notation: "options.prompt[contains]" -> [:options, "prompt", "contains"]
  • Join colon notation: "current_version:content_title[contains]" -> [:current_version, :content_title, "contains", :join]
  • Join with JSONB: "current_version:flow_input.prompt[contains]" -> [:current_version, :flow_input, "prompt", "contains", :join_jsonb]

Parameters

  • param: The where parameter as a string.