Packages

A feature toggle library using redis. It allows to roll out to users based on a percentage of users or alternatively to a set of users or user ids

Current section

Files

Jump to
molasses lib models feature.ex
Raw

lib/models/feature.ex

if Code.ensure_loaded?(Ecto) do
defmodule Molasses.Models.Feature do
@moduledoc """
Defines the ecto model that makes up a feature.
"""
import Ecto
import Ecto.Changeset
use Ecto.Schema
schema "features" do
field :name, :string
field :percentage, :integer
field :users, :string
field :active, :boolean
end
def changeset(struct, params \\ %{}) do
struct
|> cast(params, [:name, :percentage, :users, :active])
end
end
end