View Source Bind.Parse (bind v0.1.1)

Summary

Functions

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

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

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.

Parameters

  • param: The where parameter as a string.

Examples

> Bind.Parse.where_field("name[eq]")
[:name, "eq"]

> Bind.Parse.where_field("age[gte]")
[:age, "gte"]