qlc v1.0.2 Qlc
Summary
Functions
variable binding list to erlang_binding list
create qlc cursor from qlc_handle (create processes)
delete qlc cursor (kill processes)
eval qlc_handle
erlang ast with binding variables to qlc_handle
string to erlang ast
fold qlc_handle with accumulator
optoin list to record(:qlc_opt)
string to qlc_handle with variable bindings
Macros
string to qlc_handle with variable bindings (string must be literal, because its a macro.)
Types
bindings :: [any]
error_info :: :erl_parse.error_info
expr :: :erl_parse.abstract_expr
qlc_lc :: any
qlc_opt :: [any] | tuple
Functions
variable binding list to erlang_binding list
Specs
cursor(query_handle) :: query_cursor
create qlc cursor from qlc_handle (create processes)
Specs
expr_to_handle([expr], bindings, qlc_opt) :: query_handle
erlang ast with binding variables to qlc_handle
Specs
fold(query_handle, any, (any, any -> any), [any]) :: any
fold qlc_handle with accumulator
example
iex> require Qlc
iex> list = [a: 1,b: 2,c: 3]
iex> qlc_handle = Qlc.q("[X || X = {K,V} <- L, K =/= Item]",
...> [L: list, Item: :b])
...> Qlc.fold(qlc_handle, [], fn({k,v}, acc) ->
...> [{v, k}|acc]
...> end)
[{3, :c}, {1, :a}]
optoin list to record(:qlc_opt)
Specs
string_to_handle(String.t, bindings, list) :: query_handle
string to qlc_handle with variable bindings
Macros
string to qlc_handle with variable bindings (string must be literal, because its a macro.)
qlc expression string
syntax
[Expression || Qualifier1, Qualifier2, ...]
Expression :: arbitary Erlang term (the template)
Qualifier :: Filter or Generators
Fiilter :: Erlang expressions returning bool()
Generator :: Pattern <- ListExpression
ListExpression :: Qlc_handle or list()
Qlc_handle :: returned from Qlc.table/2, Qlc.sort/2, Qlc.keysort/2
Qlc.q/2, Qlc.string_to_handle/2
example
iex> require Qlc
iex> list = [a: 1,b: 2,c: 3]
iex> qlc_handle = Qlc.q("[X || X = {K,V} <- L, K =/= Item]",
...> [L: list, Item: :b])
...> Qlc.e(qlc_handle)
[a: 1, c: 3]
...> Qlc.q("[X || X = {K, V} <- L, K =:= Item]",
...> [L: qlc_handle, Item: :c]) |>
...> Qlc.e
[c: 3]