如何使用momentjs格式化日期而不带前导零?例如 2018-6-29 而不是 2018-06-29。
如果数字小于 10,则不应在其前添加 0。
嘿,我正在尝试进行查询,我的代码如下所示:
def show(conn, _params) do
user = Guardian.Plug.current_resource(conn)
team = Web.get_team!(user.team.id)
score_query =
from(
u in User,
where: u.team.id == team.id,
select: sum(u.score)
)
team_score = Repo.all(score_query)
IO.puts("score")
IO.inspect(team_score)
conn |> render("team.json", team: team)
Run Code Online (Sandbox Code Playgroud)
当我尝试运行它时,我收到一条错误消息:
** (Ecto.Query.CompileError) unbound variable `team` in query
Run Code Online (Sandbox Code Playgroud)
但为什么是未绑定的?我该如何修复它以及为什么会发生这种情况?