• Stars
    star
    16
  • Rank 1,266,546 (Top 26 %)
  • Language
    Elixir
  • Created almost 9 years ago
  • Updated over 3 years ago

Reviews

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

Repository Details

An Elixir library that provides a simple DSL for seeding databases through Ecto.

Exseed

An Elixir library that provides a simple DSL for seeding databases through Ecto.

Inspired largely by seed-fu.

Installation

In your project's mix.exs add the following:

    defp deps do
      {:exseed, "~> 0.0.3"}
    end

and then run mix deps.get.

Setup

In config/config.exs add:

    config :exseed, :repo, YourApplication.Repo

Usage

Exseed provides a seed macro which expects an Ecto model and a block. Inside the block the fields on your model will be available as functions which will set the value for the field for that record.

By default Exseed will look in your project's priv/repo/seeds/ directory for seed files to load. Let's say you have a model named Post, you could put the following in priv/repo/seeds/posts.exs:

    import Exseed

    seed YourApplication.Post do
      id 1

      title "First Post!"

      body "Hello, world!"
    end

    seed YourApplication.Post do
      id 2

      title "Second Post"

      {{year, month, day}, {hour, minute, second}} = :calendar.universal_time()

      body "This entry was seeded at #{year}-#{month}-#{day} #{hour}:#{minute}:#{second}."
    end

More Repositories

1

rosetta-euler

Solutions to Project Euler problems in many different languages.
Elixir
39
star
2

rstat

A simple gem for statistics.
Ruby
6
star
3

media_streamer_go

Simple media streamer written in Go.
Go
5
star
4

rate_limiter

Gem that limits the rate at which ActiveRecord model instances can be created.
Ruby
4
star
5

media_streamer

Simple Sinatra based media streamer.
Ruby
3
star
6

language

A toy Lisp-like language.
Ruby
2
star
7

playlist.js

jQuery media playlist plugin.
JavaScript
2
star
8

kentouzu

Ruby gem for ActiveRecord drafts.
Ruby
2
star
9

corgiblog

Conney the Corgi's Blog
Ruby
2
star
10

generic_array

Generic Arrays in C
C
2
star
11

MediaStreamerClient

An iOS client for https://github.com/seaneshbaugh/media_streamer
Swift
2
star
12

sphereserver_scripts

Scripts for SphereServer 0.55i.
2
star
13

gatherer

Scrapes the Gatherer and turns it into SQL.
Ruby
1
star
14

card_tracker

Magic: The Gathering card tracker.
CSS
1
star
15

new-ceda-realty

Experimental CEDA Realty website made with Elixir/Phoenix.
Elixir
1
star
16

ruthieonart

Ruth Eshbaugh's website.
Ruby
1
star
17

SDL03

Untitled Game
C
1
star
18

dynamotest

Just testing out dynamo.
Elixir
1
star
19

image_viewer

An image viewer written in Rust using GTK.
Rust
1
star
20

daysee

Daysee site.
Ruby
1
star
21

daytime_server

A simple Daytime Protocol server written in Elixir.
Elixir
1
star
22

ceda-realty

CEDA Realty Website
Ruby
1
star
23

lazylame-cs

FLAC to LAME converter. In C#.
C#
1
star
24

middleman-react-example

A very simple React Todo app served up by Middleman.
CSS
1
star
25

portfolio

My personal website.
Ruby
1
star
26

resume

My resume.
1
star
27

durarara

durarara
Ruby
1
star
28

dandgcreditservice

D & G Credit Service Website
Ruby
1
star
29

pluggable-server

Simple pluggable TCP server written in C.
C
1
star
30

dnd_character_generator

DnD Character Generator
CoffeeScript
1
star