Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling the 'call' function results in an exception #5

Open
felixflores opened this issue Jan 21, 2015 · 1 comment
Open

Calling the 'call' function results in an exception #5

felixflores opened this issue Jan 21, 2015 · 1 comment

Comments

@felixflores
Copy link

(ns my.stuff
  (:require [stch.sql.format :as sql]
            [clojure.java.jdbc :refer [execute!]]
            [stch.sql.types :refer [call]]
            [stch.sql.ddl :refer [create timestamp integer primary-key serial table default]]))

(def db {:classname "org.postgresql.Driver"
         :subprotocol "postgresql"
         :user "stuff"
         :password ""
         :subname "//localhost:5432/mydb"})

(defn db-execute!
  [statement]
  (execute! db statement))

(db-execute! [(-> (table :schema_versions)
                  (serial :id :not-null)
                  (primary-key :id)
                  (integer :version)
                  (timestamp :created_at (default (call :now)))
                  (create))])


;=> CompilerException java.lang.IllegalArgumentException: No implementation of method: :to-sql of protocol: #'stch.sql.ddl/ToSQL found for class: stch.sql.types.SqlCall, compiling:(config/migrate_config.clj:1:31) 
@dubiousdavid
Copy link
Contributor

I'm happy to accept a PR for this. You will need to add extend the ToSQL protocol (https://github.com/stch-library/sql/blob/master/src/stch/sql/ddl.clj#L29) for the SqlCall type (https://github.com/stch-library/sql/blob/master/src/stch/sql/types.clj#L4).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants