Skip to content

Commit

Permalink
Merge pull request #2 from companyinfo/update-readme.md
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
atkrad authored Aug 12, 2023
2 parents e5a3319 + 4fa23a5 commit 34f0796
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
77 changes: 75 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,75 @@
# gourn
A Go URN parsing library compliant with RFC 2141
# GoURN

[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/companyinfo/gourn/ci.yaml?branch=main)](https://github.com/companyinfo/gourn/actions/workflows/ci.yaml) [![Go Report Card](https://goreportcard.com/badge/github.com/companyinfo/gourn)](https://goreportcard.com/report/github.com/companyinfo/gourn) [![Go Reference](https://pkg.go.dev/badge/github.com/companyinfo/gourn.svg)](https://pkg.go.dev/github.com/companyinfo/gourn)

**GoURN** is a Go package that provides a comprehensive URN (Uniform Resource Name) parsing library. It follows the specifications outlined in [RFC 2141](https://datatracker.ietf.org/doc/html/rfc2141).

## Features

- Parse valid URNs according to [RFC 2141](https://datatracker.ietf.org/doc/html/rfc2141).
- Normalize the parsed URN to ensure consistency.
- Convert parsed URNs to valid string representation.
- Serialize and deserialize URNs to/from JSON format.

## Installation

To use **GoURN** in your Go project, install Go and run `go get`:

```shell
$ go get -u github.com/companyinfo/gourn
```

## Usage
Here's a quick example of how to use **GoURN** to parse and work with URNs:

```go
package main

import (
"fmt"
"github.com/companyinfo/gourn"
"log"
)

func main() {
urnString := "urn:example:resource"
urn, err := gourn.Parse(urnString)
if err != nil {
log.Print("Unable to parse the URN: ", err)

return
}

fmt.Println("NID:", urn.NID)
fmt.Println("NSS:", urn.NSS)
fmt.Println("URN String:", urn)
}
```

This will print:
```shell
NID: example
NSS: resource
URN String: urn:example:resource
```
For more detailed usage examples, please refer to the code and tests in this repository.

## Contribution

Contributions to **GoURN** are welcome! If you find a bug, want to add a feature, or have suggestions for improvements, feel free to open issues or submit pull requests.

## License

Copyright 2023 Company.info

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
14 changes: 14 additions & 0 deletions urn.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 Company.info
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package gourn

import (
Expand Down
14 changes: 14 additions & 0 deletions urn_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 Company.info
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package gourn

import (
Expand Down

0 comments on commit 34f0796

Please sign in to comment.