ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - xerions/mariaex: Pure Elixir database driver for MariaDB / MySQL
Pure Elixir database driver for MariaDB / MySQL. Contribute to xerions/mariaex development by creating an account on GitHub.
Visit Site

GitHub - xerions/mariaex: Pure Elixir database driver for MariaDB / MySQL

GitHub - xerions/mariaex: Pure Elixir database driver for MariaDB / MySQL

Mariaex Build Status Coverage Status Deps Status

Usage

Add Mariaex as a dependency in your mix.exs file.

def deps do
  [{:mariaex, "~> 0.8.2"} ]
end

After you are done, run mix deps.get in your shell to fetch and compile Mariaex. Start an interactive Elixir shell with iex -S mix.

  iex(1)> {:ok, p} = Mariaex.start_link(username: "ecto", database: "ecto_test")
  {:ok, #PID<0.108.0>}

  iex(2)> Mariaex.query(p, "CREATE TABLE test1 (id serial, title text)")
  {:ok, %Mariaex.Result{columns: [], command: :create, num_rows: 0, rows: []}}

  iex(3)> Mariaex.query(p, "INSERT INTO test1 VALUES(1, 'test')")
  {:ok, %Mariaex.Result{columns: [], command: :insert, num_rows: 1, rows: []}}

  iex(4)> Mariaex.query(p, "INSERT INTO test1 VALUES(2, 'test2')")
  {:ok, %Mariaex.Result{columns: [], command: :insert, num_rows: 1, rows: []}}

  iex(5)> Mariaex.query(p, "SELECT id, title FROM test1")
  {:ok,
   %Mariaex.Result{columns: ["id", "title"], command: :select, num_rows: 2,
    rows: [[1, "test"], [2, "test2"]}}

Configuration

Important configuration, which depends on used charset for support unicode chars, see :binary_as in Mariaex.start_link/1

JSON library

As default, Poison is used for JSON library in mariaex to support JSON column.

If you want to use another library, please set config.exs like below.

config :mariaex, json_library: SomeLibrary

=======

Data representation

MySQL                 Elixir
----------            ------
NULL                  nil
TINYINT               42
INT                   42
BIGINT                42
FLOAT                 42.0
DOUBLE                42.0
DECIMAL               #Decimal<42.0> *
VARCHAR               "eric"
TEXT                  "eric"
BLOB                  <<42>>
DATE                  %Date{year: 2013, month: 10, day: 12}
TIME                  %Time{hour: 0, minute: 37, second: 14} **
YEAR                  2013
DATETIME              %DateTime{year: 2013 month: 10, day: 12, hour: 0, minute: 37, second: 14} **
TIMESTAMP             %DateTime{year: 2013 month: 10, day: 12, hour: 0, minute: 37, second: 14} **
BIT                   << 1 >>
GEOMETRY/POINT        %Mariaex.Geometry.Point{coordinates: {1.0, -1.0}, srid: 42}
GEOMETRY/LINESTRING   %Mariaex.Geometry.LineString{coordinates: [{0.0, 0.0}, {10.0, 10.0}, {20.0, 25.0}, {50.0, 60.0}], srid: 0}
GEOMETRY/POLYGON      %Mariaex.Geometry.Polygon{coordinates: [[{0.0, 0.0}, {10.0, 0.0}, {10.0, 10.0}, {0.0, 10.0}, {0.0, 0.0}], [{5.0, 5.0}, {7.0, 5.0}, {7.0, 7.0}, {5.0, 7.0}, {5.0, 5.0}]], srid: 0}

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory