Now we are working on the mutations.
error_details/1 in the resolvers/menu.ex can be defp (for now).
Also it seems that the lex bug that limited the column to being zero has now been fixed.
Random outpourings of a software developer
Now we are working on the mutations.
error_details/1 in the resolvers/menu.ex can be defp (for now).
Also it seems that the lex bug that limited the column to being zero has now been fixed.
A key observation on Absinthe/GraphQL that had not been made clear elsewhere, you can only have one root query and one root mutation. Everything else happens inside that.
Absinthe will not merge multiple queries or mutations.
I have been looking for a decent template to document CQRS ES.
I think I have found one: https://github.com/tmorin/plantuml-libs
The following diagram:
This was generated using plantuml
from the following source:
@startuml
' configures the library
' loads the library's bootstrap
!include https://raw.githubusercontent.com/tmorin/plantuml-libs/master/distribution/bootstrap.puml
!include https://raw.githubusercontent.com/tmorin/plantuml-libs/master/distribution/eventstorming/bootstrap.puml
' loads the package bootstrap
' include elements
include('eventstorming/Element/FacadeCommand')
include('eventstorming/Element/Command')
include('eventstorming/Element/Result')
include('eventstorming/Element/Event')
include('eventstorming/Element/DomainEvent')
include('eventstorming/Element/IntegrationEvent')
include('eventstorming/Element/Query')
include('eventstorming/Element/ReadModel')
include('eventstorming/Element/UserInterface')
include('eventstorming/Element/Aggregate')
include('eventstorming/Element/Service')
include('eventstorming/Element/Policy')
include('eventstorming/Element/Saga')
include('eventstorming/Element/Process')
include('eventstorming/Element/Timer')
include('eventstorming/Element/Person')
include('eventstorming/Element/System')
include('eventstorming/Element/Comment')
' display elements
FacadeCommand('FacadeCommand')
Command('Command')
Result('Result')
Event('Event')
DomainEvent('DomainEvent')
IntegrationEvent('IntegrationEvent')
Query('Query')
ReadModel('ReadModel')
UserInterface('UserInterface')
Aggregate('Aggregate')
Service('Service')
Policy('Policy')
Saga('Saga')
Process('Process')
Timer('Timer')
Person('Person')
System('System')
Comment('Comment')
@enduml
The advantage of this is that it does not require a local copy of the project.
The downside is that it requires an internet connection, and is at risk of the project being moved.
I can see myself making use of this.
I have forked this project so that I can have a guaranteed stable location and use a single file.
This reduces the above to:
@startuml
!include https://raw.githubusercontent.com/chriseyre2000/plantuml-libs/master/distribution/eventstorming/eventstorming.puml
' display elements
FacadeCommand('FacadeCommand')
Command('Command')
Result('Result')
Event('Event')
DomainEvent('DomainEvent')
IntegrationEvent('IntegrationEvent')
Query('Query')
ReadModel('ReadModel')
UserInterface('UserInterface')
Aggregate('Aggregate')
Service('Service')
Policy('Policy')
Saga('Saga')
Process('Process')
Timer('Timer')
Person('Person')
System('System')
Comment('Comment')
@enduml
Here is a link to the book on Commanded by the author of the framework:
I am now onto the mutations chapter.
It seems that Decimal has changed it’s parse return. It used to be {:ok, decimal}
but is now {decimal, remainder}
which means that you will need the following to get Chapter 5 to build:
scalar :decimal do
parse fn
%{value: value}, _ ->
{d,_} = Decimal.parse(value)
{:ok, d}
_, _ ->
:error
end
serialize &to_string/1
end
The UK currently has a cost of living crisis. Inflation is going through the roof and the only think being done to influence this is to put up interest rates! The argument for this is that if credit becomes more expensive people will reduce what they are spending. Are economists so stuck in 1970’s models that they can see nothing else?
Credit card use is not rising because credit is cheap, they are rising because costs are escalating. Adding to the interest on mortgages and credit cards won’t help control this. This will drive workers to ask for larger pay rises and will fix the interest rate growth as permanent.
Fuel price rises have a massive effect across the whole supply chain. We had protests in the UK when petrol first reached 1 GBP per litre, we are now at around 1.85 GBP.
We have a leadership contest going on between two people who are denying reality and aiming for the votes of a very small electorate. Neither candidate has a sensible plan (or indeed a mandate). One wants to control inflation and the other wants to cut tax.
Still working. through the examples.
Project is at https://github.com/chriseyre2000/absinthe_demo
Currently at df7c52f
Again there is a minor difference in the error message format, and the error is a 200 not a 400.
It’s interesting to see custom modification.
Now at the end of chapter 3
Chapter 4 introduces some useful extra structure, allowing the schema to be broken down into manageable pieces.
The next step will cover unions.
This is my current VSCode settings:
{
"files.autoSave": "afterDelay",
"diffEditor.ignoreTrimWhitespace": false,
"git.openDiffOnClick": false
}
It’s not much but it is a start.
Autosave is a must.
Opening the file from diff is much more sensible than assuming you want the diff.
Not got as far as I had expected on this.
Good note on this book is that the tests are immediately after the code making errors much easier to spot.
Protox is a great library to allow Protobuf to be used in Elixir.
While developing a span catcher for OpenTelemetry I found that I needed to decode a protobuf format message.
Here is the repo if you are interested:
https://github.com/chriseyre2000/span_eater
To construct the protobuf file I looked at the readme of opentelemetry_exporter, which pointed me to the protobuf definitions:
https://github.com/open-telemetry/opentelemetry-proto/tree/v0.11.0
I chose to simplify these into a single file (it’s not that large).
Protobuf is a wire format serializer. This means that if you send a Protobuf message any language that can use protobuf can read the message (provided that both side have the definition).
Given that this proto file has been implemented by a number of OpenTelemetry consumers it can be assumed to be stable.