did alternatives and similar packages
Based on the "Specific Formats" category.
Alternatively, view did alternatives based on common mentions on social networks and blogs.
-
bluemonday
bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS -
html-to-markdown
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules. -
omniparser
omniparser: a native Golang ETL streaming parser and transform library for CSV, JSON, XML, EDI, text, etc. -
mxj
Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages. -
go-pkg-rss
DISCONTINUED. This package reads RSS and Atom feeds and provides a caching mechanism that adheres to the feed specs. -
goq
A declarative struct-tag-based HTML unmarshaling or scraping package for Go built on top of the goquery library -
github_flavored_markdown
GitHub Flavored Markdown renderer with fenced code block highlighting, clickable header anchor links. -
go-pkg-xmlx
DISCONTINUED. Extension to the standard Go XML package. Maintains a node tree that allows forward/backwards browsing and exposes some simple single/multi-node search functions. -
pagser
Pagser is a simple, extensible, configurable parse and deserialize html page to struct based on goquery and struct tags for golang crawler -
csvplus
csvplus extends the standard Go encoding/csv package with fluent interface, lazy stream operations, indices and joins.
CodeRabbit: AI Code Reviews for Developers
Do you think we are missing an alternative of did or a related project?
Popular Comparisons
README
did
did
is a Go package that provides tools to work with
Decentralized Identifiers (DIDs).
Install
go get github.com/ockam-network/did
Example
package main
import (
"fmt"
"log"
"github.com/ockam-network/did"
)
func main() {
d, err := did.Parse("did:example:q7ckgxeq1lxmra0r")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v", d)
}
The above example parses the input string according to the rules defined in the [DID Grammar](did.abnf) and prints the following value of DID type.
&did.DID{
Method:"example",
ID:"q7ckgxeq1lxmra0r",
IDStrings:[]string{"q7ckgxeq1lxmra0r"},
Path:"",
PathSegments:[]string(nil),
Query:"",
Fragment:""
}
The input string may also be a DID Reference with a DID Path:
d, err := did.Parse("did:example:q7ckgxeq1lxmra0r/abc/pqr")
which would result in:
&did.DID{
Method:"example",
ID:"q7ckgxeq1lxmra0r",
IDStrings:[]string{"q7ckgxeq1lxmra0r"},
Path:"abc/pqr",
PathSegments:[]string{"abc", "pqr"},
Query:"",
Fragment:""
}
or a DID Reference with a DID Path and a DID Query:
d, err := did.Parse("did:example:q7ckgxeq1lxmra0r/abc/pqr?xyz")
fmt.Println(d.Query)
// Output: xyz
or a DID Reference with a DID Fragment:
d, err := did.Parse("did:example:q7ckgxeq1lxmra0r#keys-1")
fmt.Println(d.Fragment)
// Output: keys-1
This package also implements the Stringer interface for the DID type. It is easy to convert DID type structures into valid DID strings:
d := &did.DID{Method: "example", ID: "q7ckgxeq1lxmra0r"}
fmt.Println(d.String())
// Output: did:example:q7ckgxeq1lxmra0r
or with a refence with a fragment:
d := &did.DID{Method: "example", ID: "q7ckgxeq1lxmra0r", Fragment: "keys-1"}
fmt.Println(d.String())
// Output: did:example:q7ckgxeq1lxmra0r#keys-1
For more documentation and examples, please see godoc.
Build
To compile the code in this repository, run:
go build
Test
This repository includes a comprehensive [suite of tests](did_test.go) that check for various edge cases within the [DID Grammar](did.abnf).
To run the tests, run:
go test -v -cover
Benchmark
We haven't spent any time tuning the performance of the parser, however this repository includes some
[benchmarks](benchmark_test.go) that compare the speed of did.Parse
against Go's url.Parse
with inputs
of similar length, this is intended as a sanity check to ensure that did.Parse
is at least comparable in performance
to url.Parse
go test -bench=.
did.Parse
included in this package:
BenchmarkParse-8 5000000 365 ns/op
BenchmarkParseWithPath-8 3000000 500 ns/op
BenchmarkParseWithQuery-8 3000000 558 ns/op
BenchmarkParseWithFragment-8 3000000 552 ns/op
Go's url.Parse
:
BenchmarkUrlParse-8 3000000 475 ns/op
BenchmarkUrlParseWithPath-8 3000000 505 ns/op
BenchmarkUrlParseWithQuery-8 5000000 294 ns/op
BenchmarkUrlParseWithFragment-8 5000000 369 ns/op
Contributing
This package is early in its development and we welcome all contributions from the DID community. Please open issues and send pull requests.
We follow the conventions specified in Conventional Commits for our commit messages.
License
This package is licensed under [Apache License 2.0](LICENSE).
*Note that all licence references and agreements mentioned in the did README section above
are relevant to that project's source code only.