Skip to content

yosida95/uritemplate

Repository files navigation

uritemplate.go

uritemplate.go is a Go implementation of URI Template [RFC6570] with full functionality of URI Template Level 4.

Example

package main

import (
    "fmt"
    "github.com/yosida95/uritemplate.go"
)

var (
    tmpl = uritemplate.MustNew("https://example.com/dictionary/{term:1}/{term}")
)

func main() {
    vars := uritemplate.Values{}
    vars.Set("term", uritemplate.String("cat"))
    ret, err := tmpl.Expand(vars)
    if err != nil{
        fmt.Println(err)
        return
    }
    fmt.Println(ret)

    // Output:
    // https://example.com/dictionary/c/cat
}

Getting Started

Installation

$ go get -u github.com/yosida95/uritemplate.go

Documentation

The documentation is available on GoDoc.

License

uritemplate.go is distributed under the BSD 3-Clause license. PLEASE read ./LICENSE carefully and follow its clauses to use this software.

Author

yosida95