hauleth
BARE encoding library
I do not know how many of you are familiar with BARE encoding format which was designed by Drew DeVault. It is super simple format for binary encoding of messages with structure known ahead-of-time (so it isn’t self-descriptive like CBOR). Now it got Erlang implementation (currently without compiler for building structure definition form text definitions).
Library usage is pretty simple (here with Elixir syntax):
spec = {:struct, [foo: :uint, bar: :string]}
encoded = :bare.encode(%{foo: 10, bar: "Hełło"}, spec)
:bare.decode(encoded, spec)
#=> {:ok, %{foo: 10, bar: "Hełło"}, <<>>}
Supported types are:
:uint/:int- variable width unsigned/signed integer (specs limit size of these integers to max 64-bit integers):u8/:u16/:u32/:u64- fixed width unsigned integers:i8/:i16/:i32/:i64- fixed width signed integers:bool- boolean values (akatrueandfalseatoms):f32/:f64- floating points of given size, currently encoding is limited to finite values, but encoding supports not-finite values which are returned as atoms{:enum, [atom(), ...]}- which will encode known set of atoms asuint:dataanddata<N>- which will encode arbitrary/fixed-length binaries:string- UTF-8 encoded chartist or binary:void- empty type that can encode only[]{:optional, type}- optional value oftype{:array, type}- list oftype{:array, type, size}- fixed length list oftype{:map, key_type, value_type}- map with keys ofkey_typeand values ofvalue_type{:union, [type(), ...]}- tagged union of types which can encode values in form of{type(), data}wheredatais oftype(){:struct, keyword(type())}- structure with given keys that can encode maps with atom keys and values of specified types
Let me know what you think about it, either here or via mailing list.
In future I plan to implement web tokens with BARE and PASETO to make web tokens implementation that for me will be near ideal solution. I will ping you back when I will have something done.
Popular in Announcing
Here is my first stab at this. README pasted below.
https://github.com/Hal9000/elixir_random
Comments and critiques are welcome.
Thank...
New
I created Kitto a framework for dashboards inspired by Dashing.
The distributed characteristics of Elixir and the low memory footprint...
New
Could not wait for the missing Elixir ML libraries to appear, so, I wrote one myself, taking https://github.com/sdwolfz/exlearn as a foun...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
What is ContEx?
A pure Elixir server-side data plotting/charting library outputting SVG.
It has nice barcharts in particular and works g...
New
Dear Elixir community,
After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
Hi! :waving_hand:
I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
New
Other popular topics
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









