scopes
2015-12-13
Parent:b93938562a17
scopes/memstore.go
Port over Postgres storage and tests. Do the minimum possible port of the code from auth to get Postgres working and make the tests run and pass again. This leaves a bug where the ErrScopeAlreadyExists type, when populatd from Postgres, contains the entire error string returned from the database, instead of parsing the ID itself out. Which is a thing we should do and add a test for.
1.1 --- a/memstore.go Sat Dec 05 15:00:34 2015 -0800 1.2 +++ b/memstore.go Sun Dec 13 20:42:48 2015 -0800 1.3 @@ -14,6 +14,12 @@ 1.4 lock sync.RWMutex 1.5 } 1.6 1.7 +func NewMemstore() *Memstore { 1.8 + return &Memstore{ 1.9 + scopes: map[string]scopeTypes.Scope{}, 1.10 + } 1.11 +} 1.12 + 1.13 func (m *Memstore) CreateScopes(scopes []scopeTypes.Scope, ctx context.Context) error { 1.14 m.lock.Lock() 1.15 defer m.lock.Unlock()