documents

package
v0.0.0-...-27145f1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFileType = errors.New("invalid file type")
)

Functions

func MakeDocumentHandler

func MakeDocumentHandler(mr *mux.Router, service DocumentService) http.Handler

Types

type Document

type Document struct {
	ID          string     `json:"id"`
	DisplayName string     `json:"display_name"`
	Name        string     `json:"name"`
	Path        string     `json:"path"`
	Type        string     `json:"type"`
	Description string     `json:"description"`
	Tags        []string   `json:"tag_ids"`
	Created     time.Time  `json:"created"`
	Updated     *time.Time `json:"updated"`
}

type DocumentRepository

type DocumentRepository interface {
	FindAll(ctx context.Context, filter map[string]interface{}) ([]*Document, error)
	FindByID(ctx context.Context, id string) (*Document, error)
	Insert(ctx context.Context, document *Document) error
	Delete(ctx context.Context, id string) error
	UpdateDocument(ctx context.Context, document Document) (Document, error)
	UpsertStream(ctx context.Context, input <-chan *Document) error
}

type DocumentService

type DocumentService interface {
	FindAll(ctx context.Context, filter map[string]interface{}) ([]*Document, error)
	FindByID(ctx context.Context, id string) (*Document, error)
	Add(ctx context.Context, file multipart.File, document *Document) error
	Delete(ctx context.Context, id string) error
	Scan(ctx context.Context) error
	UpdateFields(ctx context.Context, id string, docs Document) (Document, error)
}

func NewDocumentService

func NewDocumentService(storage common.DocumentStorage, repo DocumentRepository) DocumentService

Jump to

Keyboard shortcuts

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