LibEctoV2.FunctionGenerators.Read (lib_ecto v0.4.0)
View Source读操作函数生成器模块,用于生成查询和读取记录的函数。
此模块专注于生成与数据读取相关的函数,如 get_one/1、get_all/1 和 get_by_page/3 等。
Summary
Functions
生成获取多条记录的函数。
参数
schema: 模式模块repo: 仓库模块columns: 列名列表filters: 过滤器列表
返回值
- 包含获取多条记录函数的 quoted 表达式
示例
iex> LibEctoV2.FunctionGenerators.Read.generate_get_many_funcs(MyApp.User, MyApp.Repo, [:id, :name], [:id, :name])
quote do
# 获取多条记录的函数定义
end
生成获取单条记录的函数。
参数
schema: 模式模块repo: 仓库模块columns: 列名列表filters: 过滤器列表
返回值
- 包含获取单条记录函数的 quoted 表达式
示例
iex> LibEctoV2.FunctionGenerators.Read.generate_get_one_funcs(MyApp.User, MyApp.Repo, [:id, :name], [:id, :name])
quote do
# 获取单条记录的函数定义
end