ex_orient v1.2.0 ExOrient.DB.CRUD

Provides CRUD commands

Summary

Functions

Run a delete command. Examples

Insert into the database. Compatible with various styles of syntax. Examples

Shortcut function to easily select by Record ID. Takes a string or a %MarcoPolo.Rid{}

Perform a select operation. Examples

Passes a truncate command off to the correct function

Truncate a class

Truncate a cluster

Truncate a record

Perform an update command. Examples

Functions

delete(opts \\ [])

Run a delete command. Examples:

DB.delete(from: "#10:0")

DB.delete(from: ProgrammingLanguage)
insert(opts)

Insert into the database. Compatible with various styles of syntax. Examples:

ExOrient.DB.insert(into: ProgrammingLanguage, values: {[:name], ["Elixir"]})

ExOrient.DB.insert(into: ProgrammingLanguage, set: [name: "Elixir"])

ExOrient.DB.insert(into: ProgrammingLanguage, content: %{name: "Elixir"})

ExOrient.DB.insert(into: ProgrammingLanguage, content: %{name: "Elixir"}, return: "@rid")
rid(rid)

Shortcut function to easily select by Record ID. Takes a string or a %MarcoPolo.Rid{}.

ExOrient.DB.rid("#9:0")

ExOrient.DB.rid(%MarcoPolo.RID{cluster_id: 9, position: 0})
select(opts)

Perform a select operation. Examples:

ExOrient.DB.select(from: ProgrammingLanguage)

ExOrient.DB.select([:name], from: {ProgrammingLanguage})

ExOrient.DB.select(from: ProgrammingLanguage, where: %{name: "Elixir"})

ExOrient.DB.select(from: ProgrammingLanguage, where: %{name: "Elixir", type: "Awesome"})

ExOrient.DB.select(from: ProgrammingLanguage, where: %{name: "Elixir", type: "Awesome"}, logical: :or)

ExOrient.DB.select(from: ProgrammingLanguage, where: [name: "Elixir", name: "Erlang"], logical: :or)

ExOrient.DB.select(from: ProgrammingLanguage, where: %{"name.toLowerCase()" => "lolcode"})

ExOrient.DB.select(from: ProgrammingLanguage, where: {"name.length()", ">", 10})

ExOrient.DB.select(from: ProgrammingLanguage,
                   where: [{"name.length()", ">", 10},
                           {"name.left(2)", "=", "El"}],
                   logical: :or)
select(field, opts)
truncate(opts \\ [])

Passes a truncate command off to the correct function

truncate_class(opts \\ [])

Truncate a class

ExOrient.DB.truncate(class: Person)
truncate_cluster(opts \\ [])

Truncate a cluster

ExOrient.DB.truncate(cluster: "Germany")
truncate_record(opts \\ [])

Truncate a record

ExOrient.DB.truncate(record: "#11:2")

ExOrient.DB.truncate(record: ["#11:2", "#11:3"])
update(obj, opts \\ [])

Perform an update command. Examples:

ExOrient.DB.update("#9:568", set: [name: "C"])

ExOrient.DB.update(ProgrammingLanguage, where: %{name: "C"}, merge: %{type: ["Old", "Fast"]}, return: :after)

ExOrient.DB.update("#9:568", remove: [type: "Old"])

ExOrient.DB.update(Person, set: [name: "Bob"], where: %{name: "Bob"}, upsert: true, return: :after)