Liking cljdoc? Tell your friends :D

com.fulcrologic.rad.attributes


attribute-mapclj/s

(attribute-map attributes)

Returns a map of qualified key -> attribute for the given attributes

Returns a map of qualified key -> attribute for the given attributes
sourceraw docstring

attribute?clj/s

(attribute? v)
source

attributes->eqlclj/s

(attributes->eql attrs)

Returns an EQL query for all of the attributes that are available for the given database-id

Returns an EQL query for all of the attributes that are available for the given database-id
sourceraw docstring

defattrclj/smacro

(defattr sym & args)

Define a new attribute into a sym.

WARNING: IF YOU ARE DOING FULL-STACK, THEN THESE MUST BE DEFINED IN CLJC FILES FOR RAD TO WORK! RAD actually supports the idea of having rendering plugins that work just in the JVM, in which case all of your code can be CLJ. It can also support client-side database adapters, which would mean that all of your code would be CLJS.

  • sym: The name of the new var to create.
  • qualified-keyword: The unique (keyword) name of this attribute.
  • data-type: A supported data type (e.g. :int, :uuid, :ref, :instant).
  • options-map: An open map (any data can be placed in here) of key-value pairs.

An attribute defines a logical bit of data in your graph model that may be stored in a database, derived by complex logic, or simply generated out of thin air. Attributes are the central place in RAD where information about your desired data model is supplied.

The most common options to put in options-map are:

  • ::attr/identities - if persisted in storage, but NOT a table/row/entity key.
  • ::attr/identity? - if a PK or natural key
  • ::attr/schema - if persisted in storage
  • ::attr/target - if type :ref

See the attributes-options namespace for more details.

Attributes types are extensible (though there are many built in), and the concept of traversal to to-one and to-many edges in either direction is very easily represented in a natural, database-independent, fashion (though database adapters may require you to supply more information in order for them to actually do concrete work for you).

A attribute is required to have a qualified key that uniquely designates its name in the model, and a data type. The options map is a completely open map of key-value pairs that can further describe the details of an attribute. Some of those are standard options (found in the attributes-options namespace), and many more are defined by reports, forms, database adapters, and rendering plugins. Look for *-options namespaces in order to find vars with docstrings that describe the possible options.

Define a new attribute into a sym.

WARNING: IF YOU ARE DOING FULL-STACK, THEN THESE MUST BE DEFINED IN CLJC FILES FOR RAD TO WORK! RAD actually supports
the idea of having rendering plugins that work just in the JVM, in which case all of your code can be CLJ. It can
also support client-side database adapters, which would mean that all of your code would be CLJS.

* `sym`: The name of the new var to create.
* `qualified-keyword`: The unique (keyword) name of this attribute.
* `data-type`: A supported data type (e.g. :int, :uuid, :ref, :instant).
* `options-map`: An open map (any data can be placed in here) of key-value pairs.

An attribute defines a logical bit of data in your graph model that may be stored in a database, derived by complex
logic, or simply generated out of thin air.  Attributes are the central place in RAD where information *about* your
desired data model is supplied.

The most common options to put in `options-map` are:

* `::attr/identities` - if persisted in storage, but NOT a table/row/entity key.
* `::attr/identity?` - if a PK or natural key
* `::attr/schema` - if persisted in storage
* `::attr/target` - if type `:ref`

See the `attributes-options` namespace for more details.

Attributes types are extensible (though there are many built in), and the concept of traversal to to-one and to-many
edges in either direction is very easily represented in a natural, database-independent, fashion (though database
adapters may require you to supply more information in order for them to actually do concrete work for you).

A attribute is required to have a *qualified key* that uniquely designates its name in the model, and a data
type. The options map is a completely open map of key-value pairs that can further describe the details of
an attribute. Some of those are standard options (found in the attributes-options namespace), and many more
are defined by reports, forms, database adapters, and rendering plugins. Look for `*-options` namespaces in
order to find vars with docstrings that describe the possible options.
sourceraw docstring

