store

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2017 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("requested resource not found")

ErrNotFound should be returned when any database query finds no results. Driver-specific not found errors should never be returned.

Functions

func NewContext

func NewContext(ctx context.Context, sess Session) context.Context

NewContext returns a new Context including the given Session.

Types

type MongoNoteStore

type MongoNoteStore struct {
	// contains filtered or unexported fields
}

func (*MongoNoteStore) DeleteNote

func (s *MongoNoteStore) DeleteNote(id uuid.UUID) error

func (*MongoNoteStore) FoldersByFolder

func (s *MongoNoteStore) FoldersByFolder(userID uuid.UUID, folder string) ([]string, error)

func (*MongoNoteStore) NoteByID

func (s *MongoNoteStore) NoteByID(id uuid.UUID) (notes.Note, error)

func (*MongoNoteStore) NotesByFolder

func (s *MongoNoteStore) NotesByFolder(userID uuid.UUID, folder string, page page.Page) ([]notes.Note, int, error)

func (*MongoNoteStore) NotesByOwner

func (s *MongoNoteStore) NotesByOwner(userID uuid.UUID, page page.Page) ([]notes.Note, int, error)

func (*MongoNoteStore) NotesByTag

func (s *MongoNoteStore) NotesByTag(userID uuid.UUID, tag string, page page.Page) ([]notes.Note, error)

func (*MongoNoteStore) SaveNote

func (s *MongoNoteStore) SaveNote(note *notes.Note) error

func (*MongoNoteStore) Tags

func (s *MongoNoteStore) Tags(userID uuid.UUID, page page.Page) ([]string, error)

type MongoStore

type MongoStore struct {
	// contains filtered or unexported fields
}

func (*MongoStore) Close

func (s *MongoStore) Close() error

func (*MongoStore) NoteStore

func (s *MongoStore) NoteStore() NoteStore

func (*MongoStore) UserStore

func (s *MongoStore) UserStore() UserStore

type MongoUserStore

type MongoUserStore struct {
	// contains filtered or unexported fields
}

func (*MongoUserStore) DeleteUser

func (s *MongoUserStore) DeleteUser(id uuid.UUID) error

func (*MongoUserStore) SaveUser

func (s *MongoUserStore) SaveUser(user *users.User) error

func (*MongoUserStore) UserByID

func (s *MongoUserStore) UserByID(id uuid.UUID) (users.User, error)

func (*MongoUserStore) UserByName

func (s *MongoUserStore) UserByName(username string) (users.User, error)

func (*MongoUserStore) Users

func (s *MongoUserStore) Users(page page.Page) ([]users.User, int, error)

type NoteStore

type NoteStore interface {
	NoteByID(id uuid.UUID) (notes.Note, error)
	NotesByOwner(userID uuid.UUID, page page.Page) ([]notes.Note, int, error)
	NotesByFolder(userID uuid.UUID, folder string, page page.Page) ([]notes.Note, int, error)
	//FoldersByFolder(userID uuid.UUID, folder string) ([]string, error)
	//NotesByTag(userID uuid.UUID, tag string, page page.Page) ([]notes.Note, int, error)
	//Tags(userID uuid.UUID) ([]string, error)
	//Search(userID uuid.UUID, query string, page page.Page) ([]notes.Note, int, error)
	SaveNote(note *notes.Note) error
	DeleteNote(id uuid.UUID) error
}

NoteStore implementations handle access to the backing store for notes.

type Session

type Session interface {
	NoteStore() NoteStore
	UserStore() UserStore
}

Session implementations handle access to the backing store(s) for notes and users for a single session. They may optionally also be an io.Closer, and if they are, they can expect to be closed after each request.

func FromContext

func FromContext(ctx context.Context) (Session, bool)

FromContext returns the Session in the given Context, if it is set.

func NewMongoStore

func NewMongoStore(conf config.Config) (Session, error)

func NewSession

func NewSession(conf config.Config) (Session, error)

NewSession returns a new database session for the given configuration, including selecting the appropriate database driver.

func NewStormStore

func NewStormStore(conf config.Config) (Session, error)

type StormNoteStore

type StormNoteStore struct {
	// contains filtered or unexported fields
}

func (*StormNoteStore) DeleteNote

func (s *StormNoteStore) DeleteNote(id uuid.UUID) error

func (*StormNoteStore) NoteByID

func (s *StormNoteStore) NoteByID(id uuid.UUID) (notes.Note, error)

func (*StormNoteStore) NotesByFolder

func (s *StormNoteStore) NotesByFolder(userID uuid.UUID, folder string, page page.Page) ([]notes.Note, int, error)

func (*StormNoteStore) NotesByOwner

func (s *StormNoteStore) NotesByOwner(userID uuid.UUID, page page.Page) ([]notes.Note, int, error)

func (*StormNoteStore) SaveNote

func (s *StormNoteStore) SaveNote(note *notes.Note) error

type StormStore

type StormStore struct {
	// contains filtered or unexported fields
}

func (*StormStore) Close

func (s *StormStore) Close() error

func (*StormStore) NoteStore

func (s *StormStore) NoteStore() NoteStore

func (*StormStore) UserStore

func (s *StormStore) UserStore() UserStore

type StormUserStore

type StormUserStore struct {
	// contains filtered or unexported fields
}

func (*StormUserStore) DeleteUser

func (s *StormUserStore) DeleteUser(id uuid.UUID) error

func (*StormUserStore) SaveUser

func (s *StormUserStore) SaveUser(user *users.User) error

func (*StormUserStore) UserByID

func (s *StormUserStore) UserByID(id uuid.UUID) (users.User, error)

func (*StormUserStore) UserByName

func (s *StormUserStore) UserByName(username string) (users.User, error)

func (*StormUserStore) Users

func (s *StormUserStore) Users(page page.Page) ([]users.User, int, error)

type UserStore

type UserStore interface {
	UserByID(id uuid.UUID) (users.User, error)
	UserByName(username string) (users.User, error)
	Users(page page.Page) ([]users.User, int, error)
	SaveUser(user *users.User) error
	DeleteUser(id uuid.UUID) error
}

UserStore implementations handle access to the backing store for users.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL