+(defmethod explode-has-many ((view t) join-slot)
+ "returns the class of the join as the primary value, the second and third value is the home key and the foreign key"
+ (let ((att (assoc join-slot (list-join-attributes view))))
+ (values (getf (cdr att) :join-class)
+ (getf (cdr att) :home-key)
+ (getf (cdr att) :foreign-key))))
+
+(defgeneric expr-= (instance slot-name value)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-> (instance slot-name value)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-< (instance slot-name value)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-ends-with (instance slot-name value)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-starts-with (instance slot-name value)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-contains (instance slot-name value)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-and (instance &rest args)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-or (instance &rest args)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-not (instance &rest args)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric select-instances (instance &rest args)
+ (:documentation "Select instances in backend dependent way"))
+
+(defgeneric prepare-slot-name-for-select (instance slot-name)
+ (:method (i s) s))
+
+(defmacro def-compare-expr (instance-type name expr &key value-format)
+ `(defmethod ,name ((instance ,instance-type) slot-name value)
+ (declare (ignore instance))
+ (,expr (prepare-slot-name-for-select instance slot-name) ,(typecase value-format
+ (null 'value)
+ (string `(format nil ,value-format value))
+ (t `(,value-format value))))))