Fork me on GitHub
#clojure
<
2023-07-01
>
mx200015:07:56

Is there an editor for .edn files out there ?

mx200015:07:35

Something like a CRUD editor

p-himik15:07:47

Can you give an example of such an editor, for any kind of data?

mx200015:07:37

I found something interesting just now https://youtu.be/RgF0hy6tEQs It's for datomic/datahike but is basically what I was looking for

mx200015:07:53

Lets see if it's what I'm looking for ...

mmer10:07:46

I found vscode with calva worked well.

mesota15:07:51

I am using XTDB with GraphQL in a luminus app. In XTDB and clojure, it seems hyphens are conventionally used for multi-word identifiers. However, GraphQL doesn’t accept hyphens as field names. Conversion is of course possible but I thought it would impact performance when dealing with large datasets. So, as I see it, either I have to ditch XTDB/Clojure conventions and use unnamespaced identifiers with underscores (Instead of hyphens) or do the conversion. What do you guys typically do in such scenarios? Thanks.

igrishaev15:07:45

Ditching hyphens in favour of underscores is fine. Personally I find it quite confusing when the keys are kebab-case-transformed back and forth. Just use underscores and don't worry about it.

thanks3 2
phill15:07:47

Next to parsing and fulfilling GraphQL, name conversion is pretty cheap!

thanks3 2
👍 2
igrishaev15:07:00

the difference between - and is insignificant yet ones how transform the keys waste CPU for nothing and bring confusion. Say, you fetch a JSON from remote API expecting username but a "smart" HTTP client has transformed it to user-name silently

👍 2
Zed16:07:01

Mixing snake and kebab case can bring confusion to the programmer. Here's my N=1 on a project where the number of developers is also 1. My project has snake case on both input and output: java.jdbc when it talks to the database and a GraphQL schema when it communicates over HTTP. So I made the decision to leave its intermediate data manipulations in snake case. But I find that I frequently make mistakes where I type something in kebab when I should use snake, and have to track down the misnamed value. I think this happens just because in Clojure most things are kebab and my fingers type hyphens on autopilot because my brain is already thinking about the next line of code. So I've been getting increasingly tempted to use case conversion at input and output just to stop a whole class of bugs from happening. Just typing this paragraph has made me realise that doing so would have a pretty quick payback on investment when measured in programmer-hours

thanks3 2
didibus18:07:33

I find if you convert to a keyword, doing kebab case conversion is nice. If you don't want to convert, keeping it as a string key makes it clear it's a "foreign" key.

thanks3 2
andersmurphy16:07:49

So I’m trying to use sqlite application defined functions: https://github.com/xerial/sqlite-jdbc/blob/master/src/main/java/org/sqlite/Function.java#L208 This involves extending org.sqlite.Function and overriding the xFunc method. This is trivial in something like groovy:

new Function() {
    protected void xFunc() {
        result("myFunc called!");
    }
But i’m really struggling in Clojure. I’ve been down a :gen-class rabbit hole and I can’t for the life of me call the protected result method:
(ns foo
  (:gen-class
   :extends org.sqlite.Function
   :exposes-methods {result superResult}))

(defn -xFunc [this]
  (.superResult this "myFunc called!"))
I keep getting no method result on class foo taking one arg found. What am I missing?

hiredman16:07:58

What is the exception you are getting?

andersmurphy20:07:03

So I’ve managed to do a bare bones project where I’ve got it working. So not quite sure what the issue was in my other project. :thinking_face: I’ll try and get it working in the main project now.

mike_ananev21:07:36

I'm trying to use add-lib in 1.12.0-alpha4. What I'm doing wrong?

(ns user
  (:require
    [hashp.core]
    [clojure.repl.deps :refer [add-lib add-libs]]))
(add-lib 'org.rssys/context {:mvn/version "0.1.4"})

Execution error (ExceptionInfo) at clojure.tools.deps.interop/invoke-tool (interop.clj:49).
null

*e
=>
#error{:cause nil,
       :data {},
       :via [{:type clojure.lang.ExceptionInfo,
              :message nil,
              :data {},
              :at [clojure.tools.deps.interop$invoke_tool invokeStatic "interop.clj" 49]}],
       :trace [[clojure.tools.deps.interop$invoke_tool invokeStatic "interop.clj" 49]
               [clojure.tools.deps.interop$invoke_tool invoke "interop.clj" 15]
               [clojure.repl.deps$add_libs invokeStatic "deps.clj" 48]
               [clojure.repl.deps$add_lib invokeStatic "deps.clj" 57]
               [clojure.repl.deps$add_lib invoke "deps.clj" 57]
               [user$eval20397 invokeStatic "user.clj" 9]
               [user$eval20397 invoke "user.clj" 9]

phronmophobic21:07:27

Do you have the latest clojure cli installed?

mike_ananev21:07:11

Yes! I've upgraded clojure cli and now it works!

🎉 2
seancorfield21:07:11

This is because alpha 4 passes the basis via stdin and that ability was only added in 1.11.1347 (in case you're curious).

👍 4