ecto

    1熱度

    1回答

    我試圖在將要處理業務邏輯的傘下設置應用程序。它使用Ecto與數據庫交互。我在設置SQL.Sandbox進行測試時遇到問題。每當我跑測試中,我得到這個錯誤: $ MIX_ENV=test mix test ** (exit) exited in: GenServer.call(Domain.Repo.Pool, :checkin, 5000) ** (EXIT) no process

    1熱度

    1回答

    我要顯示一個日期範圍(統計)喜歡的: Dates | Count -------------------- "2016-09-01" | 0 "2016-09-02" | 0 "2016-09-03" | 0 "2016-09-04" | 0 "2016-09-05" | 0 "2016-09-06" | 12 "2016-09-07" | 9 "2016-09-08" | 0

    0熱度

    1回答

    我在Phoenix控制器中查詢了一個學生列表,並且列表中的每一行都在其id上加入了bloodgroup並獲取血型組名稱。我想在我生成的一個eex模板中顯示它,但是出現錯誤。 這裏的學生架構: schema "students" do field :firstname, :string field :lastname, :string field :birthday,

    1熱度

    1回答

    假設NULL值,我們有一個空的列permission_set_id,這是一個外鍵稱爲permission_sets另一個表稱爲users表,其中的Ecto.Schema.belongs_to/3(文檔here)宏來實現的。我需要取消其場這樣的查詢: query = from u in User, where: u.id == ^user_id case Repo.update_al

    2熱度

    1回答

    讓說我有一個模型,像: defmodule User do use MyApp.Web, :model schema "users" do field :email, :string field :first_name, :string belongs_to :role, Role has_many :comments, Commen

    1熱度

    1回答

    我有一個與has_many關聯的ecto模型。我想用默認的查詢來定義這個關聯。 像 defmodule MyApp.User do use MyApp.Web, :model schema "users" do has_many :comments, MyApp.Comment end end 我想獲取不屬於deleted評論(刪除是MyApp.Co

    0熱度

    1回答

    我有更多的noob問題。當我做類似 case MyRepo.insert %Post{title: "Ecto is great"} do {:ok, struct} -> # Inserted with success {:error, changeset} -> # Something went wrong end 回購如何知道數據庫中的哪個表使用?

    0熱度

    2回答

    我有一個不應該用作用戶名的字符串列表。我發現在ecto中有validate_exclusion,但我認爲在不區分大小寫的情況下有辦法做到這一點。有沒有辦法做到這一點? validate_format與正則表達式也許? 注意:我想避免簡單地將我的用戶名縮減。

    1熱度

    1回答

    我試圖在窗體中顯示一些相關數據。我有一個學生架構 schema "students" do field :firstname, :string field :lastname, :string field :birthday, Ecto.Date field :joined_on, Ecto.Date field :gender, :string

    0熱度

    2回答

    Ecto documentation顯示如何執行插值。但我在查詢中需要動態字段。我有幾十個領域,併爲他們每個人寫查詢似乎不具有凝聚力。 defmodule Hedone.SearchController do use Hedone.Web, :controller alias Hedone.User def idade(conn, %{"idade+" => ma