项目作者: mtwilliams

项目描述 :
:beginner: Declarative abstract serializers for Elixir.
高级语言: Elixir
项目地址: git://github.com/mtwilliams/blazon.git
创建时间: 2016-04-27T23:14:02Z
项目社区:https://github.com/mtwilliams/blazon

开源协议:Other

下载


Blazon

Continuous Integration
Code Coverage
Documentation
Package

Blazon allows you to quickly build abstract serializers in a declarative fashion. It also has a large focus on composition, allowing you to quickly build and reuse common functionality for things like pagination, automatic preloading, and so on in a few lines of code. Furthermore, Blazon is format agnostic so you can expose your complex object heirarchies in JSON, XML, UBF, CSV, or whatever you want without changing your presentation logic.

Although Blazon has great test coverage, its design is nowhere near final and is rapidly changing, making it unsuitable for production.

Example

  1. defmodule Person.Serializer do
  2. use Blazon.Serializable
  3. field :name
  4. field :title
  5. field :age
  6. end
  7. Blazon.json(Person.Serializer, %{name: "John Cleese", title: "Minister of Silly Walks", age: 42}, except: ~w(age)a)

Installation

  1. Add blazon to your list of dependencies in mix.exs:

    1. def deps do
    2. [{:blazon, "~> 0.0.1"}]
    3. end
  2. Drink your :tea:

  3. That’s it!

Usage

First Steps

Options

Embedding

Linking

Composition