Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit ebd742e

Browse files
committed
Adding flushdb
1 parent 48415cd commit ebd742e

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type Client struct {
2121
Channels *Channels
2222
Scripting *Scripting
2323
Geofence *Geofence
24+
Server *Server
2425
}
2526

2627
type clientParams struct {
@@ -91,6 +92,7 @@ func NewWithExecutor(exec Executor, debug bool) (*Client, error) {
9192
client.Search = &Search{client}
9293
client.Scripting = &Scripting{client}
9394
client.Channels = &Channels{client}
95+
client.Server = &Server{client}
9496

9597
return client, nil
9698
}

server.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package t38c
2+
3+
type Server struct {
4+
client tile38Client
5+
}
6+
7+
// WARNING: This erases all data in Tile38 DB!
8+
func (sv *Server) FlushDB() error {
9+
var resp struct{}
10+
11+
err := sv.client.jExecute(&resp, "FLUSHDB")
12+
13+
// Explicit is better than implicit.
14+
if err != nil {
15+
return err
16+
}
17+
18+
return nil
19+
}

0 commit comments

Comments
 (0)