Hi people,
sorry to bother you again :)
If I have understood correctly, in Elixir every entity defines both
the structure of the table, and the structure of an instance of a row
of the same table.
If you look at my example below, it will be easier to understand: the
class 'Movie' defines both the structure of the 'Movie' table, and the
structure of an instance of a 'Movie' row (the one I get when I do
Movie() ).
I wonder whether I can use the @classmethod and @instancemethod
decorators to define that a certain method should be visible only from
the table definition, or only from an instance of a row: for example,
if you look at the code below, I would like 'dir(Movie)' to return not
the 'prettyprint' method, which is an instance only method, and
vice-versa.
class Movie(Entity):
title = Field(Text)
@classmethod
def get_all_movies_by_year(cls, year):
pass
@instancemethod
def prettyprint(self):
pass
>>> m = Movie()
>>> dir(m)
[prettyprint, ...]
>>> dir(Movie)
[get_all_movies_by_year, ...]
Sorry for my bad technical and english language.. I hope you
understand what I mean.
:)
--
My blog on bioinformatics (now in English): http://bioinfoblog.it
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---