Skip to content

Instantly share code, notes, and snippets.

@jamesbee
Last active August 29, 2015 14:16
Show Gist options
  • Save jamesbee/2be415394aff81dc8103 to your computer and use it in GitHub Desktop.
Save jamesbee/2be415394aff81dc8103 to your computer and use it in GitHub Desktop.

Revisions

  1. jamesbee revised this gist Mar 31, 2015. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions mix.exs
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,6 @@
    defmodule Sh.Mixfile do
    defmodule SomeProject.Mixfile do
    use Mix.Project

    @version String.strip(File.read!("VERSION"))

    ##
    # bla, bla, bla
    ##
  2. jamesbee created this gist Mar 12, 2015.
    18 changes: 18 additions & 0 deletions conn.ex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    defmodule Conn do
    def test do
    stat = "select * from users limit 10;"

    :emysql.add_pool :demo_pool, [
    size: 1,
    user: 'root',
    password: 'root',
    database: 'demo',
    encoding: :utf8 # you will need this
    ]

    res = :emysql.execute :demo_pool, stat
    rows = :emysql.as_proplist res
    # from keyword list to elixir map
    Enum.map rows, &Enum.into(&1, %{})
    end
    end
    19 changes: 19 additions & 0 deletions mix.exs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    defmodule Sh.Mixfile do
    use Mix.Project

    @version String.strip(File.read!("VERSION"))

    ##
    # bla, bla, bla
    ##

    # Add crypto, emysql to application start link.
    def application do
    [applications: [:crypto, :emysql]]
    end

    # Add emysql dependencies
    defp deps do
    [{:emysql, github: "Eonblast/Emysql", ref: "HEAD"}]
    end
    end