Documentation ¶
Overview ¶
Package documents provides the document related business logic.
Index ¶
- Constants
- Variables
- func FindDocInfoByKey(ctx context.Context, be *backend.Backend, project *types.Project, ...) (*database.DocInfo, error)
- func FindDocInfoByKeyAndOwner(ctx context.Context, be *backend.Backend, clientInfo *database.ClientInfo, ...) (*database.DocInfo, error)
- func FindDocInfoByRefKey(ctx context.Context, be *backend.Backend, refkey types.DocRefKey) (*database.DocInfo, error)
- func GetDocumentByServerSeq(ctx context.Context, be *backend.Backend, project *types.Project, k key.Key, ...) (*document.InternalDocument, error)
- func GetDocumentSummary(ctx context.Context, be *backend.Backend, project *types.Project, k key.Key) (*types.DocumentSummary, error)
- func IsDocumentAttached(ctx context.Context, be *backend.Backend, docRefKey types.DocRefKey, ...) (bool, error)
- func ListDocumentSummaries(ctx context.Context, be *backend.Backend, project *types.Project, ...) ([]*types.DocumentSummary, error)
- func RemoveDocument(ctx context.Context, be *backend.Backend, refKey types.DocRefKey, force bool) error
- func SearchDocumentSummaries(ctx context.Context, be *backend.Backend, project *types.Project, query string, ...) (*types.SearchResult[*types.DocumentSummary], error)
Constants ¶
const SnapshotMaxLen = 50
SnapshotMaxLen is the maximum length of the document snapshot in the document summary.
Variables ¶
var ( // ErrDocumentAttached is returned when the document is attached when // deleting the document. ErrDocumentAttached = fmt.Errorf("document is attached") )
Functions ¶
func FindDocInfoByKey ¶ added in v0.2.9
func FindDocInfoByKey( ctx context.Context, be *backend.Backend, project *types.Project, docKey key.Key, ) (*database.DocInfo, error)
FindDocInfoByKey returns a document for the given document key.
func FindDocInfoByKeyAndOwner ¶ added in v0.2.9
func FindDocInfoByKeyAndOwner( ctx context.Context, be *backend.Backend, clientInfo *database.ClientInfo, docKey key.Key, createDocIfNotExist bool, ) (*database.DocInfo, error)
FindDocInfoByKeyAndOwner returns a document for the given document key. If createDocIfNotExist is true, it creates a new document if it does not exist.
func FindDocInfoByRefKey ¶ added in v0.4.14
func FindDocInfoByRefKey( ctx context.Context, be *backend.Backend, refkey types.DocRefKey, ) (*database.DocInfo, error)
FindDocInfoByRefKey returns a document for the given document refKey.
func GetDocumentByServerSeq ¶ added in v0.2.11
func GetDocumentByServerSeq( ctx context.Context, be *backend.Backend, project *types.Project, k key.Key, serverSeq int64, ) (*document.InternalDocument, error)
GetDocumentByServerSeq returns a document for the given server sequence.
func GetDocumentSummary ¶
func GetDocumentSummary( ctx context.Context, be *backend.Backend, project *types.Project, k key.Key, ) (*types.DocumentSummary, error)
GetDocumentSummary returns a document summary.
func IsDocumentAttached ¶ added in v0.4.4
func IsDocumentAttached( ctx context.Context, be *backend.Backend, docRefKey types.DocRefKey, excludeClientID types.ID, ) (bool, error)
IsDocumentAttached returns true if the given document is attached to any client.
func ListDocumentSummaries ¶
func ListDocumentSummaries( ctx context.Context, be *backend.Backend, project *types.Project, paging types.Paging[types.ID], includeSnapshot bool, ) ([]*types.DocumentSummary, error)
ListDocumentSummaries returns a list of document summaries.
func RemoveDocument ¶ added in v0.4.0
func RemoveDocument( ctx context.Context, be *backend.Backend, refKey types.DocRefKey, force bool, ) error
RemoveDocument removes the given document. If force is false, it only removes the document if it is not attached to any client.
func SearchDocumentSummaries ¶ added in v0.2.13
func SearchDocumentSummaries( ctx context.Context, be *backend.Backend, project *types.Project, query string, pageSize int, ) (*types.SearchResult[*types.DocumentSummary], error)
SearchDocumentSummaries returns document summaries that match the query parameters.
Types ¶
This section is empty.