Liking cljdoc? Tell your friends :D

swhid.core

Parse, validate, build and render SWHIDs (Software Hash Identifiers, ISO 18670).

A SWHID is represented as a plain map: {:type :content :hash "<40 hex>" :qualifiers {...}} ; :qualifiers present only when non-empty pr prints it as the tagged literal #swh/id "swh:1:...", which reads it back (see data_readers.clj).

This namespace covers manipulation of SWHIDs (parse / validate / render / compare). Hash computation from local artifacts lives in swhid.hash.

Both the JVM and Babashka are supported, with no dependency.

Parse, validate, build and render SWHIDs (Software Hash Identifiers, ISO 18670).

A SWHID is represented as a plain map:
  {:type :content :hash "<40 hex>"
   :qualifiers {...}}   ; :qualifiers present only when non-empty
`pr` prints it as the tagged literal #swh/id "swh:1:...", which reads
it back (see data_readers.clj).

This namespace covers *manipulation* of SWHIDs (parse / validate / render /
compare). Hash computation from local artifacts lives in swhid.hash.

Both the JVM and Babashka are supported, with no dependency.
raw docstring

content?clj

(content? swhid)
source

core-swhidclj

(core-swhid swhid)

Return the SWHID with its qualifiers removed (the bare core identifier).

Return the SWHID with its qualifiers removed (the bare core identifier).
sourceraw docstring

directory?clj

(directory? swhid)
source

edn-readersclj

source

makeclj

(make type hash)
(make type hash qualifiers)

Build a SWHID map from an object type keyword, a 40-hex object id, and an optional qualifiers map. Validates its arguments, and throws on qualifiers that cannot be valid on this type (lines on a directory, …).

Build a SWHID map from an object type keyword, a 40-hex object id, and an
optional qualifiers map. Validates its arguments, and throws on
qualifiers that cannot be valid on this type (lines on a directory, …).
sourceraw docstring

object-idclj

(object-id swhid)
source

object-typeclj

(object-type swhid)
source

parseclj

(parse s)

Parse a SWHID string into a SWHID map. Throws ex-info if invalid. Qualifiers that the spec says to ignore (lines on a directory, visit without origin, …) are left out.

Parse a SWHID string into a SWHID map. Throws ex-info if invalid.
Qualifiers that the spec says to ignore (lines on a directory, visit
without origin, …) are left out.
sourceraw docstring

release?clj

(release? swhid)
source

revision?clj

(revision? swhid)
source

snapshot?clj

(snapshot? swhid)
source

swhid->stringclj

(swhid->string {:keys [type hash qualifiers]})

Render a SWHID map to its canonical string form, leaving out the qualifiers the spec says to ignore (visit without origin, …). Trusts :hash and :qualifiers: build hand-made maps with make, which validates them.

Render a SWHID map to its canonical string form, leaving out the
qualifiers the spec says to ignore (visit without origin, …). Trusts
:hash and :qualifiers: build hand-made maps with `make`, which
validates them.
sourceraw docstring

valid?clj

(valid? s)

Return true if s is a syntactically valid SWHID string.

Return true if `s` is a syntactically valid SWHID string.
sourceraw docstring

with-anchorclj

(with-anchor swhid anchor)

anchor is a SWHID map or core SWHID string.

`anchor` is a SWHID map or core SWHID string.
sourceraw docstring

with-bytesclj

(with-bytes swhid from)
(with-bytes swhid from to)
source

with-linesclj

(with-lines swhid from)
(with-lines swhid from to)
source

with-originclj

(with-origin swhid url)
source

with-pathclj

(with-path swhid path)
source

with-qualifierclj

(with-qualifier swhid k v)

Return swhid with qualifier k set to v. Validates the result.

Return `swhid` with qualifier `k` set to `v`. Validates the result.
sourceraw docstring

with-visitclj

(with-visit swhid snp)

snp is a snapshot SWHID map or core SWHID string.

`snp` is a snapshot SWHID map or core SWHID string.
sourceraw docstring

without-qualifierclj

(without-qualifier swhid k)

Return swhid with qualifier k removed.

Return `swhid` with qualifier `k` removed.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close