storage

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: May 25, 2017 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TITLE    = "title"
	MODIFIED = "modified"
)

Variables

This section is empty.

Functions

func NewPage

func NewPage(id string, data []byte) page

Types

type Dao

type Dao interface {
	Fetch(id string) ([]byte, error)
	FetchGlob(pattern string) []string
	Insert(id string, data []byte) error
	Delete(id string) error
	DeleteGlob(pattern string) error
	Index(id, title string, data []byte) error
	Query(query string) (*QueryResult, error)
	Drop() error
}

type FileSystemDao

type FileSystemDao struct {
	*SearchDB
	// contains filtered or unexported fields
}

func NewFileSystemDao

func NewFileSystemDao(root string, mode os.FileMode, searchDir string) (*FileSystemDao, error)

func (*FileSystemDao) Delete

func (fs *FileSystemDao) Delete(pageID string) error

func (*FileSystemDao) DeleteGlob

func (fs *FileSystemDao) DeleteGlob(pattern string) error

func (*FileSystemDao) Drop

func (fs *FileSystemDao) Drop() error

func (*FileSystemDao) Fetch

func (fs *FileSystemDao) Fetch(pageID string) ([]byte, error)

func (*FileSystemDao) FetchGlob

func (fs *FileSystemDao) FetchGlob(pattern string) []string

func (*FileSystemDao) Index

func (fs *FileSystemDao) Index(pageID, pageTitle string, pageData []byte) error

func (*FileSystemDao) Insert

func (fs *FileSystemDao) Insert(pageID string, pageData []byte) error

func (*FileSystemDao) Query

func (fs *FileSystemDao) Query(query string) (*QueryResult, error)

type MockDao

type MockDao struct {
	Dao
	// contains filtered or unexported fields
}

MockDao should only be used for testing purposes

func NewMockDao

func NewMockDao(root string) *MockDao

func (*MockDao) Fetch

func (m *MockDao) Fetch(id string) ([]byte, error)

func (*MockDao) FetchGlob

func (m *MockDao) FetchGlob(pattern string) []string

func (*MockDao) Index

func (m *MockDao) Index(id, title string, data []byte) error

func (*MockDao) Insert

func (m *MockDao) Insert(id string, data []byte) error

type MongoDBDao

type MongoDBDao struct {
	Session *mgo.Session
	Idx     mgo.Index

	*SearchDB
	// contains filtered or unexported fields
}

func NewMongoDBDao

func NewMongoDBDao(connection string, searchDir string) (*MongoDBDao, error)

func (*MongoDBDao) Delete

func (mongo *MongoDBDao) Delete(id string) error

func (*MongoDBDao) DeleteGlob

func (mongo *MongoDBDao) DeleteGlob(pattern string) error

func (*MongoDBDao) Drop

func (mongo *MongoDBDao) Drop() error

func (*MongoDBDao) Fetch

func (mongo *MongoDBDao) Fetch(id string) ([]byte, error)

func (*MongoDBDao) FetchGlob

func (mongo *MongoDBDao) FetchGlob(pattern string) []string

func (*MongoDBDao) Index

func (mongo *MongoDBDao) Index(id, title string, data []byte) error

func (*MongoDBDao) Insert

func (mongo *MongoDBDao) Insert(id string, data []byte) error

func (*MongoDBDao) Query

func (mongo *MongoDBDao) Query(query string) (*QueryResult, error)

type QueryMatch

type QueryMatch struct {
	ID       string
	Rank     int
	Score    float64
	Modified string
	Title    string
	Body     template.HTML
}

type QueryResult

type QueryResult struct {
	Phrase       string
	Total        uint64
	Took         float64
	QueryMatches []QueryMatch
}

func (*QueryResult) ToMap

func (qr *QueryResult) ToMap() map[string]interface{}

type SearchDB

type SearchDB struct {
	Path string
	mapping.IndexMapping
	bleve.Index
}

func NewSearchDB

func NewSearchDB(dir string) (*SearchDB, error)

func (*SearchDB) Query

func (s *SearchDB) Query(phrase string) (*QueryResult, error)

Jump to

Keyboard shortcuts

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