Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d0x7/go-interval-notation
Go library to parse interval notations, e.g. [v1.2,] or [v1,v3)
https://github.com/d0x7/go-interval-notation
interval interval-notation library notation versioning versioning-semantics
Last synced: 4 days ago
JSON representation
Go library to parse interval notations, e.g. [v1.2,] or [v1,v3)
- Host: GitHub
- URL: https://github.com/d0x7/go-interval-notation
- Owner: d0x7
- Created: 2023-07-18T01:40:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-13T09:31:39.000Z (about 1 month ago)
- Last Synced: 2024-12-13T10:35:43.407Z (about 1 month ago)
- Topics: interval, interval-notation, library, notation, versioning, versioning-semantics
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Interval Notation
This library is used to parse interval notations (e.g. `[v1.2,]` or `[v1,v3)`) for versions in Go. The following format of versions are supported:
- 1
- 1.2
- 1.2.3
- SemanticVersioning
- Addtionally every version prefixed with a 'v'.For actually parsing the version and comparing them, it's using [SemVer from @Masterminds](https://github.com/Masterminds/semver)
## Usage
First use `go get` to import the package:
```bash
go get xiam.li/interval-notation
```Afterwards you can use like this:
```go
package mainimport "xiam.li/interval-notation"
func main() {
interval_notation.InRange("[v1,v2]", "v1.5.3") // == true
interval_notation.InRange("[v1,v2]", "v2.5.3") // == false
}
```## License
[MIT](LICENSE) © 2023 Dorian Heinrichs