IG
Size: a a a
IG
SB
ND
(reduce-kv (fn [acc idx {bal :balance}] (into acc [idx bal]) [] coll)
KC
ND
SB
KC
(let [coll {0 {:BALANCE 73}
1 {:BALANCE 0}
2 {:BALANCE 3}
3 {:BALANCE 4}
4 {:BALANCE 3}
5 {:BALANCE 1}
6 {:BALANCE 2}
7 {:BALANCE 4}
8 {:BALANCE 2}
9 {:BALANCE 8}}]
(into {} (map (fn [[k {b :BALANCE}]] [k b])) coll))
SB
SB
ИФ
SB
ИФ
ИФ
SB
(when (= node (first (db/primaries test)))
- (cl/with-conn-failure-retry conn
- (info (str "Creating table " table-name))
- (j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
- "(id INT NOT NULL PRIMARY KEY,
- balance INT NOT NULL)")])
- (doseq [a (:accounts test)]
- (info "Populating account")
- (sql/insert! conn table-name {:id a
- :balance (if (= a (first (:accounts test)))
- (:total-amount test)
- 0)}))))
+ (info (str "Creating table " table-name))
+ (j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
+ "(id INT NOT NULL PRIMARY KEY,
+ balance INT NOT NULL)")])
+ (doseq [a (:accounts test)]
+ (info "Populating account")
+ (sql/insert! conn table-name {:id a
+ :balance (if (= a (first (:accounts test)))
+ (:total-amount test)
+ 0)}))))
(assoc this :conn conn :node node))))
T
(when (= node (first (db/primaries test)))
- (cl/with-conn-failure-retry conn
- (info (str "Creating table " table-name))
- (j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
- "(id INT NOT NULL PRIMARY KEY,
- balance INT NOT NULL)")])
- (doseq [a (:accounts test)]
- (info "Populating account")
- (sql/insert! conn table-name {:id a
- :balance (if (= a (first (:accounts test)))
- (:total-amount test)
- 0)}))))
+ (info (str "Creating table " table-name))
+ (j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
+ "(id INT NOT NULL PRIMARY KEY,
+ balance INT NOT NULL)")])
+ (doseq [a (:accounts test)]
+ (info "Populating account")
+ (sql/insert! conn table-name {:id a
+ :balance (if (= a (first (:accounts test)))
+ (:total-amount test)
+ 0)}))))
(assoc this :conn conn :node node))))
T
using
тожеfor
/while
/if
всё это если уберешь в других языках будет такой же диффSB
MB
N
CD