Documentation
¶
Index ¶
- Variables
- func CalculateUUID(time time.Time) (ulid.ULID, error)
- func DeleteDocument(docULIDSt string, db *storm.DB) error
- func DeleteDocumentFromSearch(deleteDocument Document, searchDB bleve.Index) error
- func FetchAllDocuments(db *storm.DB) (*[]Document, error)
- func FetchConfigFromDB(db *storm.DB) (config.ServerConfig, error)
- func SetupDatabase() (db *storm.DB)
- func SetupSearchDB() (bleve.Index, error)
- func UpdateDocumentField(docULIDSt string, field string, newValue interface{}, db *storm.DB) (int, error)
- func WriteConfigToDB(serverConfig config.ServerConfig, db *storm.DB)
- type Document
- func AddNewDocument(filePath string, fullText string, db *storm.DB, searchDB bleve.Index) (*Document, error)
- func FetchDocument(docULIDSt string, db *storm.DB) (Document, int, error)
- func FetchDocumentFromPath(path string, db *storm.DB) (Document, error)
- func FetchDocuments(docULIDSt []string, db *storm.DB) ([]Document, int, error)
- func FetchFolder(folderName string, db *storm.DB) ([]Document, error)
- func FetchNewestDocuments(numberOf int, db *storm.DB) ([]Document, error)
Constants ¶
This section is empty.
Variables ¶
var Logger *lecho.Logger
Logger is global since we will need it everywhere
Functions ¶
func CalculateUUID ¶
CalculateUUID for the incoming file
func DeleteDocument ¶
DeleteDocument fetches the requested document by ULID
func DeleteDocumentFromSearch ¶
DeleteDocumentFromSearch deletes everything in the search engine
func FetchAllDocuments ¶
FetchAllDocuments fetches all the documents in the database
func FetchConfigFromDB ¶
func FetchConfigFromDB(db *storm.DB) (config.ServerConfig, error)
FetchConfigFromDB pulls the server config from the database
func SetupDatabase ¶
SetupDatabase initializes the storm/bbolt database
func SetupSearchDB ¶
SetupSearchDB sets up new bleve or opens existing
func UpdateDocumentField ¶
func UpdateDocumentField(docULIDSt string, field string, newValue interface{}, db *storm.DB) (int, error)
UpdateDocumentField updates a single field in a document
func WriteConfigToDB ¶
func WriteConfigToDB(serverConfig config.ServerConfig, db *storm.DB)
WriteConfigToDB writes the serverconfig to the database for later retrieval
Types ¶
type Document ¶
type Document struct { StormID int `storm:"id,increment=100"` //all records start at 100 for the ID and go up Name string Path string //full path to the file IngressTime time.Time Folder string Hash string ULID ulid.ULID `storm:"index"` //Have a smaller (than hash) id that can be used in URL's, hopefully speed things up DocumentType string //type of document (pdf, txt, etc) FullText string URL string }
Document is all of the document information stored in the database
func AddNewDocument ¶
func AddNewDocument(filePath string, fullText string, db *storm.DB, searchDB bleve.Index) (*Document, error)
AddNewDocument adds a new document to the database
func FetchDocument ¶
FetchDocument fetches the requested document by ULID
func FetchDocumentFromPath ¶
FetchDocumentFromPath fetches the document by document path
func FetchDocuments ¶
FetchDocuments fetches an array of documents //TODO: Not fucking needed?
func FetchFolder ¶
FetchFolder grabs all of the documents contained in a folder