ecto

    0

    1答えて

    私は現時点では壁に当たっています。私はElixirとEctoを使って作業しています。データとDatetimeを持つ表があります。次のように 日時の欄には、次のとおりです。 2017-11-16 16:02:01 2017-11-23 09:00:07 2017-11-27 13:19:58 2017-12-05 07:48:42 私が何をしたい日付の代わりに、時間に基づいて並べ替え、この

    0

    1答えて

    この指示に従うと、http://blog.roundingpegs.com/an-example-of-many-to-many-associations-in-ecto-and-phoenix/はmany_to_many関連付けを作成します。しかし、私はmany_to_manyテーブルにいくつかのフィールドが必要です。私の場合、users_organizationsにはleftやjoined_a

    0

    2答えて

    仕事モデル schema "jobs" do belongs_to :status, Test.JobStatus, foreign_key: :status_id, references: :id, type: :string timestamps() end として、私は、ステータスモデルを持っている:私はそのことのparamsであれば(

    0

    1答えて

    posts、commentsおよびvotesのテーブルがあるとします。 votesテーブルは、directionカラムが1,0、-1のいずれかになります。 は、私はまた、すべての記事と数コメントの、および各ポストのためvotes.directionの合計を照会します。 これは、Ectoのサブクエリとして実現可能ですか?Postモデルで合成可能なクエリを使用するのが理想的ですか? def count

    0

    1答えて

    バインディングレス操作のエクトドキュメントを読んでいます。彼らは動的な価値に最適です。 from Post, where: [category: "fresh and new"], order_by: [desc: :published_at], select: [:id, :title, :body] だから私の質問です。 select: max[:some_f

    1

    1答えて

    私は最近phoenixと仕事を始めましたが、実際には私は通常SQLデータベースなしで作業しています。 私は、関連性を統合するための古典的なブログに取り組んでいます。 私は基本的な関連を作成しました: schema "categories" do field :category_name, :string field :logo, :string has_many :p

    0

    1答えて

    私のブログのアプリには、CommentがたくさんあるPostモデルがあります。 schema "post" do field :title, :string field :content, :string belongs_to :owner, MyApp.Accounts.User, foreign_key: :owner_id has_many :co

    0

    1答えて

    私のブログアプリには、他人の投稿をコピーして自分のものとしてホストする機能があります。 Postは、オーナーに関連付けられています。 schema "posts" do field :title, :string field :content, :string belongs_to :owner, MyApp.Accounts.User, foreign_key:

    1

    1答えて

    私はecto 2.2.6を使用しています。 私はエクトで参加を控えています。 最初は、Listを使用して単一のテーブルで選択値を返しました。 (1) 次の例では、テーブル結合のためにマップを使用して選択値を返しました。 (2) Repo.all(from m in "members", left_join: g in "groups", on: g.id == m.grou

    0

    1答えて

    私のアプリにFooというスキーマがあります。has_manyのスキーマBarです。 schema "foos" do field :content, :string has_many :bars, MyApp.Content.Bar, foreign_key: :foo_id end schema "bars" do field :content