simplify type names

master
Jordan Orelli 10 years ago
parent a1cdead607
commit f09229431d

@ -32,18 +32,18 @@ func readValue(b []byte) (value, error) {
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
type simpleString string type String string
func readString(b []byte) (value, error) { func readString(b []byte) (value, error) {
return simpleString(strings.Trim(string(b), "\r\n")), nil return String(strings.Trim(string(b), "\r\n")), nil
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
type redisError string type Error string
func readError(b []byte) (value, error) { func readError(b []byte) (value, error) {
return redisError(strings.Trim(string(b), "\r\n")), nil return Error(strings.Trim(string(b), "\r\n")), nil
} }
@ -53,3 +53,5 @@ func readError(b []byte) (value, error) {

@ -8,15 +8,15 @@ var valueTests = []struct {
in string in string
out value out value
}{ }{
{"+hello", simpleString("hello")}, {"+hello", String("hello")},
{"+one two", simpleString("one two")}, // intermediate space {"+one two", String("one two")}, // intermediate space
{"+one two ", simpleString("one two ")}, // trailing space {"+one two ", String("one two ")}, // trailing space
{"+ one two", simpleString(" one two")}, // leading space {"+ one two", String(" one two")}, // leading space
{"-hello", redisError("hello")}, {"-hello", Error("hello")},
{"-one two", redisError("one two")}, // intermediate space {"-one two", Error("one two")}, // intermediate space
{"-one two ", redisError("one two ")}, // trailing space {"-one two ", Error("one two ")}, // trailing space
{"- one two", redisError(" one two")}, // leading space {"- one two", Error(" one two")}, // leading space
} }
func TestValues(t *testing.T) { func TestValues(t *testing.T) {

Loading…
Cancel
Save