encryptclj

(encrypt password salt iterations)

Returns a cryptographycally-secure hashed password based on the given a plain-text password, a random salt string (see gen-salt), and a number of iterations. You should save the hashed result, salt, and iterations in your database. Checking a password is then taking the password the user supplied, passing it through this function with the original salt and iterations, and seeing if the hashed result is the same as the original.

Returns a cryptographycally-secure hashed password based on the given a plain-text password,
a random salt string (see `gen-salt`), and a number of iterations.  You should save the hashed result, salt, and
iterations in your database. Checking a password is then taking the password the user supplied, passing it through
this function with the original salt and iterations, and seeing if the hashed result is the same as the original.
sourceraw docstring

eql-queryclj/s

(eql-query attr-query)

Convert a query that uses attributes (records) as keys into the proper EQL query. I.e. (eql-query [account/id]) => [::account/id] Honors metadata and join nesting.

Convert a query that uses attributes (records) as keys into the proper EQL query. I.e. (eql-query [account/id]) => [::account/id]
Honors metadata and join nesting.
sourceraw docstring

gen-saltclj

(gen-salt)
source

make-attribute-validatorclj/s

(make-attribute-validator attributes)

Creates a Fulcro form-state validator function that can be used as a form validator for any form that contains the given attributes.

A field is considered valid in this validator IF AND ONLY IF attr/valid-value returns true. See that function's docstring for how that interacts with the ao/valid? option of attributes.

Creates a Fulcro form-state validator function that can be used as a form validator for any form that contains
the given `attributes`.

A field is considered valid in this validator IF AND ONLY IF `attr/valid-value` returns true. See that
function's docstring for how that interacts with the `ao/valid?` option of attributes.
sourceraw docstring

new-attributeclj/s

(new-attribute kw type m)

Create a new attribute, which is represented as an Attribute record.

Type can be one of :string, :int, :uuid, etc. (more types are added over time, so see main documentation and your database adapter for more information).

The remaining argument is an open map of additional things that any subsystem can use to describe facets of this attribute that are important to your system.

If :ref is used as the type then the ultimate ID of the target entity should be listed in m under the ::target key.

Create a new attribute, which is represented as an Attribute record.

Type can be one of :string, :int, :uuid, etc. (more types are added over time,
so see main documentation and your database adapter for more information).

The remaining argument is an open map of additional things that any subsystem can
use to describe facets of this attribute that are important to your system.

If `:ref` is used as the type then the ultimate ID of the target entity should be listed in `m`
under the ::target key.
sourceraw docstring

pathom-pluginclj/s

(pathom-plugin all-attributes)
source

to-intclj/s

(to-int str)
source

to-many?clj/s

(to-many? attr)

Returns true if the attribute with the given key is a to-many.

Returns true if the attribute with the given key is a to-many.
sourceraw docstring

to-one?clj/s

(to-one? attr)

Returns true if the attribute with the given key is a to-one.

Returns true if the attribute with the given key is a to-one.
sourceraw docstring

valid-value?clj/s

(valid-value? {:com.fulcrologic.rad.attributes/keys [required? valid?]
               :as attribute}
              value
              props
              k)

Checks if the value looks to be a valid value based on the ::attr/required? and ::attr/valid? options of the given attribute.

Returns true if:

  • The value is completely missing (nil), and not marked ao/required?
  • The attribute defines a ao/valid? predicate that returns true.
  • The attribute has NO ao/valid? option but is marked ao/required? but the value is non-nil (and if a string, non-blank).

Otherwise returns false.

Checks if the value looks to be a valid value based on the ::attr/required? and ::attr/valid? options of the
given attribute.

Returns true if:

* The value is completely missing (nil), and not marked `ao/required?`
* The attribute defines a `ao/valid?` predicate that returns true.
* The attribute has NO `ao/valid?` option but is marked `ao/required?`
  but the value is non-nil (and if a string, non-blank).

Otherwise returns false.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close