duct-framework / docs Goto Github PK
View Code? Open in Web Editor NEWDocumentation for Duct
Documentation for Duct
In the tutorial at the users.clj where and after finishing the file with
(defmethod ig/init-key ::create [_ {:keys [db]}]
(fn [{[_ email password] :ataraxy/result}]
(let [id (create-user db email password)]
[::response/created (str "/users/" id)])))
I reset the repl and get the error-- Syntax error reading source at (users.clj:21:35). Invalid token: ::response/created. I am new to clojure and duct. Is there something I should know at this point in the tutorial that would fix this?
In the guide, after adding the new dependency on handler.sql and restarting the REPL, (go)
gives me
Syntax error (ClassNotFoundException) compiling new at (jsonista/core.clj:80:38).
com.fasterxml.jackson.core.exc.InputCoercionException
Should I change all the dependency versions like they're in the guide instead of using the generated ones?
I'm following the GUIDE.rst. I'm at the migrations section at the moment. Migrations seems to work flawlessly from REPL but I noticed that the command from Running Database Migrations in Production doesn't work.
I got error:
$ lein run :duct/migrator !10041
Exception in thread "main" Syntax error compiling at (/private/var/folders/5y/8ds1f60x1mx9xcqx61hw_6w00000gn/T/form-init4783091540319585709.clj:1:125).
Error on key :duct.database.sql/hikaricp when building system
at clojure.lang.Compiler.load(Compiler.java:7647)
at clojure.lang.Compiler.loadFile(Compiler.java:7573)
at clojure.main$load_script.invokeStatic(main.clj:452)
at clojure.main$init_opt.invokeStatic(main.clj:454)
at clojure.main$init_opt.invoke(main.clj:454)
at clojure.main$initialize.invokeStatic(main.clj:485)
at clojure.main$null_opt.invokeStatic(main.clj:519)
at clojure.main$null_opt.invoke(main.clj:516)
at clojure.main$main.invokeStatic(main.clj:598)
at clojure.main$main.doInvoke(main.clj:561)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: Error on key :duct.database.sql/hikaricp when building system {:reason :integrant.core/build-threw-exception, :system {
:duct.logger.timbre/println {:enabled? true, :async? false, :min-level nil, :rate-limit nil, :output-fn :inherit, :fn #object[taoensso.timbre.appenders.core$p
rintln_appender$fn__4380 0x2474331d "taoensso.timbre.appenders.core$println_appender$fn__4380@2474331d"]}, :duct.logger/timbre #duct.logger.timbre.TimbreLogge
r{:config {:level :info, :appenders {:duct.logger.timbre/println {:enabled? true, :async? false, :min-level nil, :rate-limit nil, :output-fn :inherit, :fn #ob
ject[taoensso.timbre.appenders.core$println_appender$fn__4380 0x2474331d "taoensso.timbre.appenders.core$println_appender$fn__4380@2474331d"]}}}}}, :function
#object[clojure.lang.MultiFn 0x46977829 "clojure.lang.MultiFn@46977829"], :key :duct.database.sql/hikaricp, :value {:jdbc-url nil, :logger #duct.logger.timbre
.TimbreLogger{:config {:level :info, :appenders {:duct.logger.timbre/println {:enabled? true, :async? false, :min-level nil, :rate-limit nil, :output-fn :inhe
rit, :fn #object[taoensso.timbre.appenders.core$println_appender$fn__4380 0x2474331d "taoensso.timbre.appenders.core$println_appender$fn__4380@2474331d"]}}}}}
}
at integrant.core$build_exception.invokeStatic(core.cljc:283)
at integrant.core$build_exception.invoke(core.cljc:282)
at integrant.core$try_build_action.invokeStatic(core.cljc:294)
at integrant.core$try_build_action.invoke(core.cljc:291)
at integrant.core$build_key.invokeStatic(core.cljc:300)
at integrant.core$build_key.invoke(core.cljc:296)
at clojure.core$partial$fn__5826.invoke(core.clj:2632)
at clojure.core.protocols$fn__8144.invokeStatic(protocols.clj:168)
at clojure.core.protocols$fn__8144.invoke(protocols.clj:124)
at clojure.core.protocols$fn__8099$G__8094__8108.invoke(protocols.clj:19)
at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31)
at clojure.core.protocols$fn__8131.invokeStatic(protocols.clj:75)
at clojure.core.protocols$fn__8131.invoke(protocols.clj:75)
at clojure.core.protocols$fn__8073$G__8068__8086.invoke(protocols.clj:13)
at clojure.core$reduce.invokeStatic(core.clj:6828)
at clojure.core$reduce.invoke(core.clj:6810)
at integrant.core$build.invokeStatic(core.cljc:321)
at integrant.core$build.invoke(core.cljc:303)
at integrant.core$init.invokeStatic(core.cljc:418)
at integrant.core$init.invoke(core.cljc:410)
at duct.core$exec_config.invokeStatic(core.clj:225)
at duct.core$exec_config.invoke(core.clj:213)
at todo.main$_main.invokeStatic(main.clj:12)
at todo.main$_main.doInvoke(main.clj:7)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:384)
at user$eval151.invokeStatic(form-init4783091540319585709.clj:1)
at user$eval151.invoke(form-init4783091540319585709.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:7176)
at clojure.lang.Compiler.eval(Compiler.java:7166)
at clojure.lang.Compiler.load(Compiler.java:7635)
... 12 more
Caused by: java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required.
at com.zaxxer.hikari.HikariConfig.validate(HikariConfig.java:955)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:77)
at hikari_cp.core$make_datasource.invokeStatic(core.clj:251)
at hikari_cp.core$make_datasource.invoke(core.clj:248)
at duct.database.sql.hikaricp$eval5348$fn__5350.invoke(hikaricp.clj:45)
at clojure.lang.MultiFn.invoke(MultiFn.java:234)
at integrant.core$try_build_action.invokeStatic(core.cljc:292)
... 40 more
I understand the problem, though, I'm not sure how should I specify data source or jdbc url from the command line.
I noticed that in the error log the :duct.database.sql/hikaricp
keyword is missing. Once I added:
:duct.database.sql/hikaricp {:jdbc-url nil,
:logger #ig/ref :duct/logger,
:connection-uri "jdbc:sqlite:db/dev.sqlite"}
to the config.edn
the command lein run :duct/migrator
works fine.
If this is the right solution for this issue, I can add a minor comment that the command requires definition of :duct.database.sql/hikaricp
. If not, am I missing something?
Hi there,
This came up at work, and the more I think about it, the more I think it sounds 'cute' (to say the least), so basically I'm trying to explore how feasible it is. Currently components are declared using a somewhat nested syntax - for example:
:some.ns/foo {:param1 true :param2 "whatever"}
Imagine we could instead write something flatter:
:some.ns.foo/param1 true
:some.ns.foo/param2 "whatever"
The mechanics of transforming the latter into the former (before integrant
sees it) is not that complicated - in fact, I can already do this via a custom duct-module, but (and correct me if i'm wrong), module transformations only apply to the base profile, so I'm not sure how to rewrite any other profile.
So basically, my question is, would you say that a custom module is enough to achieve what I want, or would something like this need be supported in duct itself (e.g. via a :duct.profile.syntax/flavour
)?
Many thanks in advance...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.