Skip to content

Instantly share code, notes, and snippets.

@SunRunAway
Created November 19, 2012 07:29
Show Gist options
  • Save SunRunAway/4109429 to your computer and use it in GitHub Desktop.
Save SunRunAway/4109429 to your computer and use it in GitHub Desktop.
rsMatchPrefix_test.go
package main
import (
"qbox.us/log"
rsapi "qbox.us/api/v2/rs"
"qbox.us/api/conf"
"qbox.us/digest_auth"
"encoding/json"
"fmt"
)
const (
access = "I8dA7P3FEkZNHUYWP9U3J-NEMuAiQ__yywrXsY49"
secret = "tfSgnY_zSm1dgtFa7wDXpiWvzKGLpopha0NX2Zfo"
)
func init() {
conf.RS_HOST = "http://localhost:9400"
}
func main() {
t := digest_auth.NewTransport(access, secret, nil)
rs := rsapi.New(t)
min := 1
max := 1
skip := 0
limit := 0
expires := 0
items, code, err := rs.MatchPrefix("flytest:d/", min, max, skip, limit, expires)
log.Println(items)
log.Println(code)
log.Println(err)
if code == 200 && err == nil {
b, _ := json.MarshalIndent(items, "", " ")
fmt.Println()
fmt.Println(string(b))
} else {
log.Fatal()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment