Namespace the records
This makes it useful for users of the bindings. The naming is the same as the module to allow elixir to treat the records in much the same way as its native module/record hybrid.
This commit is contained in:
@@ -3,22 +3,22 @@
|
||||
|
||||
-include("geef_records.hrl").
|
||||
|
||||
-spec tree_id(object()) -> oid().
|
||||
tree_id(#object{type=commit,handle=Handle}) ->
|
||||
-spec tree_id(geef_object()) -> geef_oid().
|
||||
tree_id(#geef_object{type=commit,handle=Handle}) ->
|
||||
Oid = geef_nif:commit_tree_id(Handle),
|
||||
#oid{oid=Oid}.
|
||||
#geef_oid{oid=Oid}.
|
||||
|
||||
tree(#object{type=commit,handle=Handle}) ->
|
||||
tree(#geef_object{type=commit,handle=Handle}) ->
|
||||
case geef_nif:commit_tree(Handle) of
|
||||
{ok, Type, Handle} ->
|
||||
{ok, #object{type=Type, handle=Handle}};
|
||||
{ok, #geef_object{type=Type, handle=Handle}};
|
||||
Other ->
|
||||
Other
|
||||
end.
|
||||
|
||||
-spec lookup(repo(), oid() | iolist()) -> object().
|
||||
-spec lookup(pid(), geef_oid() | iolist()) -> geef_object().
|
||||
lookup(Repo, Id) ->
|
||||
geef_object:lookup(Repo, Id, commit).
|
||||
|
||||
id(Obj = #object{type=commit}) ->
|
||||
id(Obj = #geef_object{type=commit}) ->
|
||||
geef_object:id(Obj).
|
||||
|
||||
Reference in New Issue
Block a user