Godeps/_workspace/src/gopkg.in/bluesuncorp/validator.v5/baked_in.go
func hasLengthOf(top interface{}, current interface{}, field interface{}, param string) bool {

	st := reflect.ValueOf(field)

	switch st.Kind() {

	case reflect.String:
		p := asInt(param)

		return int64(utf8.RuneCountInString(st.String())) == p

	case reflect.Slice, reflect.Map, reflect.Array:
		p := asInt(param)

		return int64(st.Len()) == p

	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		p := asInt(param)

		return st.Int() == p

	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
		p := asUint(param)

		return st.Uint() == p

	case reflect.Float32, reflect.Float64:
		p := asFloat(param)

		return st.Float() == p
	}

	panic(fmt.Sprintf("Bad field type %T", field))
}
func hasLengthOf(top interface{}, current interface{}, field interface{}, param string) bool {

	st := reflect.ValueOf(field)

	switch st.Kind() {

	case reflect.String:
		p := asInt(param)

		return int64(utf8.RuneCountInString(st.String())) == p

	case reflect.Slice, reflect.Map, reflect.Array:
		p := asInt(param)

		return int64(st.Len()) == p

	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		p := asInt(param)

		return st.Int() == p

	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
		p := asUint(param)

		return st.Uint() == p

	case reflect.Float32, reflect.Float64:
		p := asFloat(param)

		return st.Float() == p
	}

	panic(fmt.Sprintf("Bad field type %T", field))
}
func hasLengthOf ( top interface { } , current interface { } , field interface { } , param string ) bool { st := reflect . ValueOf ( field ) switch st . Kind ( ) { case reflect . String : p := asInt ( param ) return int64 ( utf8 . RuneCountInString ( st . String ( ) ) ) == p case reflect . Slice , reflect . Map , reflect . Array : p := asInt ( param ) return int64 ( st . Len ( ) ) == p case reflect . Int , reflect . Int8 , reflect . Int16 , reflect . Int32 , reflect . Int64 : p := asInt ( param ) return st . Int ( ) == p case reflect . Uint , reflect . Uint8 , reflect . Uint16 , reflect . Uint32 , reflect . Uint64 , reflect . Uintptr : p := asUint ( param ) return st . Uint ( ) == p case reflect . Float32 , reflect . Float64 : p := asFloat ( param ) return st . Float ( ) == p } panic ( fmt . Sprintf ( " " , field ) ) }
// length tests whether a variable's length is equal to a given
// value. For strings it tests the number of characters whereas
// for maps and slices it tests the number of items.
length tests whether a variable s length is equal to a given value . For strings it tests the number of characters whereas for maps and slices it tests the number of items .