go-pathmatch/example_pattern_string_test.go

27 lines
394 B
Go
Raw Permalink Normal View History

2019-06-24 21:05:08 +00:00
package pathmatch_test
import (
"github.com/reiver/go-pathmatch"
2019-06-24 21:05:08 +00:00
"fmt"
"os"
)
2019-06-24 21:20:49 +00:00
func ExamplePattern_String() {
2019-06-24 21:05:08 +00:00
var template = "/v1/users/{user_id}"
var pattern pathmatch.Pattern
err := pathmatch.CompileTo(&pattern, template)
if nil != err {
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
return
}
fmt.Printf("pattern: %s", pattern)
// Output:
// pattern: /v1/users/{user_id}
}