{"id":2019,"date":"2026-07-28T06:23:47","date_gmt":"2026-07-28T06:23:47","guid":{"rendered":"https:\/\/www.vpascode.com\/vn\/docs\/uncategorized\/elixir-visualizer-guide\/"},"modified":"2026-07-28T06:23:47","modified_gmt":"2026-07-28T06:23:47","slug":"elixir-visualizer-guide","status":"publish","type":"ld_docs","link":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/","title":{"rendered":"Elixir"},"content":{"rendered":"<p>Khi thi\u1ebft k\u1ebf c\u00e1c \u1ee9ng d\u1ee5ng ch\u1ecbu l\u1ed7i, \u0111\u1ed3ng th\u1eddi ho\u1eb7c c\u00e1c h\u1ec7 th\u1ed1ng ph\u00e2n t\u00e1n b\u1eb1ng Elixir, vi\u1ec7c \u0111i qua c\u00e1c ranh gi\u1edbi module, h\u1ee3p \u0111\u1ed3ng struct, h\u00e0nh vi v\u00e0 c\u00e2y gi\u00e1m s\u00e1t OTP c\u00f3 th\u1ec3 khi\u1ebfn vi\u1ec7c h\u00ecnh dung ki\u1ebfn tr\u00fac h\u1ec7 th\u1ed1ng t\u1ed5ng th\u1ec3 tr\u1edf n\u00ean kh\u00f3 kh\u0103n. <strong>Tr\u00ecnh hi\u1ec3n th\u1ecb Elixir<\/strong>chuy\u1ec3n \u0111\u1ed5i c\u00e1c module Elixir, \u0111\u1ecbnh ngh\u0129a struct (<code>defstruct<\/code>), c\u00e1c \u0111\u1eb7c t\u1ea3 ki\u1ec3u (<code>@type<\/code>), v\u00e0 c\u00e1c h\u1ee3p \u0111\u1ed3ng h\u00e0nh vi (<code>@callback<\/code>) th\u00e0nh c\u00e1c s\u01a1 \u0111\u1ed3 ki\u1ebfn tr\u00fac r\u00f5 r\u00e0ng, t\u01b0\u01a1ng t\u00e1c. B\u1eb1ng c\u00e1ch ph\u00e2n t\u00edch c\u00e1c h\u1ee3p \u0111\u1ed3ng d\u1eef li\u1ec7u, k\u00fd hi\u1ec7u h\u00e0m kh\u1edbp m\u1eabu v\u00e0 c\u00e1c ph\u1ee5 thu\u1ed9c module, c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n Elixir v\u00e0 ki\u1ebfn tr\u00fac s\u01b0 h\u1ec7 th\u1ed1ng c\u00f3 th\u1ec3 quan s\u00e1t tr\u1ef1c quan c\u00e1c m\u00f4 h\u00ecnh mi\u1ec1n ch\u1ee9c n\u0103ng v\u00e0 b\u1ed1 c\u1ee5c \u1ee9ng d\u1ee5ng OTP ch\u1ec9 trong m\u1ed9t c\u00e1i nh\u00ecn.<\/p>\n<h2>C\u01a1 ch\u1ebf c\u1ee7a c\u00e1c b\u1ea3n \u0111\u1ed3 tr\u1ef1c quan h\u00f3a Elixir<\/h2>\n<p>Trong VPasCode, vi\u1ec7c hi\u1ec3n th\u1ecb Elixir t\u1ef1 \u0111\u1ed9ng ph\u00e2n t\u00edch <code>defmodule<\/code>\u0111\u1ecbnh ngh\u0129a, <code>defstruct<\/code>khai b\u00e1o, c\u00e1c \u0111\u1eb7c t\u1ea3 ki\u1ec3u (<code>@type<\/code>), v\u00e0 c\u00e1c l\u1eddi g\u1ecdi h\u00e0nh vi (<code>@callback<\/code>) th\u00e0nh c\u00e1c th\u1ebb s\u01a1 \u0111\u1ed3 c\u00f3 c\u1ea5u tr\u00fac. C\u00e1c module \u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb nh\u01b0 c\u00e1c kh\u1ed1i th\u1ef1c th\u1ec3 ch\u00ednh, c\u00e1c tr\u01b0\u1eddng struct hi\u1ec3n th\u1ecb c\u00e1c \u0111\u1eb7c t\u1ea3 truy c\u1eadp v\u00e0 gi\u00e1 tr\u1ecb m\u1eb7c \u0111\u1ecbnh, v\u00e0 c\u00e1c h\u00e0nh vi module ho\u1eb7c h\u1ee3p \u0111\u1ed3ng s\u1eed d\u1ee5ng t\u1ea1o ra c\u00e1c \u0111\u01b0\u1eddng quan h\u1ec7 tr\u1ef1c ti\u1ebfp gi\u1eefa c\u00e1c n\u00fat tr\u1ef1c quan.<\/p>\n<h3>1. C\u00e0i \u0111\u1eb7t c\u01a1 b\u1ea3n<\/h3>\n<p>\u0110\u1ec3 tr\u1ef1c quan h\u00f3a ki\u1ebfn tr\u00fac module Elixir ti\u00eau chu\u1ea9n, h\u00e3y \u0111\u1ecbnh ngh\u0129a c\u00e1c h\u1ee3p \u0111\u1ed3ng h\u00e0nh vi c\u00f9ng v\u1edbi struct v\u00e0 tri\u1ec3n khai module. M\u1ed9t d\u1ecbch v\u1ee5 gi\u00e1m s\u00e1t telemetry ph\u00e2n t\u00e1n minh h\u1ecda c\u00e1c h\u00e0nh vi v\u00e0 \u0111\u1ecbnh ngh\u0129a struct c\u01a1 b\u1ea3n c\u1ee7a Elixir:<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">Elixir<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNp9kt1q2zAUx+8DeYeDx8CG4AcQY5S1uQisFNrsKgTh2KedqCV50pFLyPzu04e9JJ073xzO918\/nwafpW5ci7DFFiWSOZaP2GlDaKDRywXATaNryL7hz6oX2kCtFZmqJnj2TmgQNZixw2axoa7a9lDVr2Ocp6o8Ga4qicAYPHlPvZSUFyvoq9bFoHLygCYviuAw\/Qq\/4cTQGG1W4BfIvBiWC1TNcrFcNDPa1z0qmoTTsUOgMOkz5\/cPdz++rzk\/hdT0ieZKx2UqyPwwGfWe1V7lSEi0VMmOwV1FuPVu6D+XDEE8gJdvyThPcsdEswIWNnoTZ3v7d84+1d\/YDmtQ+JZfkrsCNq7xk2NdGhjnFSMTmEURMGTYE8\/gy1fYKMIXNCVpbuOm\/OloCWXplPjlkIuUz3es01aQ6HFfnBEkbnH1FBpppYdNwTlMjvx56LcJ1hBM\/Nn\/+eO3Wlnd4vujPaR7dWbmsEeeQnbtbDYR\/PB4\/0G6eSg7RzbPdvfr7ePmdg+fThf1A\/N+bBmy8WX+si\/f9gdsChMa\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda Elixir trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">Elixir<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNp9U8GK2zAQvQfyD4NLwYbgDxClLOwudKFlodmeQhCOPY3FWpIrS15C6nt769JzoaU\/0LuPW\/of\/pNKst0krbc+eJgZzZs3T6MM33KZmQLhBgvkqNUufo2lVBoVZHI+AzjLZArBi679XsLP+679LLaQP3wVOdQM0lyC2P760bVfGGwevklI\/S\/v2o9Qde194CHSpCg2SXoLymNT14ilYW+oSDgCIbC0ntjGOowWUCeF8UFh+AZVGEXOIfIW3sOeoFJSLcCS5GHUzGcosvlsPssmprmsUehxFL0rEbRDekrpq+uLNy8vKd271Pix7ITHccrRfDTp+R7YnuQ041jphJcELhKNN9Z19YcjjSMPYOlXWplUw4qwbAHEdbTGY1v7B2fdnz+rSkxB4F14rNyJYEMbi+zP9YAeLxo0gUkpnAwB1poG8Ow5XAmNW1SxlrTyncLlrtLIYyPYO4OU9flwRUpZMc1qXEcHCXrdfOsxNKjVDzYGp2Qy2q6HvBvFapzxl\/2fGz+XopIF\/r3GG8yTmkmjJlZ90JPxspjM9go+urz\/SHp1HZdGV2GwOrcP5wMsu\/bTGp7sj2oaYn1f1gTDdHa7j+f7DUhLI\/c=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Elixir in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-elixir\"><code class=\"language-elixir\" data-language=\"elixir\" class=\"language-elixir\">defmodule Telemetry.Reporter do\r\n  @doc \"H\u1ee3p \u0111\u1ed3ng h\u00e0nh vi cho ng\u01b0\u1eddi b\u00e1o c\u00e1o ch\u1ec9 s\u1ed1\"\r\n  @callback report_metric(metric_name :: String.t(), value :: number()) :: :ok | {:error, term()}\r\nend\r\n\r\ndefmodule Telemetry.Event do\r\n  @type t :: %__MODULE__{\r\n          id: String.t(),\r\n          name: String.t(),\r\n          value: number(),\r\n          timestamp: DateTime.t()\r\n        }\r\n\r\n  defstruct [:id, :name, :value, :timestamp]\r\n\r\n  @spec new(String.t(), number()) :: t()\r\n  def new(name, value) do\r\n    %__MODULE__{\r\n      id: \"evt_\" &lt;&gt; Integer.to_string(System.unique_integer([:positive])),\r\n      name: name,\r\n      value: value,\r\n      timestamp: DateTime.utc_now()\r\n    }\r\n  end\r\nend\r\n\r\ndefmodule Telemetry.ConsoleReporter do\r\n  @behaviour Telemetry.Reporter\r\n\r\n  @impl Telemetry.Reporter\r\n  def report_metric(metric_name, value) do\r\n    IO.puts(\"[CH\u1ec8 S\u1ed0] #{metric_name}: #{value}\")\r\n    :ok\r\n  end\r\nend<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNp9U8GK2zAQvQfyD4NLwYbgDxClLOwudKFlodmeQhCOPY3FWpIrS15C6nt769JzoaU\/0LuPW\/of\/pNKst0krbc+eJgZzZs3T6MM33KZmQLhBgvkqNUufo2lVBoVZHI+AzjLZArBi679XsLP+679LLaQP3wVOdQM0lyC2P760bVfGGwevklI\/S\/v2o9Qde194CHSpCg2SXoLymNT14ilYW+oSDgCIbC0ntjGOowWUCeF8UFh+AZVGEXOIfIW3sOeoFJSLcCS5GHUzGcosvlsPssmprmsUehxFL0rEbRDekrpq+uLNy8vKd271Pix7ITHccrRfDTp+R7YnuQ041jphJcELhKNN9Z19YcjjSMPYOlXWplUw4qwbAHEdbTGY1v7B2fdnz+rSkxB4F14rNyJYEMbi+zP9YAeLxo0gUkpnAwB1poG8Ow5XAmNW1SxlrTyncLlrtLIYyPYO4OU9flwRUpZMc1qXEcHCXrdfOsxNKjVDzYGp2Qy2q6HvBvFapzxl\/2fGz+XopIF\/r3GG8yTmkmjJlZ90JPxspjM9go+urz\/SHp1HZdGV2GwOrcP5wMsu\/bTGp7sj2oaYn1f1gTDdHa7j+f7DUhLI\/c=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Elixir in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNp9kt1q2zAUx+8DeYeDx8CG4AcQY5S1uQisFNrsKgTh2KedqCV50pFLyPzu04e9JJ073xzO918\/nwafpW5ci7DFFiWSOZaP2GlDaKDRywXATaNryL7hz6oX2kCtFZmqJnj2TmgQNZixw2axoa7a9lDVr2Ocp6o8Ga4qicAYPHlPvZSUFyvoq9bFoHLygCYviuAw\/Qq\/4cTQGG1W4BfIvBiWC1TNcrFcNDPa1z0qmoTTsUOgMOkz5\/cPdz++rzk\/hdT0ieZKx2UqyPwwGfWe1V7lSEi0VMmOwV1FuPVu6D+XDEE8gJdvyThPcsdEswIWNnoTZ3v7d84+1d\/YDmtQ+JZfkrsCNq7xk2NdGhjnFSMTmEURMGTYE8\/gy1fYKMIXNCVpbuOm\/OloCWXplPjlkIuUz3es01aQ6HFfnBEkbnH1FBpppYdNwTlMjvx56LcJ1hBM\/Nn\/+eO3Wlnd4vujPaR7dWbmsEeeQnbtbDYR\/PB4\/0G6eSg7RzbPdvfr7ePmdg+fThf1A\/N+bBmy8WX+si\/f9gdsChMa\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda Elixir trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"royHukq\"><img fetchpriority=\"high\" alt=\"\" class=\"alignnone wp-image-1545 size-full\" decoding=\"async\" fetchpriority=\"high\" height=\"482\" sizes=\"(max-width: 1954px) 100vw, 1954px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559.png 1954w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559-300x74.png 300w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559-1024x253.png 1024w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559-768x189.png 768w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559-1536x379.png 1536w\" width=\"1954\"\/><\/p>\n<p>\u00a0<\/p>\n<h2>C\u00e1c k\u1ef9 thu\u1eadt c\u1ea5u tr\u00fac n\u00e2ng cao<\/h2>\n<p>C\u00e1c b\u1ea3n \u0111\u1ed3 tr\u1ef1c quan h\u00f3a Elixir xu\u1ea5t s\u1eafc trong vi\u1ec7c l\u1eadp b\u1ea3n \u0111\u1ed3 c\u00e1c m\u00f4 h\u00ecnh mi\u1ec1n ch\u1ee9c n\u0103ng, c\u00e1c t\u1eadp h\u1ee3p gi\u1ecf h\u00e0ng b\u1ea5t bi\u1ebfn v\u00e0 c\u00e1c chuy\u1ec3n tr\u1ea1ng th\u00e1i kh\u1edbp m\u1eabu.<\/p>\n<h3>1. Mi\u1ec1n gi\u1ecf h\u00e0ng v\u00e0 thanh to\u00e1n th\u01b0\u01a1ng m\u1ea1i \u0111i\u1ec7n t\u1eed<\/h3>\n<p>B\u1eb1ng c\u00e1ch k\u1ebft h\u1ee3p c\u00e1c struct gi\u00e1 tr\u1ecb, c\u00e1c \u0111\u1eb7c t\u1ea3 ki\u1ec3u v\u00e0 c\u00e1c module mi\u1ec1n ch\u1ee9c n\u0103ng, VPasCode chuy\u1ec3n \u0111\u1ed5i c\u00e1c l\u1edbp mi\u1ec1n ch\u1ee9c n\u0103ng Elixir th\u00e0nh c\u00e1c m\u1ea1ng l\u01b0\u1edbi s\u01a1 \u0111\u1ed3 s\u1ea1ch s\u1ebd, c\u00f3 c\u1ea5u tr\u00fac:<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">Elixir<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNqNUt9rwjAQfhf8Hw5BqBCEvQYGA93DYGMPsicpISSnBm3TJdeBdP3fl2hjq2OyvpRcvvt+3EXjprC6PiCsyDqcL6SjF8ICtB2PAJ7oWCEQcA5TId7elx+vz0I08Sp9fl\/z0OxMuZ1TNmPDu7o0JCpnFHJYojKFPPzCfNayJENHDpX1wpSEW3TZrIe041E8aNx4crUiWPOgyYD37GzA8pCPR1jq2KRvwq12tqqCzxiyCygPRvqb7Ge9f0Q3+s\/kqvZkC3TiDsYELc\/hYDxlSTuCrlGeJNUBxqUi84XwDVztUO1RC1vT3TEZHaY0cMKS5Dpnt7x5l9pXqEBqLSI0i5bhylucB53XE6R65HBGN9QtPIIKHAymiaqJtdg36\/YAMG0iJsRLHuM\/HGN1fqrlbUR2u01WT7MIg8iSuYbbPYsW29DccHTOOjZYQZusXzrvWO8nJgKbyFOU3vZZ7mL+0j\/YUXvt+0pbnNhYoOO92clClqWlCwqwqOgI1oEpu1cQ2ybt6aX\/AIguIiE=\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda Elixir trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">Elixir<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNqNUsFq3DAQvfsrhsCCF8RCr4JAoemhJKWH0FMwwkiKLXZXcqVxITg+9QNKjr01\/1AodI\/bH\/GfdOStvV7DhvhgWdKbN++9sdL3W6fqjYZbdF6v3uUeP6DegnIJwFt8qDQgcA4LIT5+uvp8816Ihm6GJ6xrTqXe2GKF6ZJNrmprUFTeSM3hSkuzzTdzyJc6t2jwgUPlgjAWdaF9uhwRbUKfSt8H9LVEuOPUjgE\/MrMJxZss0VYlSaJmnm5LV1UkMHo7+Mo3Jg8zx8mr\/Bp1zq6sA7qt9uI8xFCbwGFjAqZD24g5AQXMsSYUzyWarxoegctSy7VWwtV4PhqjKJmJCDa0u8vYnDTrzYZKS8iVEhGYRq1woirGgP00qM8ROE1mxtvCJUiiYLAYmJp4FuuWh+gBFk2EkK9BX1xpG09X\/VnWErCf5aCyT4Dsp4Ouhrs1i+paqmy49t55Nom9\/a96LHxB9TEpQWQiG1yMig\/NRt1j+WQu7UTySV\/RMzGi4kedF9fl\/pctAMtu943euS0B3f7ZQmG63Xco9z\/jre92T7SWrvvzW8L6UBN3zwh\/n7rdD1tctPGn\/wegfTYu\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Elixir in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-elixir\"><code class=\"language-elixir\" data-language=\"elixir\" class=\"language-elixir\">defmodule Store.CartItem do\n  @type t :: %__MODULE__{\n          sku: String.t(),\n          unit_price: Decimal.t(),\n          quantity: pos_integer()\n        }\n\n  defstruct [:sku, :unit_price, quantity: 1]\nend\n\n\ndefmodule Store.ShoppingCart do\n  alias Store.CartItem\n\n  @type t :: %__MODULE__{\n          id: String.t(),\n          customer_id: String.t(),\n          items: list(CartItem.t()),\n          status: :active | :checked_out\n        }\n\n  defstruct [:id, :customer_id, items: [], status: :active]\n\n  @spec add_item(t(), CartItem.t()) :: t()\n  def add_item(%__MODULE__{status: :active} = cart, %CartItem{} = item) do\n    %{cart | items: [item | cart.items]}\n  end\n\n  @spec checkout(t()) :: {:ok, t()} | {:error, String.t()}\n  def checkout(%__MODULE__{status: :active, items: [_ | _]} = cart) do\n    {:ok, %{cart | status: :checked_out}}\n  end\n\n  def checkout(_cart), do: {:error, \"Kh\u00f4ng th\u1ec3 thanh to\u00e1n gi\u1ecf h\u00e0ng tr\u1ed1ng ho\u1eb7c kh\u00f4ng ho\u1ea1t \u0111\u1ed9ng\"}\nend<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNqNUsFq3DAQvfsrhsCCF8RCr4JAoemhJKWH0FMwwkiKLXZXcqVxITg+9QNKjr01\/1AodI\/bH\/GfdOStvV7DhvhgWdKbN++9sdL3W6fqjYZbdF6v3uUeP6DegnIJwFt8qDQgcA4LIT5+uvp8816Ihm6GJ6xrTqXe2GKF6ZJNrmprUFTeSM3hSkuzzTdzyJc6t2jwgUPlgjAWdaF9uhwRbUKfSt8H9LVEuOPUjgE\/MrMJxZss0VYlSaJmnm5LV1UkMHo7+Mo3Jg8zx8mr\/Bp1zq6sA7qt9uI8xFCbwGFjAqZD24g5AQXMsSYUzyWarxoegctSy7VWwtV4PhqjKJmJCDa0u8vYnDTrzYZKS8iVEhGYRq1woirGgP00qM8ROE1mxtvCJUiiYLAYmJp4FuuWh+gBFk2EkK9BX1xpG09X\/VnWErCf5aCyT4Dsp4Ouhrs1i+paqmy49t55Nom9\/a96LHxB9TEpQWQiG1yMig\/NRt1j+WQu7UTySV\/RMzGi4kedF9fl\/pctAMtu943euS0B3f7ZQmG63Xco9z\/jre92T7SWrvvzW8L6UBN3zwh\/n7rdD1tctPGn\/wegfTYu\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Elixir in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNqNUt9rwjAQfhf8Hw5BqBCEvQYGA93DYGMPsicpISSnBm3TJdeBdP3fl2hjq2OyvpRcvvt+3EXjprC6PiCsyDqcL6SjF8ICtB2PAJ7oWCEQcA5TId7elx+vz0I08Sp9fl\/z0OxMuZ1TNmPDu7o0JCpnFHJYojKFPPzCfNayJENHDpX1wpSEW3TZrIe041E8aNx4crUiWPOgyYD37GzA8pCPR1jq2KRvwq12tqqCzxiyCygPRvqb7Ge9f0Q3+s\/kqvZkC3TiDsYELc\/hYDxlSTuCrlGeJNUBxqUi84XwDVztUO1RC1vT3TEZHaY0cMKS5Dpnt7x5l9pXqEBqLSI0i5bhylucB53XE6R65HBGN9QtPIIKHAymiaqJtdg36\/YAMG0iJsRLHuM\/HGN1fqrlbUR2u01WT7MIg8iSuYbbPYsW29DccHTOOjZYQZusXzrvWO8nJgKbyFOU3vZZ7mL+0j\/YUXvt+0pbnNhYoOO92clClqWlCwqwqOgI1oEpu1cQ2ybt6aX\/AIguIiE=\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda Elixir trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"CLTWMkS\"><img alt=\"\" class=\"alignnone wp-image-1546 size-full\" decoding=\"async\" height=\"550\" sizes=\"(max-width: 1954px) 100vw, 1954px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587269486-e1785223337333.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587269486-e1785223337333.png 1954w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587269486-e1785223337333-300x84.png 300w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587269486-e1785223337333-1024x288.png 1024w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587269486-e1785223337333-768x216.png 768w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587269486-e1785223337333-1536x432.png 1536w\" width=\"1954\"\/><\/p>\n<p>\u00a0<\/p>\n<h2>C\u1ea5u tr\u00fac c\u00e1c t\u00e1c nh\u00e2n OTP GenServer v\u00e0 c\u00e1c \u0111\u01b0\u1eddng \u1ed1ng gi\u00e1m s\u00e1t<\/h2>\n<p>Vi\u1ec7c tr\u1ef1c quan h\u00f3a c\u00e1c API kh\u00e1ch h\u00e0ng OTP GenServer, c\u00e1c c\u1ea5u tr\u00fac tr\u1ea1ng th\u00e1i m\u00e1y ch\u1ee7 v\u00e0 c\u00e1c c\u00e2y gi\u00e1m s\u00e1t gi\u00fap c\u00e1c nh\u00f3m Elixir thi\u1ebft k\u1ebf c\u00e1c d\u1ecbch v\u1ee5 n\u1ec1n t\u1ea3ng \u0111\u1ed3ng th\u1eddi b\u1ec1n b\u1ec9, ch\u1ecbu l\u1ed7i t\u1ed1t.<\/p>\n<h3>1. T\u00e1c nh\u00e2n h\u00e0ng \u0111\u1ee3i OTP GenServer<\/h3>\n<p>Nh\u00f3m c\u00e1c h\u00e0m API kh\u00e1ch h\u00e0ng, c\u00e1c ph\u1ea3n h\u1ed3i GenServer v\u00e0 c\u00e1c c\u1ea5u tr\u00fac tr\u1ea1ng th\u00e1i n\u1ed9i b\u1ed9 \u0111\u1ec3 x\u00e1c \u0111\u1ecbnh ranh gi\u1edbi c\u1ee7a c\u00e1c t\u00e1c nh\u00e2n \u0111\u1ed3ng th\u1eddi:<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">Elixir<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNp1UWFLwzAQ\/T7YfziQQcvK8HNBmEwRQXEyxA9jhKw5u9g0qUk6GLX\/3aRdu1a0kIbcvXv33h3Dj1yxUiCstUrQGC7T1xJLXLwrnaEGpqYTgNIgPKDcoD6ink58iPWVG0stnoEAS3sqECzEMcwIeX65e3u6J6Rqk9335VvEILixgUWdB2EYjRE0sfyI5FPtTQxSSSIxJVxaTFEH4RBbtw+nx1hdJrYj3+6iMcu1B6Jkrf4rWAmO0sLt+vHsB4yl2hLBZRaowpqwN9V7XwwgF3cReHgEkuau8SUejjr6DkVpDl5O4M5f9Al1ExkSV7EvicDh6\/CXgbYGVlSIPU0y46NLnhdiuKu2L5fc8Y5NVbHKIpg166vqekT+D82BSiaQNCqHynqa8+ybq4YbP1GLl5ZlwdybkSbv0u09n8PWsew6WVJpLMTJkVZNPXx3Ox3VDyS73w\/TBNg5\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda Elixir trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">Elixir<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNptkVFKw0AQht89xYAUEhqKzwGhoiKCYqWID6UsMRmTNclu3N0USswpvIDFB++gjz1Jb+IkadIEGlh2s\/vPN\/\/MBPiayiBPEGZK+qg1F+FjjjlOnqWKUUEgTwByjXCDYo5qheqELoIubG48g40KYGrWGYIB14URY\/cPV09314wV9Vv7vVd0FxKujWVQpZZtOwOB5xu+QvYmX7QLQgomMGRcGAxRWXZPWtZnsqKNyn3TkhdLZ8g4Ix2KoPJ9ChezW4ij7caPINp+ibApBrTxlGEJF7ElM6PttqKu6klPcSjNgUrtgPBSyny4tw8pK3qW66gyY9E6gvY96kUfWrhVhAMkL+2++0syDlm0+\/0WEO3+Pjmk280afDr\/kGDK0yzpTarJzgUn\/KCswpWxA6N6eEVZHlIcJ0SeCBJktc++tw6xb329lXBetdNgly3PAvoNWP1Mr80+HsOCIMu9ISEVZsmakEUdDR\/tQAfhnVla\/+8l4lg=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Elixir in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-elixir\"><code class=\"language-elixir\" data-language=\"elixir\" class=\"language-elixir\">defmodule ProcessingQueue.Worker do\n  use GenServer\n\n  defmodule State do\n    @type t :: %__MODULE__{\n            queue: list(term()),\n            active_jobs: non_neg_integer()\n          }\n    defstruct queue: [], active_jobs: 0\n  end\n\n  # API kh\u00e1ch h\u00e0ng\n  def start_link(opts) do\n    GenServer.start_link(__MODULE__, opts, name: __MODULE__)\n  end\n\n  def push_job(job) do\n    GenServer.cast(__MODULE__, {:push, job})\n  end\n\n  # C\u00e1c ph\u1ea3n h\u1ed3i m\u00e1y ch\u1ee7\n  @impl GenServer\n  def init(_opts) do\n    {:ok, %State{}}\n  end\n\n  @impl GenServer\n  def handle_cast({:push, job}, %State{queue: queue} = state) do\n    updated_queue = queue ++ [job]\n    {:noreply, %{state | queue: updated_queue}}\n  end\nend<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNptkVFKw0AQht89xYAUEhqKzwGhoiKCYqWID6UsMRmTNclu3N0USswpvIDFB++gjz1Jb+IkadIEGlh2s\/vPN\/\/MBPiayiBPEGZK+qg1F+FjjjlOnqWKUUEgTwByjXCDYo5qheqELoIubG48g40KYGrWGYIB14URY\/cPV09314wV9Vv7vVd0FxKujWVQpZZtOwOB5xu+QvYmX7QLQgomMGRcGAxRWXZPWtZnsqKNyn3TkhdLZ8g4Ix2KoPJ9ChezW4ij7caPINp+ibApBrTxlGEJF7ElM6PttqKu6klPcSjNgUrtgPBSyny4tw8pK3qW66gyY9E6gvY96kUfWrhVhAMkL+2++0syDlm0+\/0WEO3+Pjmk280afDr\/kGDK0yzpTarJzgUn\/KCswpWxA6N6eEVZHlIcJ0SeCBJktc++tw6xb329lXBetdNgly3PAvoNWP1Mr80+HsOCIMu9ISEVZsmakEUdDR\/tQAfhnVla\/+8l4lg=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit Elixir in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#elixir:eNp1UWFLwzAQ\/T7YfziQQcvK8HNBmEwRQXEyxA9jhKw5u9g0qUk6GLX\/3aRdu1a0kIbcvXv33h3Dj1yxUiCstUrQGC7T1xJLXLwrnaEGpqYTgNIgPKDcoD6ink58iPWVG0stnoEAS3sqECzEMcwIeX65e3u6J6Rqk9335VvEILixgUWdB2EYjRE0sfyI5FPtTQxSSSIxJVxaTFEH4RBbtw+nx1hdJrYj3+6iMcu1B6Jkrf4rWAmO0sLt+vHsB4yl2hLBZRaowpqwN9V7XwwgF3cReHgEkuau8SUejjr6DkVpDl5O4M5f9Al1ExkSV7EvicDh6\/CXgbYGVlSIPU0y46NLnhdiuKu2L5fc8Y5NVbHKIpg166vqekT+D82BSiaQNCqHynqa8+ybq4YbP1GLl5ZlwdybkSbv0u09n8PWsew6WVJpLMTJkVZNPXx3Ox3VDyS73w\/TBNg5\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda Elixir trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"zAtgJnN\"><img alt=\"\" class=\"alignnone wp-image-1547 size-full\" decoding=\"async\" height=\"375\" sizes=\"(max-width: 1954px) 100vw, 1954px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587f477c0-e1785223316605.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587f477c0-e1785223316605.png 1954w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587f477c0-e1785223316605-300x58.png 300w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587f477c0-e1785223316605-1024x197.png 1024w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587f477c0-e1785223316605-768x147.png 768w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a68587f477c0-e1785223316605-1536x295.png 1536w\" width=\"1954\"\/><\/p>\n<p>\u00a0<\/p>\n<h2>C\u00e1c th\u1ef1c h\u00e0nh t\u1ed1t chi\u1ebfn l\u01b0\u1ee3c<\/h2>\n<ul>\n<li><strong>S\u1eed d\u1ee5ng <code>defstruct<\/code> cho c\u00e1c m\u00f4 h\u00ecnh mi\u1ec1n:<\/strong>Khai b\u00e1o c\u00e1c c\u1ea5u tr\u00fac r\u00f5 r\u00e0ng v\u1edbi c\u00e1c gi\u00e1 tr\u1ecb m\u1eb7c \u0111\u1ecbnh \u0111\u1ec3 c\u00e1c thu\u1ed9c t\u00ednh th\u1ef1c th\u1ec3 \u0111\u01b0\u1ee3c th\u1ec3 hi\u1ec7n r\u00f5 r\u00e0ng tr\u00ean c\u00e1c th\u1ebb n\u00fat tr\u1ef1c quan.<\/li>\n<li><strong>T\u1eadn d\u1ee5ng <code>@behaviour<\/code> cho c\u00e1c h\u1ee3p \u0111\u1ed3ng:<\/strong>X\u00e1c \u0111\u1ecbnh c\u00e1c giao di\u1ec7n module t\u00e1i s\u1eed d\u1ee5ng b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng <code>@callback<\/code>c\u00e1c \u0111\u1ecbnh ngh\u0129a \u0111\u1ec3 gi\u1eef cho c\u00e1c tr\u1eebu t\u01b0\u1ee3ng ch\u1ee9c n\u0103ng lu\u00f4n hi\u1ec3n th\u1ecb r\u00f5 r\u00e0ng.<\/li>\n<li><strong>Ghi ch\u00fa ki\u1ec3u v\u1edbi <code>@type<\/code>:<\/strong>Bao g\u1ed3m c\u00e1c \u0111\u1eb7c t\u1ea3 ki\u1ec3u r\u00f5 r\u00e0ng cho c\u00e1c tr\u01b0\u1eddng c\u1ea5u tr\u00fac v\u00e0 tham s\u1ed1 h\u00e0m \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o c\u00e1c k\u00fd hi\u1ec7u tham s\u1ed1 r\u00f5 r\u00e0ng trong s\u01a1 \u0111\u1ed3.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Khi thi\u1ebft k\u1ebf c\u00e1c \u1ee9ng d\u1ee5ng ch\u1ecbu l\u1ed7i, \u0111\u1ed3ng th\u1eddi ho\u1eb7c c\u00e1c h\u1ec7 th\u1ed1ng ph\u00e2n t\u00e1n b\u1eb1ng Elixir, vi\u1ec7c \u0111i qua c\u00e1c ranh gi\u1edbi module, h\u1ee3p \u0111\u1ed3ng struct, h\u00e0nh vi v\u00e0 c\u00e2y gi\u00e1m s\u00e1t OTP c\u00f3 th\u1ec3 khi\u1ebfn vi\u1ec7c h\u00ecnh&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":14,"template":"","meta":{"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}}},"ld_collection":[14],"class_list":["post-2019","ld_docs","type-ld_docs","status-publish","hentry","ld_collection-vpascode-docs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Elixir to Diagram Guide | Text to Diagram with VPasCode<\/title>\n<meta name=\"description\" content=\"Map Elixir modules and processes into clear visual charts with VPasCode, a lightweight diagram-as-code tool built for fast text to diagram visualization.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Elixir to Diagram Guide | Text to Diagram with VPasCode\" \/>\n<meta property=\"og:description\" content=\"Map Elixir modules and processes into clear visual charts with VPasCode, a lightweight diagram-as-code tool built for fast text to diagram visualization.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"VPasCode\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 ph\u00fat\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/elixir-visualizer-guide\\\/\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/elixir-visualizer-guide\\\/\",\"name\":\"Elixir to Diagram Guide | Text to Diagram with VPasCode\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/elixir-visualizer-guide\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/elixir-visualizer-guide\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.vpascode.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/img_6a6858616af81-e1785223353559.png\",\"datePublished\":\"2026-07-28T06:23:47+00:00\",\"description\":\"Map Elixir modules and processes into clear visual charts with VPasCode, a lightweight diagram-as-code tool built for fast text to diagram visualization.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/elixir-visualizer-guide\\\/#breadcrumb\"},\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/elixir-visualizer-guide\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/elixir-visualizer-guide\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/img_6a6858616af81-e1785223353559.png\",\"contentUrl\":\"https:\\\/\\\/www.vpascode.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/img_6a6858616af81-e1785223353559.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/elixir-visualizer-guide\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lean Docs\",\"item\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/%ld_collection%\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Elixir\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#website\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/\",\"name\":\"VPasCode\",\"description\":\"by Visual Paradigm\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"vi\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#organization\",\"name\":\"VPasCode\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/wp-content\\\/uploads\\\/sites\\\/12\\\/2026\\\/06\\\/cropped-vp-online-logo-v1.png\",\"contentUrl\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/wp-content\\\/uploads\\\/sites\\\/12\\\/2026\\\/06\\\/cropped-vp-online-logo-v1.png\",\"width\":128,\"height\":138,\"caption\":\"VPasCode\"},\"image\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Elixir to Diagram Guide | Text to Diagram with VPasCode","description":"Map Elixir modules and processes into clear visual charts with VPasCode, a lightweight diagram-as-code tool built for fast text to diagram visualization.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/","og_locale":"vi_VN","og_type":"article","og_title":"Elixir to Diagram Guide | Text to Diagram with VPasCode","og_description":"Map Elixir modules and processes into clear visual charts with VPasCode, a lightweight diagram-as-code tool built for fast text to diagram visualization.","og_url":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/","og_site_name":"VPasCode","og_image":[{"url":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"2 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/","url":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/","name":"Elixir to Diagram Guide | Text to Diagram with VPasCode","isPartOf":{"@id":"https:\/\/www.vpascode.com\/vn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/#primaryimage"},"image":{"@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559.png","datePublished":"2026-07-28T06:23:47+00:00","description":"Map Elixir modules and processes into clear visual charts with VPasCode, a lightweight diagram-as-code tool built for fast text to diagram visualization.","breadcrumb":{"@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/#primaryimage","url":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559.png","contentUrl":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/07\/img_6a6858616af81-e1785223353559.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/elixir-visualizer-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vpascode.com\/vn\/"},{"@type":"ListItem","position":2,"name":"Lean Docs","item":"https:\/\/www.vpascode.com\/vn\/docs\/%ld_collection%\/"},{"@type":"ListItem","position":3,"name":"Elixir"}]},{"@type":"WebSite","@id":"https:\/\/www.vpascode.com\/vn\/#website","url":"https:\/\/www.vpascode.com\/vn\/","name":"VPasCode","description":"by Visual Paradigm","publisher":{"@id":"https:\/\/www.vpascode.com\/vn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vpascode.com\/vn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/www.vpascode.com\/vn\/#organization","name":"VPasCode","url":"https:\/\/www.vpascode.com\/vn\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/www.vpascode.com\/vn\/#\/schema\/logo\/image\/","url":"https:\/\/www.vpascode.com\/vn\/wp-content\/uploads\/sites\/12\/2026\/06\/cropped-vp-online-logo-v1.png","contentUrl":"https:\/\/www.vpascode.com\/vn\/wp-content\/uploads\/sites\/12\/2026\/06\/cropped-vp-online-logo-v1.png","width":128,"height":138,"caption":"VPasCode"},"image":{"@id":"https:\/\/www.vpascode.com\/vn\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/ld_docs\/2019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/ld_docs"}],"about":[{"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/types\/ld_docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/users\/3"}],"wp:attachment":[{"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/media?parent=2019"}],"wp:term":[{"taxonomy":"ld_collection","embeddable":true,"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/ld_collection?post=2019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}