From 0f117e9c725eab5ac18f617d2dd3a5f0291237e4 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Mon, 18 Apr 2016 04:22:17 -0700 Subject: [PATCH 01/16] using Muut fork of cberl --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 51e04d1..06e65a4 100644 --- a/mix.exs +++ b/mix.exs @@ -24,7 +24,7 @@ defmodule Couchie.Mixfile do # {:erlmc, "0.1", git: "https://github.com/n1rvana/erlmc.git"} defp deps do [ - {:cberl, github: "chitika/cberl"}, #chitika is authoritative source + {:cberl, github: "muut/cberl"}, #chitika is authoritative source {:poison, ">= 1.2.0"} ] end From 417acf9e6f5ee6b0c8f10318689ac338151ae182 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Tue, 19 Apr 2016 02:17:44 -0700 Subject: [PATCH 02/16] adding support for set using CAS property --- lib/couchie.ex | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/couchie.ex b/lib/couchie.ex index eb211fb..701fb8d 100755 --- a/lib/couchie.ex +++ b/lib/couchie.ex @@ -91,6 +91,16 @@ defmodule Couchie do :cberl.set(connection, key, expiration, document) # NOTE: cberl parameter order is different! end + @doc """ + Create document if it doesn't exist, or replace it if it does. + First parameter is the connection you passed into Couchie.open() + If you want to verify the document hasn't been updated since the last read, + use the cas property from the last read. + """ + def set(connection, key, document, expiration, cas) do + :cberl.set(connection, key, expiration, document, :standard, cas) + end + @doc """ Get document. Keys should be binary. From 4e6fe7f50f590c816f8bf6ec75efe29caba9dfb3 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Tue, 19 Apr 2016 02:17:58 -0700 Subject: [PATCH 03/16] fixing test to use doctest --- test/couchie_test.exs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/couchie_test.exs b/test/couchie_test.exs index 57912eb..1fbbb0e 100644 --- a/test/couchie_test.exs +++ b/test/couchie_test.exs @@ -1,7 +1,6 @@ defmodule CouchieTest do use ExUnit.Case - test "the truth" do - assert true - end + doctest Couchie + end From 73fcd647cf04aca5130361b23a99c2d440214c40 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Tue, 19 Apr 2016 02:27:36 -0700 Subject: [PATCH 04/16] removing IO.puts on new connections --- lib/couchie.ex | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/couchie.ex b/lib/couchie.ex index 701fb8d..d367a7d 100755 --- a/lib/couchie.ex +++ b/lib/couchie.ex @@ -38,9 +38,7 @@ defmodule Couchie do end def open(name, size, host) do - IO.puts "Opening #{name}, #{size}, #{host}" open(name, size, host, '', '', '') - IO.puts "Opened #{name}, #{size}, #{host}" end def open(name, size, host, bucket) do # assume the bucket user and pass are the same as bucket name @@ -52,7 +50,6 @@ defmodule Couchie do end def open(name, size, host, bucket, username, pass) do #currently usernames are set to bucket names in this interface. - IO.puts "Opening #{name}, #{size}, #{host}, #{username}, #{pass}, #{bucket} " :cberl.start_link(name, size, host, username, pass, bucket, Couchie.Transcoder) end From b4b9cb322355231070b4f5273f7d87854e2d8947 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Tue, 19 Apr 2016 02:31:46 -0700 Subject: [PATCH 05/16] k isn't used, prefixing with _ --- lib/couchie.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/couchie.ex b/lib/couchie.ex index d367a7d..9c70ca2 100755 --- a/lib/couchie.ex +++ b/lib/couchie.ex @@ -186,7 +186,7 @@ defmodule Couchie do { view.name, { view |> Map.take([:map, :reduce]) - |> Enum.filter(fn {k, v} -> !is_nil(v) end) # only put fields that are not nil + |> Enum.filter(fn {_k, v} -> !is_nil(v) end) # only put fields that are not nil } } end From 3095f0580123e3d0904b5274dff5742c1b1aaacb Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Tue, 19 Apr 2016 02:38:27 -0700 Subject: [PATCH 06/16] version bump and support recent versions of elixir --- mix.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 06e65a4..d5547ab 100644 --- a/mix.exs +++ b/mix.exs @@ -9,8 +9,8 @@ defmodule Couchie.Mixfile do @doc "Project Details" def project do [ app: :couchie, - elixir: "~> 1.0.2", - version: "0.0.6", + elixir: ">= 1.0.2", + version: "0.0.7", deps: deps ] end From 5790f7e5d7e6c334d4012c80ba384a3c4de46a32 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Tue, 19 Apr 2016 05:36:55 -0700 Subject: [PATCH 07/16] adding increment and decrement --- lib/couchie.ex | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/couchie.ex b/lib/couchie.ex index 9c70ca2..2edb07c 100755 --- a/lib/couchie.ex +++ b/lib/couchie.ex @@ -99,6 +99,42 @@ defmodule Couchie do end + @doc """ + Increment + + ## Example + + iex> Couchie.open(:default) + iex> Couchie.set(:default, "test_increment", 1) + iex> {:ok, _, "2"} = Couchie.incr(:default, "test_increment") + iex> :ok + :ok + + """ + def incr(connection, key, offset \\ 1, exp \\ 0) do + :cberl.incr(connection, key, offset, exp) + end + + + @doc """ + Decrement + + ## Example + + iex> Couchie.open(:default) + iex> Couchie.set(:default, "test_decrement", 1) + iex> {:ok, _, "0"} = Couchie.decr(:default, "test_decrement") + iex> :ok + :ok + + """ + def decr(connection, key, offset \\ 1, exp \\ 0) do + :cberl.decr(connection, key, offset, exp) + end + + + + @doc """ Get document. Keys should be binary. ## Example From 94a96715c40a9c97e15e6b1048c8071cbd61576d Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Tue, 19 Apr 2016 05:47:35 -0700 Subject: [PATCH 08/16] not using atoms for returned atoms are not garbage collected, it's a bit dangerous to convert all hash keys to atoms unless you have a finite set of keys in couchbase. If the data is at all user generated, this essentially results in a memory leak otherwise. --- lib/transcoder.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/transcoder.ex b/lib/transcoder.ex index 15a8665..2525047 100644 --- a/lib/transcoder.ex +++ b/lib/transcoder.ex @@ -29,7 +29,7 @@ defmodule Couchie.Transcoder do do: decode_value(flag ^^^ @raw_flag, :erlang.binary_to_term(value)) def decode_value(flag, value) when (@json_flag &&& flag) === @json_flag, - do: decode_value(flag ^^^ @json_flag, Poison.decode!(value, keys: :atoms)) + do: decode_value(flag ^^^ @json_flag, Poison.decode!(value)) def decode_value(flag, value) when (@str_flag &&& flag) === @str_flag, do: decode_value(flag ^^^ @str_flag, value) From 39f905a0a7b4803527b54a51f8e4f1122d023cac Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Tue, 19 Apr 2016 07:12:13 -0700 Subject: [PATCH 09/16] renaming to match couchbase naming conventions/docs --- lib/couchie.ex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/couchie.ex b/lib/couchie.ex index 2edb07c..1d330b5 100755 --- a/lib/couchie.ex +++ b/lib/couchie.ex @@ -157,12 +157,12 @@ defmodule Couchie do end @doc """ - Delete document. Key should be binary. + Remove document. Key should be binary. ## Example - Couchie.delete(:connection, "test_key") + Couchie.remove(:connection, "test_key") """ - def delete(connection, key) do + def remove(connection, key) do :cberl.remove(connection, key) end @@ -182,7 +182,7 @@ defmodule Couchie do Couchie.delete(:connection, "test_key") """ - def query(connection, doc, view, args) do + def view(connection, doc, view, args) do :cberl.view(connection, doc, view, args) end @@ -231,9 +231,9 @@ defmodule Couchie do Delete view. ## Example - Couchie.delete_view(:connection, "design-doc-id") + Couchie.remove_view(:connection, "design-doc-id") """ - def delete_view(connection, doc_name) do + def remove_view(connection, doc_name) do :cberl.remove_design_doc(connection, doc_name) end end From 6f60d1eeaf260bd54290347af4a943d5e8aab3cb Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Tue, 19 Apr 2016 11:04:56 -0700 Subject: [PATCH 10/16] adding support for n1ql queries --- lib/couchie.ex | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/couchie.ex b/lib/couchie.ex index 1d330b5..c485189 100755 --- a/lib/couchie.ex +++ b/lib/couchie.ex @@ -227,6 +227,30 @@ defmodule Couchie do } end + + @doc """ + + + ## Example + + iex> Couchie.open(:default) + iex> {:ok, _results, _meta} = Couchie.query(:default, "select * from default limit 1") + iex> :ok + :ok + + """ + def query(connection, query) do + query = "statement=#{query}" |> to_char_list + case :cberl.http(connection, '', query, 'application/x-www-form-urlencoded; charset=UTF-8', :post, :n1ql) do + {:ok, 200, result} -> + results = Poison.decode!(result) + {:ok, results["results"], Map.delete(results, "results")} + err -> + err + end + end + + @doc """ Delete view. ## Example From 8f4d9ebb717b92887bdd2c606490a2a8a2a2e027 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Sun, 1 May 2016 10:16:22 -0700 Subject: [PATCH 11/16] updating transcoder for common flag support Newer libraries use the flags: json: 0x02 << 24 raw: 0x03 << 24 utf8: 0x04 << 24 So updating the transcoder to support these flags for interoperability. Also I prefered not to use the single line function declarations for readability (personal preference) --- lib/transcoder.ex | 58 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/lib/transcoder.ex b/lib/transcoder.ex index 2525047..7626ac5 100644 --- a/lib/transcoder.ex +++ b/lib/transcoder.ex @@ -1,38 +1,62 @@ defmodule Couchie.Transcoder do use Bitwise - @json_flag 0x2 - @raw_flag 0x4 - @str_flag 0x8 + @json_flag 0x02 <<< 24 + @json_flag_legacy 0x02 + + @raw_flag 0x03 <<< 24 + @raw_flag_legacy 0x04 + + @str_flag 0x04 <<< 24 + @str_flag_legacy 0x08 #API defined by cberl_transcoder.erl # Encoder - def encode_value(encoders, value), - do: do_encode_value(flag(encoders), value) + def encode_value(encoders, value) do + do_encode_value(flag(encoders), value) + end - def do_encode_value(flag, value) when (flag &&& @str_flag) === @str_flag, - do: do_encode_value(flag ^^^ @str_flag, value) + def do_encode_value(flag, value) when (flag &&& @str_flag) === @str_flag do + do_encode_value(flag ^^^ @str_flag, value) + end - def do_encode_value(flag, value) when (flag &&& @json_flag) === @json_flag, - do: do_encode_value(flag ^^^ @json_flag, Poison.encode!(value)) + def do_encode_value(flag, value) when (flag &&& @json_flag) === @json_flag do + do_encode_value(flag ^^^ @json_flag, Poison.encode!(value)) + end - def do_encode_value(flag, value) when (flag &&& @raw_flag) === @raw_flag, - do: do_encode_value(flag ^^^ @raw_flag, :erlang.term_to_binary(value)) + def do_encode_value(flag, value) when (flag &&& @raw_flag) === @raw_flag do + do_encode_value(flag ^^^ @raw_flag, :erlang.term_to_binary(value)) + end def do_encode_value(_, value), do: value # Decoder - def decode_value(flag, value) when (@raw_flag &&& flag) === @raw_flag, - do: decode_value(flag ^^^ @raw_flag, :erlang.binary_to_term(value)) + def decode_value(flag, value) when (@raw_flag &&& flag) === @raw_flag do + decode_value(flag ^^^ @raw_flag, :erlang.binary_to_term(value)) + end + def decode_value(flag, value) when (@raw_flag_legacy &&& flag) === @raw_flag_legacy do + decode_value(flag ^^^ @raw_flag_legacy, :erlang.binary_to_term(value)) + end - def decode_value(flag, value) when (@json_flag &&& flag) === @json_flag, - do: decode_value(flag ^^^ @json_flag, Poison.decode!(value)) - def decode_value(flag, value) when (@str_flag &&& flag) === @str_flag, - do: decode_value(flag ^^^ @str_flag, value) + def decode_value(flag, value) when (@json_flag &&& flag) === @json_flag do + decode_value(flag ^^^ @json_flag, Poison.decode!(value)) + end + def decode_value(flag, value) when (flag &&& @json_flag_legacy) === @json_flag_legacy do + decode_value(flag ^^^ @json_flag_legacy, Poison.decode!(value)) + end + + + def decode_value(flag, value) when (@str_flag &&& flag) === @str_flag do + decode_value(flag ^^^ @str_flag, value) + end + def decode_value(flag, value) when (flag &&& @str_flag_legacy) === @str_flag_legacy do + decode_value(flag ^^^ @str_flag_legacy, value) + end + def decode_value(_, value), do: value From b5a035351c4f0215a5d1128c99516e5d572be5a8 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Wed, 11 May 2016 00:20:50 -0700 Subject: [PATCH 12/16] fixed to use flag mask was not correctly detecting flags. needed to use a mask. --- lib/transcoder.ex | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/transcoder.ex b/lib/transcoder.ex index 7626ac5..6ff5119 100644 --- a/lib/transcoder.ex +++ b/lib/transcoder.ex @@ -10,6 +10,7 @@ defmodule Couchie.Transcoder do @str_flag 0x04 <<< 24 @str_flag_legacy 0x08 + @flag_mask 0x02 <<< 24 ||| 0x02 ||| 0x03 <<< 24 ||| 0x04 ||| 0x04 <<< 24 ||| 0x08 #API defined by cberl_transcoder.erl # Encoder @@ -18,15 +19,15 @@ defmodule Couchie.Transcoder do do_encode_value(flag(encoders), value) end - def do_encode_value(flag, value) when (flag &&& @str_flag) === @str_flag do + def do_encode_value(flag, value) when (flag &&& @flag_mask) === @str_flag do do_encode_value(flag ^^^ @str_flag, value) end - def do_encode_value(flag, value) when (flag &&& @json_flag) === @json_flag do + def do_encode_value(flag, value) when (flag &&& @flag_mask) === @json_flag do do_encode_value(flag ^^^ @json_flag, Poison.encode!(value)) end - def do_encode_value(flag, value) when (flag &&& @raw_flag) === @raw_flag do + def do_encode_value(flag, value) when (flag &&& @flag_mask) === @raw_flag do do_encode_value(flag ^^^ @raw_flag, :erlang.term_to_binary(value)) end @@ -34,26 +35,26 @@ defmodule Couchie.Transcoder do # Decoder - def decode_value(flag, value) when (@raw_flag &&& flag) === @raw_flag do + def decode_value(flag, value) when (flag &&& @flag_mask) === @raw_flag do decode_value(flag ^^^ @raw_flag, :erlang.binary_to_term(value)) end - def decode_value(flag, value) when (@raw_flag_legacy &&& flag) === @raw_flag_legacy do + def decode_value(flag, value) when (flag &&& @flag_mask) === @raw_flag_legacy do decode_value(flag ^^^ @raw_flag_legacy, :erlang.binary_to_term(value)) end - def decode_value(flag, value) when (@json_flag &&& flag) === @json_flag do + def decode_value(flag, value) when (flag &&& @flag_mask) === @json_flag do decode_value(flag ^^^ @json_flag, Poison.decode!(value)) end - def decode_value(flag, value) when (flag &&& @json_flag_legacy) === @json_flag_legacy do + def decode_value(flag, value) when (flag &&& @flag_mask) === @json_flag_legacy do decode_value(flag ^^^ @json_flag_legacy, Poison.decode!(value)) end - def decode_value(flag, value) when (@str_flag &&& flag) === @str_flag do + def decode_value(flag, value) when (flag &&& @flag_mask) === @str_flag do decode_value(flag ^^^ @str_flag, value) end - def decode_value(flag, value) when (flag &&& @str_flag_legacy) === @str_flag_legacy do + def decode_value(flag, value) when (flag &&& @flag_mask) === @str_flag_legacy do decode_value(flag ^^^ @str_flag_legacy, value) end From e8f24ce9c762b383a595fe9c115603c1aed93463 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Wed, 11 May 2016 01:40:11 -0700 Subject: [PATCH 13/16] added merge function to update properties in a doc --- lib/couchie.ex | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/couchie.ex b/lib/couchie.ex index c485189..4c4001b 100755 --- a/lib/couchie.ex +++ b/lib/couchie.ex @@ -260,4 +260,35 @@ defmodule Couchie do def remove_view(connection, doc_name) do :cberl.remove_design_doc(connection, doc_name) end + + @doc """ + Merges the couchbase document with a given map, to simplify cases where you are updating a few properties + + If "safe" is specified then CAS is used to verify it hasn't been changed while modifying. + + If doc has changed {:error, :key_eexists} is returned. + + ## Example + + iex> Couchie.open(:default) + ...> Couchie.set(:default, "somekey", %{"key1" => 1, "key2" => 2}) + ...> Couchie.merge(:default, "somekey", %{"key2" => "changed", "key3" => 3}) + ...> {"somekey", _cas, doc} = Couchie.get(:default, "somekey") + ...> doc + %{"key1" => 1, "key2" => "changed", "key3" => 3} + + """ + def merge(connection, key, doc, safe \\ false) do + case Couchie.get(connection, key) do + {^key, cas , old_doc} -> + cas_to_use = case safe do + true -> + cas + false -> + 0 + end + Couchie.set(connection, key, Map.merge(old_doc, doc), 0, cas_to_use) + _ -> + {:error, :key_enoent} + end end From bd6913bda7bacd022cc2cfaa43a679df07c446a5 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Wed, 11 May 2016 01:40:51 -0700 Subject: [PATCH 14/16] added a few doctest tests --- lib/couchie.ex | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/lib/couchie.ex b/lib/couchie.ex index 4c4001b..0eaf7ee 100755 --- a/lib/couchie.ex +++ b/lib/couchie.ex @@ -18,8 +18,9 @@ defmodule Couchie do ## Examples # open connection named "default_connection" to the default bucket, which should be used for testing only - Couchie.open(:default_connection) - {ok, <0.XX.0>} #=> successful connection to default bucket on localhost + iex> {:ok, _} = Couchie.open(:default_connection) + iex> :ok + :ok # if your bucket is password protected: Couchie.open(:secret, 10, 'localhost:8091', 'bucket_name', 'bucket_pasword') @@ -56,7 +57,12 @@ defmodule Couchie do @doc """ Shutdown the connection to a particular bucket - Couchie.close(:connection) + ## Examples + + iex> Couchie.open(:connection) + iex> Couchie.close(:connection) + :ok + """ def close(pool) do :cberl.stop(pool) @@ -67,8 +73,11 @@ defmodule Couchie do First parameter is the connection you passed into Couchie.open() ## Examples + + iex> Couchie.open(:default) + iex> Couchie.set(:default, "key", "document data") + :ok - Couchie.set(:default, "key", "document data") """ def set(connection, key, document) do Couchie.set(connection, key, document, 0) @@ -82,7 +91,10 @@ defmodule Couchie do ## Example - Couchie.set(:default, "key", "document data", 0) + iex> Couchie.open(:default) + iex> Couchie.set(:default, "key", "document data", 0) + :ok + """ def set(connection, key, document, expiration) do :cberl.set(connection, key, expiration, document) # NOTE: cberl parameter order is different! @@ -93,6 +105,13 @@ defmodule Couchie do First parameter is the connection you passed into Couchie.open() If you want to verify the document hasn't been updated since the last read, use the cas property from the last read. + + ## Example + + iex> Couchie.open(:default) + iex> Couchie.set(:default, "key", "document data", 0, 12345) + {:error, :key_eexists} + """ def set(connection, key, document, expiration, cas) do :cberl.set(connection, key, expiration, document, :standard, cas) @@ -138,9 +157,13 @@ defmodule Couchie do @doc """ Get document. Keys should be binary. ## Example + + iex> Couchie.open(:default) + iex> Couchie.set(:default, "test_key", %{:blah => "blah"}) + iex> {"test_key", _cas , res} = Couchie.get(:default, "test_key") + iex> res + %{"blah" => "blah"} - Couchie.get(:connection, "test_key") - #=> {"test_key" 1234567890, "value"} # The middle figure is the CAS for this document. """ def get(connection, key) do :cberl.get(connection, key) From 5bfff064beeb260f3eec662694fe9e1c95be6427 Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Wed, 11 May 2016 01:43:31 -0700 Subject: [PATCH 15/16] fat fingered. missed committing 'end' earlier --- lib/couchie.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/couchie.ex b/lib/couchie.ex index 0eaf7ee..138be0c 100755 --- a/lib/couchie.ex +++ b/lib/couchie.ex @@ -314,4 +314,5 @@ defmodule Couchie do _ -> {:error, :key_enoent} end + end end From 4288101bf46ff2721e9cd451015dca0a8fb7a0bf Mon Sep 17 00:00:00 2001 From: Courtney Couch Date: Mon, 6 Jun 2016 20:03:24 -0700 Subject: [PATCH 16/16] handling flag set from web gui editing When editing cb docs in the management console the flag is changed to 0x01 which really doesn't mean anything. We're just going to treat this flag as JSON. --- lib/transcoder.ex | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/transcoder.ex b/lib/transcoder.ex index 6ff5119..87359c7 100644 --- a/lib/transcoder.ex +++ b/lib/transcoder.ex @@ -1,6 +1,10 @@ defmodule Couchie.Transcoder do use Bitwise + #When editing documents in the administrator flags are changed to 0x01. + #We're going to treat it as JSON data. Better ideas welcome. + @gui_legacy 0x01 + @json_flag 0x02 <<< 24 @json_flag_legacy 0x02 @@ -10,7 +14,7 @@ defmodule Couchie.Transcoder do @str_flag 0x04 <<< 24 @str_flag_legacy 0x08 - @flag_mask 0x02 <<< 24 ||| 0x02 ||| 0x03 <<< 24 ||| 0x04 ||| 0x04 <<< 24 ||| 0x08 + @flag_mask 0x01 ||| 0x02 <<< 24 ||| 0x02 ||| 0x03 <<< 24 ||| 0x04 ||| 0x04 <<< 24 ||| 0x08 #API defined by cberl_transcoder.erl # Encoder @@ -49,6 +53,9 @@ defmodule Couchie.Transcoder do def decode_value(flag, value) when (flag &&& @flag_mask) === @json_flag_legacy do decode_value(flag ^^^ @json_flag_legacy, Poison.decode!(value)) end + def decode_value(flag, value) when (flag &&& @flag_mask) === @gui_legacy do + decode_value(flag ^^^ @json_flag_legacy, Poison.decode!(value)) + end def decode_value(flag, value) when (flag &&& @flag_mask) === @str_flag do