Skip to content

Repo get/set doesn't handle :datetime fields using DateTime structs #82

@mangr3n

Description

@mangr3n

See my Pull Request to see a test that demonstrates the problem.

I modified the schema definition thus

defmodule Dlex.User do
  use Dlex.Node

  schema "user" do
    field :name, :string, index: ["term"]
    field :age, :integer
    field :friends, :uid
    field :location, Dlex.Geo
    field :modified, :datetime
    field :cache, :any, virtual: true
  end
end
now = DateTime.utc_now()
changeset = Ecto.Changeset.cast(%User{}, %{name: "TimeTraveler", age: 20, modified: now},[:name, :age, :modified])
assert {:ok, %{uid: uid}} = TestRepo.set(changeset)

assert {:ok, %User{name: "TimeTraveler", age: 20, modified: now}} = TestRepo.get(uid)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions