View Source ExTypesense.Parser (ExTypesense v0.2.2)
Module for converting structs to raw json body or map.
Link to this section Summary
Functions
Gets ecto schema fields and turns it into a list of maps as field entries.
Converts an ecto schema module (e.g. Posts
) to a map.
Link to this section Types
Link to this section Functions
Gets ecto schema fields and turns it into a list of maps as field entries.
Link to this function
struct_to_map(module_name, default_sorting_field \\ "")
View Source (since 0.1.0)@spec struct_to_map(module(), String.t()) :: collection()
Converts an ecto schema module (e.g. Posts
) to a map.
examples
Examples
default_sorting_field = "title"
iex> ExTypesense.Parser.struct_to_map(AppModule, default_sorting_field)
%{
default_sorting_field: "title",
fields: [...],
name: "companies"
}
Link to this function