paddle v0.1.4 Paddle.Class.Helper View Source
A helper module to help generate paddle classes.
There is currently two ways of generating paddle classes:
The simplest way is to find
*.schema files which contain definitions of
LDAP object classes. You can find them in the
directory if you have OpenLDAP installed. If not, you can find most of them
Then, add the path of these files in the Paddle configuration using the
:schema_files key (see the
module toplevel documentation). Finally just call the
gen_class_from_schema/3 macro from anywhere outside of a module.
require Paddle.Class.Helper Paddle.Class.Helper.gen_class_from_schema MyApp.Room, ["room"], "ou=Rooms"
For a description of the parameters and more configuration options, see the
gen_class_from_schema/3 macro documentation.
If you’re feeling more adventurous you can still use this helper you can also
specify by hand each part of the class using the
Paddle.Class.Helper.gen_class/2 macro (if that still doesn’t satisfy you,
you can always look at the
Example (which is equivalent to the example above):
require Paddle.Class.Helper Paddle.Class.Helper.gen_class MyApp.Room, fields: [:commonName, :roomNumber, :description, :seeAlso, :telephoneNumber], unique_identifier: :commonName, object_classes: ["room"], required_attributes: [:commonName], location: "ou=Rooms"
The available options are all function names defined and documented
Paddle.Class protocol, plus the
:fields option which
defines all the available fields for the given class.
Please note that using the
:generators option here is discouraged
as generators should be inside the module and not elsewhere. Unless
you are sure what you are doing is elegant enough, you should define the
module yourself instead of using this macro with the
Paddle.Class and the source of this macro for guidelines).
Link to this section Summary
Generate a Paddle class
Generate a Paddle class from schema files
Link to this section Functions
Generate a Paddle class.
Generate a Paddle class represented as a struct with the name
and the options
options (see the module toplevel
Generate a Paddle class from schema files.
Generate a Paddle class from one of the schema files passed as configuration
with the name
class_name, with the given
object_classes (can be a binary
or a list of binary), at the given location, optionally force specify
which field to use as a unique identifier (see
Paddle.Class.unique_identifier/1), and some optional generators (see