sqs-browse: added notion of workspaces in sqs-browse
Also added a tool to generate test tables
This commit is contained in:
parent
cecdbafabb
commit
30dbc4eefe
16 changed files with 239 additions and 60 deletions
30
internal/sqs-browse/providers/stormstore/memstore.go
Normal file
30
internal/sqs-browse/providers/stormstore/memstore.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package stormstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/asdine/storm"
|
||||
"github.com/lmika/awstools/internal/sqs-browse/models"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type Store struct {
|
||||
db *storm.DB
|
||||
}
|
||||
|
||||
// TODO: should probably be a workspace provider
|
||||
func NewStore(filename string) (*Store, error) {
|
||||
db, err := storm.Open(filename)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "cannot open store %v", filename)
|
||||
}
|
||||
|
||||
return &Store{db: db}, nil
|
||||
}
|
||||
|
||||
func (s *Store) Close() {
|
||||
s.db.Close()
|
||||
}
|
||||
|
||||
func (s *Store) Save(ctx context.Context, msg *models.Message) error {
|
||||
return s.db.Save(msg)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue