Skip to content

fix some typos #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions couchbase/couchbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ func (p *CouchbaseProvider) Exist(sid string) bool {
}
}

// Destory deletes a session by session ID.
func (p *CouchbaseProvider) Destory(sid string) error {
// Destroy deletes a session by session ID.
func (p *CouchbaseProvider) Destroy(sid string) error {
p.b = p.getBucket()
defer p.b.Close()

Expand Down
4 changes: 2 additions & 2 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ func (p *FileProvider) Exist(sid string) bool {
return com.IsFile(p.filepath(sid))
}

// Destory deletes a session by session ID.
func (p *FileProvider) Destory(sid string) error {
// Destroy deletes a session by session ID.
func (p *FileProvider) Destroy(sid string) error {
p.lock.Lock()
defer p.lock.Unlock()
return os.Remove(p.filepath(sid))
Expand Down
4 changes: 2 additions & 2 deletions ledis/ledis.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ func (p *LedisProvider) Exist(sid string) bool {
return err == nil && count > 0
}

// Destory deletes a session by session ID.
func (p *LedisProvider) Destory(sid string) error {
// Destroy deletes a session by session ID.
func (p *LedisProvider) Destroy(sid string) error {
_, err := p.c.Del([]byte(sid))
return err
}
Expand Down
2 changes: 1 addition & 1 deletion ledis/ledis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Test_LedisProvider(t *testing.T) {
So(sess.Delete("uname"), ShouldBeNil)
So(sess.Get("uname"), ShouldBeNil)

So(sess.Destory(ctx), ShouldBeNil)
So(sess.Destroy(ctx), ShouldBeNil)
})

resp := httptest.NewRecorder()
Expand Down
4 changes: 2 additions & 2 deletions memcache/memcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ func (p *MemcacheProvider) Exist(sid string) bool {
return err == nil
}

// Destory deletes a session by session ID.
func (p *MemcacheProvider) Destory(sid string) error {
// Destroy deletes a session by session ID.
func (p *MemcacheProvider) Destroy(sid string) error {
return p.c.Delete(sid)
}

Expand Down
2 changes: 1 addition & 1 deletion memcache/memcache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Test_MemcacheProvider(t *testing.T) {
So(sess.Delete("uname"), ShouldBeNil)
So(sess.Get("uname"), ShouldBeNil)

So(sess.Destory(ctx), ShouldBeNil)
So(sess.Destroy(ctx), ShouldBeNil)
})

resp := httptest.NewRecorder()
Expand Down
6 changes: 3 additions & 3 deletions memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ func (p *MemProvider) Exist(sid string) bool {
return ok
}

// Destory deletes a session by session ID.
func (p *MemProvider) Destory(sid string) error {
// Destroy deletes a session by session ID.
func (p *MemProvider) Destroy(sid string) error {
p.lock.Lock()
defer p.lock.Unlock()

Expand All @@ -171,7 +171,7 @@ func (p *MemProvider) Regenerate(oldsid, sid string) (RawStore, error) {
return nil, err
}

if err = p.Destory(oldsid); err != nil {
if err = p.Destroy(oldsid); err != nil {
return nil, err
}

Expand Down
4 changes: 2 additions & 2 deletions mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ func (p *MysqlProvider) Exist(sid string) bool {
return err != sql.ErrNoRows
}

// Destory deletes a session by session ID.
func (p *MysqlProvider) Destory(sid string) error {
// Destroy deletes a session by session ID.
func (p *MysqlProvider) Destroy(sid string) error {
_, err := p.c.Exec("DELETE FROM session WHERE `key`=?", sid)
return err
}
Expand Down
4 changes: 2 additions & 2 deletions mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func Test_MysqlProvider(t *testing.T) {
So(sess.Delete("uname"), ShouldBeNil)
So(sess.Get("uname"), ShouldBeNil)

So(sess.Destory(ctx), ShouldBeNil)
So(sess.Destroy(ctx), ShouldBeNil)
})

resp := httptest.NewRecorder()
Expand Down Expand Up @@ -98,7 +98,7 @@ func Test_MysqlProvider(t *testing.T) {
So(err, ShouldBeNil)
So(raw, ShouldNotBeNil)

So(sess.Destory(ctx), ShouldBeNil)
So(sess.Destroy(ctx), ShouldBeNil)
})

resp := httptest.NewRecorder()
Expand Down
4 changes: 2 additions & 2 deletions nodb/nodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ func (p *NodbProvider) Exist(sid string) bool {
return err == nil && count > 0
}

// Destory deletes a session by session ID.
func (p *NodbProvider) Destory(sid string) error {
// Destroy deletes a session by session ID.
func (p *NodbProvider) Destroy(sid string) error {
_, err := p.c.Del([]byte(sid))
return err
}
Expand Down
2 changes: 1 addition & 1 deletion nodb/nodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Test_LedisProvider(t *testing.T) {
So(sess.Delete("uname"), ShouldBeNil)
So(sess.Get("uname"), ShouldBeNil)

So(sess.Destory(ctx), ShouldBeNil)
So(sess.Destroy(ctx), ShouldBeNil)
})

resp := httptest.NewRecorder()
Expand Down
4 changes: 2 additions & 2 deletions postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func (p *PostgresProvider) Exist(sid string) bool {
return err != sql.ErrNoRows
}

// Destory deletes a session by session ID.
func (p *PostgresProvider) Destory(sid string) error {
// Destroy deletes a session by session ID.
func (p *PostgresProvider) Destroy(sid string) error {
_, err := p.c.Exec("DELETE FROM session WHERE key=$1", sid)
return err
}
Expand Down
4 changes: 2 additions & 2 deletions postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func Test_PostgresProvider(t *testing.T) {
So(sess.Delete("uname"), ShouldBeNil)
So(sess.Get("uname"), ShouldBeNil)

So(sess.Destory(ctx), ShouldBeNil)
So(sess.Destroy(ctx), ShouldBeNil)
})

resp := httptest.NewRecorder()
Expand Down Expand Up @@ -98,7 +98,7 @@ func Test_PostgresProvider(t *testing.T) {
So(err, ShouldBeNil)
So(raw, ShouldNotBeNil)

So(sess.Destory(ctx), ShouldBeNil)
So(sess.Destroy(ctx), ShouldBeNil)
})

resp := httptest.NewRecorder()
Expand Down
4 changes: 2 additions & 2 deletions redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ func (p *RedisProvider) Exist(sid string) bool {
return err == nil && has
}

// Destory deletes a session by session ID.
func (p *RedisProvider) Destory(sid string) error {
// Destroy deletes a session by session ID.
func (p *RedisProvider) Destroy(sid string) error {
return p.c.Del(p.prefix + sid).Err()
}

Expand Down
2 changes: 1 addition & 1 deletion redis/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Test_RedisProvider(t *testing.T) {
So(sess.Delete("uname"), ShouldBeNil)
So(sess.Get("uname"), ShouldBeNil)

So(sess.Destory(ctx), ShouldBeNil)
So(sess.Destroy(ctx), ShouldBeNil)
})

resp := httptest.NewRecorder()
Expand Down
14 changes: 7 additions & 7 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ type Store interface {
RawStore
// Read returns raw session store by session ID.
Read(string) (RawStore, error)
// Destory deletes a session.
Destory(*macaron.Context) error
// Destroy deletes a session.
Destroy(*macaron.Context) error
// RegenerateId regenerates a session store from old session ID to new one.
RegenerateId(*macaron.Context) (RawStore, error)
// Count counts and returns number of sessions.
Expand Down Expand Up @@ -199,8 +199,8 @@ type Provider interface {
Read(sid string) (RawStore, error)
// Exist returns true if session with given ID exists.
Exist(sid string) bool
// Destory deletes a session by session ID.
Destory(sid string) error
// Destroy deletes a session by session ID.
Destroy(sid string) error
// Regenerate regenerates a session store from old session ID to new one.
Regenerate(oldsid, sid string) (RawStore, error)
// Count counts and returns number of sessions.
Expand Down Expand Up @@ -285,14 +285,14 @@ func (m *Manager) Read(sid string) (RawStore, error) {
return m.provider.Read(sid)
}

// Destory deletes a session by given ID.
func (m *Manager) Destory(ctx *macaron.Context) error {
// Destroy deletes a session by given ID.
func (m *Manager) Destroy(ctx *macaron.Context) error {
sid := ctx.GetCookie(m.opt.CookieName)
if len(sid) == 0 {
return nil
}

if err := m.provider.Destory(sid); err != nil {
if err := m.provider.Destroy(sid); err != nil {
return err
}
cookie := &http.Cookie{
Expand Down
2 changes: 1 addition & 1 deletion session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func testProvider(opt Options) {
So(sess.Delete("uname"), ShouldBeNil)
So(sess.Get("uname"), ShouldBeNil)

So(sess.Destory(ctx), ShouldBeNil)
So(sess.Destroy(ctx), ShouldBeNil)
})

resp := httptest.NewRecorder()
Expand Down