Skip to content

Instantly share code, notes, and snippets.

@yrashk
Created August 16, 2009 04:09
Show Gist options
  • Save yrashk/168550 to your computer and use it in GitHub Desktop.
Save yrashk/168550 to your computer and use it in GitHub Desktop.
> Product = #product{name = "My product"}.
> Product:create(DB).
-module(product, [Guid, Name]).
-extends(record).
-include("product.hrl").
coerce(_) ->
THIS#product{Name= "[[[" ++ Name +++ "]]]"}.
-record(product, {guid, name}).
-module(record, []).
-export([create/1]).
create(DB) ->
DB:create(THIS:coerce(table)).
coerce(_) ->
THIS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment