Documentation
¶
Overview ¶
Package knowledge stores project guidance independently of contract workflows.
Index ¶
- Constants
- Variables
- type CreateParams
- type Metadata
- type Page
- type SearchParams
- type SearchResult
- type SearchResults
- type Store
- func (s *Store) Close() error
- func (s *Store) Create(ctx context.Context, p CreateParams) (Page, error)
- func (s *Store) Get(ctx context.Context, reference, slug string) (Page, error)
- func (s *Store) List(ctx context.Context, reference string) ([]Metadata, error)
- func (s *Store) Search(ctx context.Context, params SearchParams) (SearchResults, error)
- func (s *Store) Update(ctx context.Context, p UpdateParams) (Page, error)
- type UpdateParams
Constants ¶
const ( // MaxQueryBytes bounds user-provided search text. MaxQueryBytes = 1024 // MaxQueryTerms bounds the distinct normalized terms in a search. MaxQueryTerms = 32 // DefaultSearchLimit is the result limit used by the CLI when omitted. DefaultSearchLimit = 20 // MaxSearchLimit is the largest result set retained and returned. MaxSearchLimit = 100 // MaxSnippetRunes bounds body context without splitting UTF-8. MaxSnippetRunes = 240 )
const MaxBodyBytes = 1 << 20
MaxBodyBytes bounds one page to 1 MiB of UTF-8 text.
Variables ¶
var ( ErrProjectNotFound = errors.New("project not found") ErrProjectArchived = errors.New("project is archived") ErrPageNotFound = errors.New("knowledge page not found") ErrPageExists = errors.New("knowledge page already exists") ErrRevisionConflict = errors.New("knowledge page changed; read the latest revision and reconcile the edit") ErrInvalidInput = errors.New("invalid knowledge input") )
Functions ¶
This section is empty.
Types ¶
type CreateParams ¶
type CreateParams struct {
Project, Slug, Title, Body, Actor string
}
CreateParams defines the initial content of a project page.
type Metadata ¶
type Metadata struct {
ID int64 `json:"id"`
ProjectID int64 `json:"projectId"`
ProjectKey string `json:"projectKey"`
Slug string `json:"slug"`
Title string `json:"title"`
Revision int `json:"revision"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Metadata is the body-free index entry for a project page.
type SearchParams ¶ added in v0.4.0
SearchParams identifies one bounded project knowledge search.
type SearchResult ¶ added in v0.4.0
type SearchResult struct {
Metadata
Snippet string `json:"snippet"`
MatchedFields []string `json:"matchedFields"`
// contains filtered or unexported fields
}
SearchResult is page metadata plus safe body context and fixed-order match fields.
type SearchResults ¶ added in v0.4.0
type SearchResults struct {
Query string `json:"query"`
Results []SearchResult `json:"results"`
Total int `json:"total"`
Limit int `json:"limit"`
Truncated bool `json:"truncated"`
}
SearchResults contains exact match metadata and at most Limit ranked results.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns knowledge persistence in the shared control plane.
func OpenReadOnly ¶ added in v0.4.0
OpenReadOnly opens an existing fully migrated control plane without creating, migrating, auditing, or otherwise changing it.
func (*Store) Search ¶ added in v0.4.0
func (s *Store) Search(ctx context.Context, params SearchParams) (SearchResults, error)
Search scans current pages within one project and retains only the bounded top results.
type UpdateParams ¶
UpdateParams replaces a page only if the caller observed its current revision.