Documentation
¶
Index ¶
- type Cache
- type CacheEntry
- type Config
- type Proxy
- func (p *Proxy) Clear()
- func (p *Proxy) Direct() *goprismic.Api
- func (p *Proxy) Get(key string, refresh RefreshFn) (interface{}, error)
- func (p *Proxy) GetDocument(id string) (*goprismic.Document, error)
- func (p *Proxy) GetDocumentBy(docType, field string, value interface{}) (*goprismic.Document, error)
- func (p *Proxy) GetStats() Stats
- func (p *Proxy) Refresh() bool
- func (p *Proxy) Search() *SearchForm
- type RefreshFn
- type SearchForm
- func (s *SearchForm) Data(data map[string]string) *SearchForm
- func (s *SearchForm) Error() error
- func (s *SearchForm) Form(name string) *SearchForm
- func (s *SearchForm) Order(field string, order int) *SearchForm
- func (s *SearchForm) Page(page int) *SearchForm
- func (s *SearchForm) PageSize(pageSize int) *SearchForm
- func (s *SearchForm) Query(query string) *SearchForm
- func (s *SearchForm) Submit() (*goprismic.SearchResult, error)
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
A cache
type CacheEntry ¶
type CacheEntry struct {
// contains filtered or unexported fields
}
A cache Entry
type Config ¶
type Config struct {
// Cache size
CacheSize int
// TTL
// Cache is asynchronous during the TTL duration after an update.
TTL time.Duration
// API Master ref refresh frequency
// The proxy will check at this interval if something has changed.
MasterRefresh time.Duration
// Base refresh chance after a master reference update, between 0 and 1
BaselineRefreshChance float32
// contains filtered or unexported fields
}
type Proxy ¶
type Proxy struct {
Config Config
// contains filtered or unexported fields
}
func (*Proxy) GetDocument ¶
Fetches a document by id
func (*Proxy) GetDocumentBy ¶
func (p *Proxy) GetDocumentBy(docType, field string, value interface{}) (*goprismic.Document, error)
Fetches a document of a specific type by a field value
type SearchForm ¶
type SearchForm struct {
// contains filtered or unexported fields
}
func (*SearchForm) Data ¶
func (s *SearchForm) Data(data map[string]string) *SearchForm
Adds form data
func (*SearchForm) Form ¶
func (s *SearchForm) Form(name string) *SearchForm
Selects the form on which to use
func (*SearchForm) Order ¶
func (s *SearchForm) Order(field string, order int) *SearchForm
Order result - can be chained multiple times
example : form.Order("my.product.name", OrderAsc).Order("my.product.size", OrderDesc)
func (*SearchForm) PageSize ¶
func (s *SearchForm) PageSize(pageSize int) *SearchForm
Sets the page size
func (*SearchForm) Query ¶
func (s *SearchForm) Query(query string) *SearchForm
Query the form using a predicate query ([[:d = any(document.type, ["article"])]])
func (*SearchForm) Submit ¶
func (s *SearchForm) Submit() (*goprismic.SearchResult, error)
Searches the repository If search fails, it might mean that the master revision has changed
Click to show internal directories.
Click to hide internal directories.