Module /codec/json #
Fast bidirectional JSON serialization (encode, decode, from-json) and derivable To-JSON / From-JSON traits.
(use /codec/json)
From-JSON #
Trait in /codec/json
Trait allowing structs and types to be hydrated from decoded JSON data via (derive My-Struct From-JSON) or custom (impl From-JSON My-Struct ...).
To-JSON #
Trait in /codec/json
Trait allowing types and structs to override default field-by-field JSON serialization.
decode #
(json/decode json-string) -> Any
Parses a JSON text string or Slab byte buffer into native Tangu Maps, Lists, Numbers, Strings, Booleans, or (). When a Target-Type is provided as the second argument, hydrates the decoded data into the specified Struct or compound type via From-JSON. Returns an Error if malformed.
(use /codec/json)
(let data (json/decode "{\"id\": 1, \"name\": \"Alice\"}"))
(assert-eq! (data :name) "Alice")
(use /codec/json)
(def User (Struct #Int id #String name))
(derive User From-JSON)
(let u (json/decode "{\"id\": 1, \"name\": \"Alice\"}" User))
encode #
(json/encode expr) -> String
Serializes a Tangu Map, List, Number, String, Boolean, or Struct instance into a JSON formatted string. Optional struct fields set to () serialize as null.
(use /codec/json)
(let json-str (json/encode {:name "Bob" :scores [95 99]}))
from-json #
(json/from-json Target-Type data) -> Target-Type
Hydrates a decoded JSON Map or value into an instance of Target-Type, recursively converting nested struct fields, arrays, and optional fields.
(use {From-JSON from-json} /codec/json)
(def Product (Struct #Int id #String title))
(derive Product From-JSON)
(let p (from-json Product {:id 42 :title "Book"}))
Module /codec/json-codec #
Bidirectional JSON codec interface for structured serialization.
(use /codec/json-codec)
From-JSON #
Trait in /codec/json-codec
Trait allowing structs and types to be hydrated from decoded JSON data via (derive My-Struct From-JSON) or custom (impl From-JSON My-Struct ...).
To-JSON #
Trait in /codec/json-codec
Trait allowing types and structs to override default field-by-field JSON serialization.
decode #
(json/decode json-string) -> Any
Parses a JSON text string or Slab byte buffer into native Tangu Maps, Lists, Numbers, Strings, Booleans, or (). When a Target-Type is provided as the second argument, hydrates the decoded data into the specified Struct or compound type via From-JSON. Returns an Error if malformed.
(use /codec/json)
(let data (json/decode "{\"id\": 1, \"name\": \"Alice\"}"))
(assert-eq! (data :name) "Alice")
(use /codec/json)
(def User (Struct #Int id #String name))
(derive User From-JSON)
(let u (json/decode "{\"id\": 1, \"name\": \"Alice\"}" User))
encode #
(json/encode expr) -> String
Serializes a Tangu Map, List, Number, String, Boolean, or Struct instance into a JSON formatted string. Optional struct fields set to () serialize as null.
(use /codec/json)
(let json-str (json/encode {:name "Bob" :scores [95 99]}))
from-json #
(json/from-json Target-Type data) -> Target-Type
Hydrates a decoded JSON Map or value into an instance of Target-Type, recursively converting nested struct fields, arrays, and optional fields.
(use {From-JSON from-json} /codec/json)
(def Product (Struct #Int id #String title))
(derive Product From-JSON)
(let p (from-json Product {:id 42 :title "Book"}))
Module /codec/uri #
Percent-encoding and URL query-string serialization (encode-uri-component, decode-uri-component, to-urlencoded-string).
(use /codec/uri)
decode-uri-component #
(decode-uri-component str) -> String
Decodes a percent-encoded URI component string.
encode-uri-component #
(encode-uri-component str) -> String
Percent-encodes special characters in a URI component string.
to-urlencoded-string #
(to-urlencoded-string map) -> String
Serializes a Map of key-value pairs into an application/x-www-form-urlencoded query string.
Module /csv #
RFC 4180 CSV reader and writer supporting tuple rows and header-mapped records.
(use /csv)
read-records #
(read-records ...)
Exported function in /csv.
read-tuples #
(read-tuples ...)
Exported function in /csv.
write-tuples #
(write-tuples ...)
Exported function in /csv.
Module /base64 #
RFC 4648 Base64 encoding and decoding for strings and byte slabs.
(use /base64)
decode-base64 #
(decode-base64 encoded) -> Slab
Decodes a Base64 string into a byte Slab.
encode-base64 #
(encode-base64 bytes) -> String
Encodes a String or byte Slab into a standard Base64 string.
Module /validation #
Declarative Struct field constraint validation (#{:min-len ... :format :email ...}) returning structured ValidationErrors.
(use /validation)
Validation #
Struct in /validation
Struct type in /validation.
| Field | Type | Default |
|---|---|---|
ok |
Bool |
— |
errors |
Map |
— |
ValidationErrors #
Struct in /validation
Struct type in /validation.
| Field | Type | Default |
|---|---|---|
errors |
Map |
— |
get-cached-descriptor #
(target)
Exported function in /validation.
is-valid? #
(target)
Returns true if the value conforms to the expected format or schema.
validate #
(args)
Exported function in /validation.
Module /glue/date-util #
Business-day and calendar utilities for workdays, weekends, and nth-weekday calculations.
(use /glue/date-util)
compute-nth-weekday #
(year month weekday n)
Exported function in /glue/date-util.
ensure-work-day-max #
(date)
Exported function in /glue/date-util.
ensure-work-day-min #
(date)
Exported function in /glue/date-util.
is-weekend-day? #
(date)
Exported function in /glue/date-util.
is-work-day? #
(date)
Exported function in /glue/date-util.
Module /glue/fs-util #
High-level directory copying, path sanitization, and parent directory creation helpers.
(use /glue/fs-util)
copy-directory #
(source-path target-path)
Recursively Copies a directory. The function is resilient:
- ensures the target-path directory exists.
copy-file #
(source-path target-path)
Exported function in /glue/fs-util.
ensure-dirname #
(path)
Exported function in /glue/fs-util.
sanitize-path #
(path)
Exported function in /glue/fs-util.