-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #310 from halalala222/cli-support-zet
Cli supports zset data structures (#249)
- Loading branch information
Showing
18 changed files
with
1,240 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,5 +44,6 @@ func init() { | |
\/__/ \/__/ \/__/ \/__/ | ||
`}, "\r\n")) | ||
}) | ||
App.OnClosing(close) | ||
register(App) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package client | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ByteStorage/FlyDB/db/grpc/client" | ||
) | ||
|
||
var ( | ||
Addr string | ||
cliClient *client.Client | ||
) | ||
|
||
func newClient() *client.Client { | ||
var err error | ||
if cliClient != nil { | ||
return cliClient | ||
} | ||
|
||
if cliClient, err = client.NewClient(Addr); err != nil { | ||
fmt.Println("new client error: ", err) | ||
} | ||
|
||
return cliClient | ||
} | ||
|
||
func close() error { | ||
if cliClient == nil { | ||
return nil | ||
} | ||
|
||
if err := cliClient.Close(); err != nil { | ||
return err | ||
} | ||
|
||
cliClient = nil | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package client | ||
|
||
import "math" | ||
|
||
const ( | ||
CommonKeyArg = "key" | ||
CommonMemberArg = "member" | ||
CommonMembersArg = "members" | ||
CommonValueArg = "value" | ||
|
||
CommonDefaultEmptyString = "" | ||
|
||
ZSetScoreArg = "score" | ||
ZSetStartArg = "start" | ||
ZSetEndArg = "end" | ||
ZSetIncrByArg = "incrBy" | ||
ZSetMinArg = "min" | ||
ZSetMaxArg = "max" | ||
|
||
ZSetDefaultScore = 0 | ||
ZSetDefaultRangeStart = 0 | ||
ZSetDefaultRangeEnd = math.MaxInt | ||
ZSetDefaultIncrBy = 0 | ||
ZSetDefaultMin = 0 | ||
ZSetDefaultMax = math.MaxInt | ||
|
||
ZSetDefaultKeyHelp = "the key of the zset" | ||
ZSetDefaultMemberHelp = "the member of the zset" | ||
ZSetDefaultMembersHelp = "the members of the zset, separated by space, e.g. member1 member2 member3" | ||
ZSetDefaultValueHelp = "the value of the zset" | ||
ZSetDefaultScoreHelp = "the score of the zset" | ||
ZSetDefaultStartHelp = "the start index of the zset" | ||
ZSetDefaultEndHelp = "the end index of the zset" | ||
ZSetDefaultIncrByHelp = "the increment value of the zset" | ||
ZSetDefaultMinHelp = "the min score of the zset" | ||
ZSetDefaultMaxHelp = "the max score of the zset" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package client | |
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/desertbit/grumble" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package client | |
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/desertbit/grumble" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.