(create-flat-schema m)
(create-flat-schema m defaults)
creates a flat schema from an input map (create-flat-schema {:account {:email [{:type :ref :ref {:ns :email}}]}}) => {:email/accounts [{:ident :email/accounts :type :ref :cardinality :many :ref {:ns :account :type :reverse :key :account/_email :val :accounts :rval :email :rkey :account/email :rident :account/email}}] :account/email [{:ident :account/email :type :ref :cardinality :one :ref {:ns :email :type :forward :key :account/email :val :email :rval :accounts :rkey :account/_email :rident :email/accounts}}]}
creates a flat schema from an input map (create-flat-schema {:account {:email [{:type :ref :ref {:ns :email}}]}}) => {:email/accounts [{:ident :email/accounts :type :ref :cardinality :many :ref {:ns :account :type :reverse :key :account/_email :val :accounts :rval :email :rkey :account/email :rident :account/email}}] :account/email [{:ident :account/email :type :ref :cardinality :one :ref {:ns :email :type :forward :key :account/email :val :email :rval :accounts :rkey :account/_email :rident :email/accounts}}]}
(create-lookup fschm)
lookup from flat schema mainly for reverse refs (create-lookup {:account/name [{}] :account/email [{}] :email/accounts [{:ident :email/accounts :type :ref :ref {:type :reverse :key :account/_email}}]}) => {:email/accounts :email/accounts :account/_email :email/accounts :account/email :account/email :account/name :account/name}
lookup from flat schema mainly for reverse refs (create-lookup {:account/name [{}] :account/email [{}] :email/accounts [{:ident :email/accounts :type :ref :ref {:type :reverse :key :account/_email}}]}) => {:email/accounts :email/accounts :account/_email :email/accounts :account/email :account/email :account/name :account/name}
(schema x)
(schema x defaults)
creates an extended schema for use by spirit
(-> (schema [:account [:name {} :email {:type :ref :ref {:ns :email}}]]) :flat simplify) => {:email {:accounts :&account<*>} :account {:email :&email :name :string}}
creates an extended schema for use by spirit (-> (schema [:account [:name {} :email {:type :ref :ref {:ns :email}}]]) :flat simplify) => {:email {:accounts :&account<*>} :account {:email :&email :name :string}}
(schema-map m)
(schema-map m defaults)
creates a schema from a map
(-> (schema-map {:account/name [{}] :account/email [{:ident :account/email :type :ref :ref {:ns :email}}]}) :flat simplify)
creates a schema from a map (-> (schema-map {:account/name [{}] :account/email [{:ident :account/email :type :ref :ref {:ns :email}}]}) :flat simplify)
(schema? obj)
checks if object is a schema
(schema? (schema {:user/email [{}]})) => true
checks if object is a schema (schema? (schema {:user/email [{}]})) => true
(simplify flat)
helper function for easier display of spirit schema (simplify {:account/name [{:type :long}] :account/email [{:type :string :cardinality :many}] :email/accounts [{:type :ref :cardinality :many :ref {:ns :account}}]}) => {:email {:accounts :&account<>} :account {:email :string<> :name :long}}
helper function for easier display of spirit schema (simplify {:account/name [{:type :long}] :account/email [{:type :string :cardinality :many}] :email/accounts [{:type :ref :cardinality :many :ref {:ns :account}}]}) => {:email {:accounts :&account<*>} :account {:email :string<*> :name :long}}
(vec->map v)
turns a vec schema to a map
(vec->map [:account [:id {:type :long} :name {:type :text}]]) => {:account {:id [{:type :long, :order 0}], :name [{:type :text, :order 1}]}}
turns a vec schema to a map (vec->map [:account [:id {:type :long} :name {:type :text}]]) => {:account {:id [{:type :long, :order 0}], :name [{:type :text, :order 1}]}}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close