6c5319d
Branches > main > 6c5319d > files
Update names to reflect 'schema' no longer being a thing
Commit: 6c5319d77faba79afcb7a7eaf5532c59b39cb64f
Parent: 32821d4
2 changed files:
src/net/bowmap/server/protocol/readers.clj view file
@@ -45,18 +45,18 @@ (fn [buf] (m (reader buf)))) -(defn table< [schema]+(defn table< [table] (fn [buf] (reduce (fn [acc [field reader]] (assoc-some acc field (reader buf)))- {} (partition 2 schema))))+ {} (partition 2 table)))) (defn to-reader- "Attempts to coerces 'reader' into a reader. Throws if it cannot.+ "Attempts to coerces 'x' into a reader. Throws if it cannot. Vectors with pairs of [:key reader] are turned into tables readers. Nil is coerced to the empty table reader."- [reader]+ [x] (cond- (or (vector? reader) (nil? reader)) (table< reader)- (fn? reader) reader- :else (throw (IllegalArgumentException. (str "Cannot coerce into reader: " (pr-str reader))))))+ (or (vector? x) (nil? x)) (table< x)+ (fn? x) x+ :else (throw (IllegalArgumentException. (str "Cannot coerce into reader: " (pr-str x))))))src/net/bowmap/server/protocol/writers.clj view file
@@ -52,18 +52,18 @@ (and max-player-count online-player-count) (assoc :players {:max max-player-count :online online-player-count})))) -(defn table> [schema]+(defn table> [table] (fn [buf m] (reduce (fn [acc [field writer]] (writer acc (get m field)))- buf (partition 2 schema))))+ buf (partition 2 table)))) (defn to-writer- "Attempts to coerces 'writer' into a writer. Throws if it cannot.+ "Attempts to coerces 'x' into a writer. Throws if it cannot. Vectors with pairs of [:key writer] are turned into tables writers. Nil is not a valid writer."- [writer]+ [x] (cond- (vector? writer) (table> writer)- (fn? writer) writer- :else (throw (IllegalArgumentException. (str "Cannot coerce into writer: " (pr-str writer))))))+ (vector? x) (table> x)+ (fn? x) x+ :else (throw (IllegalArgumentException. (str "Cannot coerce into writer: " (pr-str x))))))