Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
c3f1f2e9
Commit
c3f1f2e9
authored
Mar 11, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: RawResult
parent
b7e78d8f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
RawResult.cs
StackExchange.Redis/StackExchange/Redis/RawResult.cs
+11
-9
No files found.
StackExchange.Redis/StackExchange/Redis/RawResult.cs
View file @
c3f1f2e9
...
@@ -3,15 +3,13 @@
...
@@ -3,15 +3,13 @@
namespace
StackExchange.Redis
namespace
StackExchange.Redis
{
{
internal
struct
RawResult
internal
struct
RawResult
{
{
public
static
readonly
RawResult
EmptyArray
=
new
RawResult
(
new
RawResult
[
0
]);
public
static
readonly
RawResult
EmptyArray
=
new
RawResult
(
new
RawResult
[
0
]);
public
static
readonly
RawResult
Nil
=
new
RawResult
();
public
static
readonly
RawResult
Nil
=
new
RawResult
();
private
static
readonly
byte
[]
emptyBlob
=
new
byte
[
0
];
private
static
readonly
byte
[]
emptyBlob
=
new
byte
[
0
];
private
readonly
int
offset
,
count
;
private
readonly
int
offset
,
count
;
private
Array
arr
;
private
readonly
Array
arr
;
public
RawResult
(
ResultType
resultType
,
byte
[]
buffer
,
int
offset
,
int
count
)
public
RawResult
(
ResultType
resultType
,
byte
[]
buffer
,
int
offset
,
int
count
)
{
{
switch
(
resultType
)
switch
(
resultType
)
...
@@ -67,6 +65,7 @@ public override string ToString()
...
@@ -67,6 +65,7 @@ public override string ToString()
return
"(unknown)"
;
return
"(unknown)"
;
}
}
}
}
internal
RedisChannel
AsRedisChannel
(
byte
[]
channelPrefix
,
RedisChannel
.
PatternMode
mode
)
internal
RedisChannel
AsRedisChannel
(
byte
[]
channelPrefix
,
RedisChannel
.
PatternMode
mode
)
{
{
switch
(
Type
)
switch
(
Type
)
...
@@ -102,6 +101,7 @@ internal RedisKey AsRedisKey()
...
@@ -102,6 +101,7 @@ internal RedisKey AsRedisKey()
throw
new
InvalidCastException
(
"Cannot convert to RedisKey: "
+
Type
);
throw
new
InvalidCastException
(
"Cannot convert to RedisKey: "
+
Type
);
}
}
}
}
internal
RedisValue
AsRedisValue
()
internal
RedisValue
AsRedisValue
()
{
{
switch
(
Type
)
switch
(
Type
)
...
@@ -157,6 +157,7 @@ internal bool AssertStarts(byte[] expected)
...
@@ -157,6 +157,7 @@ internal bool AssertStarts(byte[] expected)
}
}
return
true
;
return
true
;
}
}
internal
byte
[]
GetBlob
()
internal
byte
[]
GetBlob
()
{
{
var
src
=
(
byte
[])
arr
;
var
src
=
(
byte
[])
arr
;
...
@@ -230,7 +231,8 @@ internal RedisValue[] GetItemsAsValues()
...
@@ -230,7 +231,8 @@ internal RedisValue[] GetItemsAsValues()
return
arr
;
return
arr
;
}
}
}
}
static
readonly
string
[]
NilStrings
=
new
string
[
0
];
private
static
readonly
string
[]
NilStrings
=
new
string
[
0
];
internal
string
[]
GetItemsAsStrings
()
internal
string
[]
GetItemsAsStrings
()
{
{
RawResult
[]
items
=
GetItems
();
RawResult
[]
items
=
GetItems
();
...
@@ -252,6 +254,7 @@ internal string[] GetItemsAsStrings()
...
@@ -252,6 +254,7 @@ internal string[] GetItemsAsStrings()
return
arr
;
return
arr
;
}
}
}
}
internal
GeoPosition
?
GetItemsAsGeoPosition
()
internal
GeoPosition
?
GetItemsAsGeoPosition
()
{
{
RawResult
[]
items
=
GetItems
();
RawResult
[]
items
=
GetItems
();
...
@@ -267,6 +270,7 @@ internal string[] GetItemsAsStrings()
...
@@ -267,6 +270,7 @@ internal string[] GetItemsAsStrings()
}
}
return
new
GeoPosition
((
double
)
coords
[
1
].
AsRedisValue
(),
(
double
)
coords
[
0
].
AsRedisValue
());
return
new
GeoPosition
((
double
)
coords
[
1
].
AsRedisValue
(),
(
double
)
coords
[
0
].
AsRedisValue
());
}
}
internal
GeoPosition
?[]
GetItemsAsGeoPositionArray
()
internal
GeoPosition
?[]
GetItemsAsGeoPositionArray
()
{
{
RawResult
[]
items
=
GetItems
();
RawResult
[]
items
=
GetItems
();
...
@@ -302,7 +306,6 @@ internal RawResult[] GetItemsAsRawResults()
...
@@ -302,7 +306,6 @@ internal RawResult[] GetItemsAsRawResults()
return
GetItems
();
return
GetItems
();
}
}
// returns an array of RawResults
// returns an array of RawResults
internal
RawResult
[]
GetArrayOfRawResults
()
internal
RawResult
[]
GetArrayOfRawResults
()
{
{
...
@@ -341,8 +344,7 @@ internal bool TryGetDouble(out double val)
...
@@ -341,8 +344,7 @@ internal bool TryGetDouble(out double val)
val
=
0
;
val
=
0
;
return
false
;
return
false
;
}
}
long
i64
;
if
(
TryGetInt64
(
out
long
i64
))
if
(
TryGetInt64
(
out
i64
))
{
{
val
=
i64
;
val
=
i64
;
return
true
;
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment