• Stars
    star
    8
  • Rank 2,029,105 (Top 42 %)
  • Language
    Elixir
  • Created almost 9 years ago
  • Updated 14 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Postgrex.Extension and Ecto.Type for PostgreSQL isn module

ISN

Build Status

ISN adds a Postgrex.Extension and Ecto.Type definitions for the datatypes defined in the isn PostgreSQL module.

Usage

Ecto migrations

defmodule MyApp.Repo.Migrations.CreateBook do
  use Ecto.Migration

  def change do
    create table(:books) do
      add :isbn, :isbn13
      # other fields
    end
  end
end

Ecto Models

defmodule MyApp.Book do
  use MyApp.Web, :model

  schema "books" do
    field :isbn, ISN.ISBN13, read_after_writes: true
    # other fields
  end
end

Installation

Add the package to your Mixfile

defp deps do
  [{:isn, "~> 3.0"}]
end

Add the isn extension to your database

mix do isn.gen.migration, ecto.migrate

Add a lib/postgrex_types.ex file with the following content:

Postgrex.Types.define(MyApp.PostgrexTypes, [ISN], [])

Add the following lines in config.exs:

config :my_app, MyApp.Repo,
  types: MyApp.PostgrexTypes

Defined types

ISN adds the following ecto and corresponding postgrex types:

Ecto.Type Postgrex type
ISN.ISBN :isbn
ISN.ISBN13 :isbn13
ISN.ISMN :ismn
ISN.ISMN13 :ismn13
ISN.ISSN :issn
ISN.ISSN13 :issn13
ISN.EAN13 :ean13
ISN.UPC :upc

More Repositories

1

eh

Lookup Elixir documentation from the command line
Elixir
19
star
2

git-mob

An implementation of `git-mob` in Rust
Rust
7
star
3

hink

simple IRC-bot for grabbing URLs in an IRC channel.
Ruby
5
star
4

voteapp

Voting Application used for scene compos at DreamHack. This app has been hacked on by people who had been awake more than a bit too long, had too much coffeine to drink and a deadline to meet, and the code is therefore somewhat... ugly.
Ruby
5
star
5

assignment_template

A LaTeX assignment template
Java
4
star
6

resin

Make your plug pipeline act more enterprisey...
Elixir
4
star
7

vim-eh-docs

Look up Elixir documentation from vim, using eh
Vim Script
3
star
8

ldap_lookup

A small tool used to lookup data information from an LDAP server
Ruby
3
star
9

PSS05-Templates

PSS 05 Templates for use in a Software Engineering course at KTH (DD1365)
2
star
10

swedish-holidays

Ruby code for calculating swedish holidays (both public holidays and de facto holidays).
Ruby
2
star
11

basic-riot

Rails 3/Devise/Formtastic/Haml setup with CAS authentication and LDAP user import.
Ruby
2
star
12

oauth-consumer-engine

Rails engine for drop-in oauth client
Ruby
2
star
13

coffeeclash

A meteor.js leaderboard application
JavaScript
1
star
14

se.ceri.holidays

A WebOS app to keep track of swedish holidays
JavaScript
1
star
15

se.ceri.esq

eve skill queue for webos (enyo)
JavaScript
1
star
16

envelopes

Generate a PDF to print addresses onto C5 envelopes
Ruby
1
star
17

crud

Simple PHP framework for doing stuff when ruby is not available
PHP
1
star
18

sinatra-warden-cas

Simple sinatra app with CAS authentication.
JavaScript
1
star
19

candy_test

code example for an answer to a SO question.
Ruby
1
star
20

BuboBubo

Listings without ferret
Ruby
1
star
21

aoc2020

Rust
1
star