ecto

    1熱度

    1回答

    我正在將Ruby on Rails API轉換爲Elixir和Phoenix。在我的Postgres數據庫中,我有一個jsonb列類型的表。 json中的一個鍵是一組顏色。例如: {"id": 12312312, "colors": ["Red", "Blue", "White"]} 我想從Ecto做什麼是查詢我的表的所有記錄包含顏色紅色或藍色。本質上,重新創建此查詢: select * fr

    7熱度

    1回答

    我想在沒有第三方庫的情況下獲取Phoenix/Elixir中的當前日期時間戳。或者簡單地說,我想要DateTime.now()之類的東西。我怎樣才能做到這一點?

    1熱度

    1回答

    因此,按照在外生文檔的例子,我有以下幾點: defmodule Post do use Ecto.Schema schema "posts" do many_to_many :tags, Tag, join_through: "posts_tags" end end 和 defmodule Tag do use Ecto.Schema

    3熱度

    2回答

    我正試圖在數據庫中測試唯一性,並且遇到了一些麻煩。我跑這個遷移: def change do create table(:signups) do add :name, :string add :email, :string timestamps() end create unique_index(:signups, [:email])

    0熱度

    1回答

    Ecto.Adapters.SQL.query(Repo, "Select * from table", [])似乎執行查詢並返回數據。有沒有一種方法來定義基於原始sql的查詢,以便它可以作爲參數傳遞給Repo.all()? 我正在尋找類似的東西, qry = Ecto.Adapters.SQL.query("select * from table", []) # This doesn't wor

    0熱度

    1回答

    我正在構建一個聊天室應用程序,其中兩個主要模型是User和Room。現在,用戶可以創建新房間以及屬於現有房間。所以我結束了以下模型的房間: defmodule Elemental.TxChat.Room do use Elemental.TxChat.Web, :model schema "rooms" do field :name, :string fi

    2熱度

    1回答

    我有我在與同時使用的變更問題,以下型號(聊天室): defmodule Elemental.TxChat.Room do use Elemental.TxChat.Web, :model schema "rooms" do field :name, :string # Foreign key indicating which user created t

    1熱度

    1回答

    客戶端發送以下JSON:{ 「用戶」:{ 「年齡+」:18日, 「時代 - 」:40}} 在我的控制器我有以下幾點: def procura(conn, query) do maior = conn.params["user"]["age+"] menor = conn.params["user"]["age-"] query = from u in query, where

    2熱度

    1回答

    我工作的多用戶創建多對多關聯,多房間聊天應用,爲此,我的模型如下(在App模式已經爲簡單起見,省略): defmodule Elemental.TxChat.User do use Elemental.TxChat.Web, :model schema "users" do # The rooms the user is currenly logged into

    0熱度

    1回答

    我有一個簡單的模型: schema "torrents" do field :name, :string field :magnet, :string field :leechers, :integer field :seeders, :integer field :source, :string field :filesize, :st