27 lines
393 B
Go
27 lines
393 B
Go
package pathmatch_test
|
|
|
|
import (
|
|
"github.com/reiver/go-pathmatch"
|
|
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func ExamplePatternString() {
|
|
|
|
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}
|
|
}
|