Mix.install([
{:jason, "~> 1.2"},
{:absinthe, "~> 1.6"},
# Not required for generating json schema. Only used to validate data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: '3.7' | |
name: redpanda-quickstart | |
networks: | |
redpanda_network: | |
driver: bridge | |
volumes: | |
redpanda-0: | |
services: | |
redpanda-0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace function delete_stream_events_of_type(target_stream_id bigint, target_event_type text) returns integer | |
language sql | |
as | |
$$ | |
-- disable triggers | |
alter table stream_events disable trigger no_update_stream_events; | |
alter table stream_events disable trigger no_delete_stream_events; | |
alter table events disable trigger no_delete_events; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ShutUpDialyzer do | |
defmacro __using__(_opts) do | |
quote do | |
@on_definition unquote(__MODULE__) | |
@before_compile unquote(__MODULE__) | |
Module.register_attribute(__MODULE__, :funs, accumulate: true) | |
end | |
end | |
def __on_definition__(%{module: module}, :def, name, args, _guards, _body) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Mix.Tasks.InspectAggregate do | |
use Mix.Task | |
alias MyApp.EventStore | |
def run(args) do | |
Application.ensure_all_started(:eventstore) | |
_ = EventStore.start_link() | |
{opts, _} = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mix.install([:decimal]) | |
defmodule DecimalMath do | |
alias Decimal, as: D | |
import Decimal | |
defmacro __using__(_opts) do | |
quote do | |
import Kernel, except: [*: 2, /: 2, +: 2, -: 2] | |
import DecimalMath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Middleware.HandleExceptions do | |
require Logger | |
alias Absinthe.Resolution | |
alias Ecto.Query.CastError | |
alias AbsintheErrorPayload.ChangesetParser | |
alias Ecto.{InvalidChangesetError, NoResultsError, StaleEntryError} | |
def handle_exceptions(middleware_spec) do | |
fn resolution, config -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
directive @connection(key: String!, filters: [String], handler: String, dynamicKey_UNSTABLE: String) on FIELD | |
directive @stream_connection( | |
key: String! | |
filters: [String] | |
handler: String | |
initial_count: Int! | |
if: Boolean = true | |
use_customized_batch: Boolean = false | |
dynamicKey_UNSTABLE: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule EventStore.CategoryStreamLinker do | |
@moduledoc """ | |
Links streams from aggregate instances to their respective category streams. | |
example: events from stream_uuid of `contractors_contract-07c52787-da0c-444f-9783-5d380f7093f9` will be | |
linked to stream_uuid of `contractors_contract`. | |
""" | |
use Commanded.Event.Handler, | |
application: My.App, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ${environment} deploy | |
on: | |
push: | |
branches: | |
- ${deploy_branch} | |
workflow_dispatch: | |
env: | |
CONTAINER_NAME: ${container_name} |
NewerOlder