Skip to content
/ dao Public

Dao is the natural order of the universe whose character one's intuition must discern to realize the potential for individual wisdom, as conceived in the context of East Asian philosophy, East Asian religions, or any other philosophy or religion that aligns to this principle. Wikipedia

Notifications You must be signed in to change notification settings

nyolamike/dao

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

philosophy

Dao is the natural order of the universe whose character one's intuition must discern to realize the potential for individual wisdom, as conceived in the context of East Asian philosophy, East Asian religions, or any other philosophy or religion that aligns to this principle. (Wikipedia)[https://en.wikipedia.org/wiki/Tao]

Data Access Object - dao

Dao is a recreation of the B.E.E (back end enginee) in elixir.

The idea is to compose organic queries that self describe the reponse structure of the data from a database

How it works

  • Compose a query using maps
query = %{
  students: %{
    class_room: %{},
    _w: { :name, :contains_ignore_case,  "mike" }
  }
}
  • Pass the query to a dao function
results = Dao.get(query)
  • Internally the query is converted into an sql statement
SELECT school_app.students.name as mdmd FROM `school_app.students` LEFT JOIN kkffl to gkgk WHERE `school_app.students.name` like '%mike%'
  • The query is executed and the results are formated according to the structure of the query
case results do
  {:ok, data } -> IO.inspect( data )
  {:error, errors } -> IO.inspect( errors )
end
  • The data inspected above will be like this
%{
  students: [
    %{
      id: 1,
      name: "mike nyola",
      class_room_id: 5,
      class_room: %{
        id: 5,
        name: "grade 6"
      }
    },
    %{
      id: 5,
      name: "mike tyler",
      class_room_id: 5,
      class_room: %{
        id: 5,
        name: "grade 6"
      }
    }
  ]
}

About

Dao is the natural order of the universe whose character one's intuition must discern to realize the potential for individual wisdom, as conceived in the context of East Asian philosophy, East Asian religions, or any other philosophy or religion that aligns to this principle. Wikipedia

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages