@@ -21,37 +21,28 @@ func (c *Client) Close() error {
21
21
return c .conn .Close ()
22
22
}
23
23
24
- func (c * Client ) CreateChrono (chrono string ) error {
25
- if response , err := c .conn .Execute ("cc " + "heheh" ); err != nil || response != "OK" {
26
- return fmt .Errorf ("create failed: %v" , err )
27
- }
28
- return nil
29
- }
30
-
31
24
func (c * Client ) CreateStream (chrono string , stream string ) error {
32
- if response , err := c .conn .Execute ("cs " + stream ); err != nil || response != "OK" {
25
+ if response , err := c .conn .Execute ("CREATE STREAM " + stream ); err != nil || response != "OK" {
33
26
return fmt .Errorf ("create failed: %v" , err )
34
27
}
35
28
return nil
36
29
}
37
30
func (c * Client ) DeleteStream (chrono string , stream string ) error {
38
- if response , err := c .conn .Execute ("ds " + stream ); err != nil || response != "OK" {
31
+ if response , err := c .conn .Execute ("DELETE STREAM " + stream ); err != nil || response != "OK" {
39
32
return fmt .Errorf ("delete failed: %v" , err )
40
33
}
41
34
return nil
42
35
}
43
36
44
- func (c * Client ) WriteEvent (chrono string , stream string , data map [string ]string ) error {
45
- command := "w " + stream + " "
46
- for k , v := range data {
47
- command += k + " " + v + " "
48
- }
37
+ func (c * Client ) WriteEvent (chrono string , stream string , event string ) error {
38
+ command := "INSERT " + event + " INTO " + stream
39
+ fmt .Println (command + "this is cm" )
49
40
if response , err := c .conn .Execute (command ); err != nil || response != "OK" {
50
41
return fmt .Errorf ("write failed: %v" , err )
51
42
}
52
43
return nil
53
44
}
54
45
55
46
func (c * Client ) Read (chrono string , stream string ) (string , error ) {
56
- return c .conn .Execute ("r " + stream )
47
+ return c .conn .Execute ("SELECT * FROM " + stream )
57
48
}
0 commit comments