Skip to content

Commit d5d10bf

Browse files
committed
Removed all println debugging
1 parent fd43cf7 commit d5d10bf

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

godrorstore/godrorstore.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ func NewWithCleanupInterval(db *sql.DB, cleanupInterval time.Duration) *GodrorSt
2525
}
2626

2727
func (g *GodrorStore) Find(token string) (b []byte, exists bool, err error) {
28-
fmt.Println("Find")
2928
stmt := fmt.Sprintf("SELECT data FROM sessions WHERE token = '%x' AND current_timestamp < expiry", token)
3029
row := g.db.QueryRow(stmt)
3130
err = row.Scan(&b)
@@ -38,12 +37,10 @@ func (g *GodrorStore) Find(token string) (b []byte, exists bool, err error) {
3837
}
3938

4039
func (g *GodrorStore) Commit(token string, b []byte, expiry time.Time) error {
41-
fmt.Println("Commit")
4240
stmt := fmt.Sprintf("SELECT data FROM sessions WHERE token = '%x'", token)
4341
row := g.db.QueryRow(stmt)
4442
err := row.Err()
4543
if row.Scan() == sql.ErrNoRows {
46-
fmt.Println("No Row Found")
4744
stmt = `INSERT INTO sessions (token, data, expiry) VALUES ('%x', '%x', to_timestamp('` + string(expiry.Format("2006-01-02 15:04:05.00")) + `', 'YYYY-MM-DD HH24:MI:SS.FF'))`
4845
stmt = fmt.Sprintf(stmt, token, b)
4946
fmt.Println(stmt)
@@ -53,11 +50,9 @@ func (g *GodrorStore) Commit(token string, b []byte, expiry time.Time) error {
5350
}
5451
return nil
5552
} else if err != nil {
56-
fmt.Println("Other error")
5753
return err
5854
}
5955

60-
fmt.Println("Update session data")
6156
stmt = `UPDATE sessions SET data = '%x', expiry = to_timestamp('` + string(expiry.Format("2006-01-02 15:04:05.00")) + `', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE token = '%x'`
6257
stmt = fmt.Sprintf(stmt, b, token)
6358
_, err = g.db.Exec(stmt)
@@ -69,14 +64,12 @@ func (g *GodrorStore) Commit(token string, b []byte, expiry time.Time) error {
6964
}
7065

7166
func (g *GodrorStore) Delete(token string) error {
72-
fmt.Println("Delete")
7367
stmt := fmt.Sprintf("DELETE FROM session WHERE token = '%x'", token)
7468
_, err := g.db.Exec(stmt)
7569
return err
7670
}
7771

7872
func (g *GodrorStore) All() (map[string][]byte, error) {
79-
fmt.Println("All")
8073
rows, err := g.db.Query("SELECT token, data FROM sessions WHERE current_timestamp < expiry")
8174
if err != nil {
8275
return nil, err
@@ -108,7 +101,6 @@ func (g *GodrorStore) All() (map[string][]byte, error) {
108101
}
109102

110103
func (g *GodrorStore) StartCleanup(interval time.Duration) {
111-
fmt.Println("StartCleanup")
112104
g.stopCleanup = make(chan bool)
113105
ticker := time.NewTicker(interval)
114106
for {
@@ -126,14 +118,12 @@ func (g *GodrorStore) StartCleanup(interval time.Duration) {
126118
}
127119

128120
func (g *GodrorStore) StopCleanup() {
129-
fmt.Println("StopCleanup")
130121
if g.stopCleanup != nil {
131122
g.stopCleanup <- true
132123
}
133124
}
134125

135126
func (g *GodrorStore) deleteExpired() error {
136-
fmt.Println("deleteExpired")
137127
_, err := g.db.Exec("DELETE FROM sessions WHERE expiry < current_timestamp")
138128
return err
139129
}

0 commit comments

Comments
 (0)