Liking cljdoc? Tell your friends :D

bf.crud.core


?->>clj/s≠macro

clj
(?->> pred? expr & forms)
cljs
(?->> &form &env pred? expr & forms)

Like clojure.core/some->> but short-circuit when the value do not satisfy the predicate pred?. (?->> nil? ...) is equivalent to clojure.core/some->>.

Like `clojure.core/some->>` but short-circuit when the value do not satisfy the
predicate `pred?`. (?->> nil? ...) is equivalent to `clojure.core/some->>`.
source (clj)source (cljs)raw docstring

attach-lifecycleclj/smacro

(attach-lifecycle entity-name {:keys [on-fetch on-save on-delete]})
source (clj)source (cljs)

defentityclj/smacro

(defentity entity-name {:keys [primary-key id-type store]})
source (clj)source (cljs)

Deletableclj/s≠protocol

delete!clj/s

(delete! this db)
source

fetch-by-idclj/s

(fetch-by-id this db)
source

Fetchableclj/s≠protocol

fetch!clj/s

(fetch! this db)
(fetch! this db where-clause)
(fetch! this db where-clause opts)
source

generate-idclj/smultimethod

source

Identifiedclj/s≠protocol

primary-keyclj/s

(primary-key this)

Return the primary key

Return the primary key

identityclj/s

(identity this)

Return the primary key's value

Return the primary key's value
source

Initializableclj/s≠protocol

initclj/s

(init this)

Act as constructor. Given a basis record (built with constructor functions or static constructor) will set the primary key to a newly generated id. If the entity has no specific instrution on how to generate an id, will leave it nil for the database to apply it's DEFAULT. If entitie's primary key is composite (tuple of ids) you need to either overload the default implementation and set them by yourself. If the record already have an id and you want to preserve it, then use bf.crud.core/save! instead.

Act as constructor. Given a basis record (built with
constructor functions or static constructor) will set the primary key to a
newly generated id. If the entity has no specific instrution on how to
generate an id, will leave it nil for the database to apply it's DEFAULT. If
entitie's primary key is composite (tuple of ids) you need to either overload
the default implementation and set them by yourself. If the record already
have an id and you want to preserve it, then use `bf.crud.core/save!`
instead.
source

joinclj/s

(join entities subentities slot join-key)
(join entities subentities slot join-key one-to-one-join?)

Take a list of entities that can be Identified, and a list of arbitrary subentities maps. Will zip the two collections and join each subentities with their respective parents by join-key and store the result at the slot key in each entity. If at least one entity match with multiple subentities (one-to-many), then the slot will be a list of subentities, a single value otherwise. E.g: (fold [(User {:id 1}) (User {:id 2})] [(Profile {:user-id 1}) (Profile {:user-id 2})] :profile :user-id)

Take a list of `entities` that can be Identified, and a list of arbitrary
`subentities` maps. Will zip the two collections and join each subentities
with their respective parents by `join-key` and store the result at the `slot`
key in each entity. If at least one entity match with multiple
subentities (one-to-many), then the `slot` will be a list of subentities, a
single value otherwise.
E.g: (fold [(User {:id 1}) (User {:id 2})]
           [(Profile {:user-id 1}) (Profile {:user-id 2})]
           :profile
           :user-id)
sourceraw docstring

Pullableclj/s≠protocol

pull!clj/s

(pull! this db ids pullq)
(pull! this db ids pullq opts)
source

Savableclj/s≠protocol

save!clj/s

(save! this db)
(save! this db opts)

Save an entity by its primary key.

Save an entity by its primary key.
source

seq->>clj/s≠macro

clj
(seq->> & body)
cljs
(seq->> &form &env & body)
source (clj)source (cljs)

Storableclj/s≠protocol

storeclj/s

(store this)

Typically return the table name where this entity should be stored.

Typically return the table name where this entity should be stored.
source

super-initclj/s

(super-init this)
(super-init this id-type)

Base behaviour of Initializable/init that will generate a primary key for an entity, you can call this function like you would call super(…) in OOP if you overload it.

Base behaviour of Initializable/init that will generate a primary key for an
entity, you can call this function like you would call super(…) in OOP if you
overload it.
sourceraw docstring

Updatableclj/s≠protocol

update!clj/s

(update! this db where-clause)
(update! this db where-clause opts)

Usefull to update multiple entities of the same kind by an arbitrary predicate. Use Savable/save! if your predicate is to update by primary key.

Usefull to update
multiple entities of the same kind by an arbitrary predicate. Use
Savable/save! if your predicate is to update by primary key.
source

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

× close