Documentation ¶
Index ¶
- Constants
- Variables
- type Api
- type ApiData
- type Config
- type Document
- func (d *Document) GetBool(field string) (bool, bool)
- func (d *Document) GetColor(field string) (string, bool)
- func (d *Document) GetColorFragment(field string) (*fragment.Color, bool)
- func (d *Document) GetDate(field string) (time.Time, bool)
- func (d *Document) GetDateFragment(field string) (*fragment.Date, bool)
- func (d *Document) GetFragment(field string) (fragment.Interface, bool)
- func (d *Document) GetFragmentAt(field string, index int) (fragment.Interface, bool)
- func (d *Document) GetFragments(field string) (fragment.List, bool)
- func (d *Document) GetGeoPointFragment(field string) (*fragment.GeoPoint, bool)
- func (d *Document) GetImageFragment(field string) (*fragment.Image, bool)
- func (d *Document) GetLinkFragment(field string) (*fragment.Link, bool)
- func (d *Document) GetNumber(field string) (float64, bool)
- func (d *Document) GetNumberFragment(field string) (*fragment.Number, bool)
- func (d *Document) GetSlug() string
- func (d *Document) GetStructuredTextBlocks(field string) ([]block.Block, bool)
- func (d *Document) GetStructuredTextFragment(field string) (*fragment.StructuredText, bool)
- func (d *Document) GetText(field string) (string, bool)
- func (d *Document) GetTextFragment(field string) (*fragment.Text, bool)
- func (d *Document) HasSlug(slug string) bool
- func (d *Document) ResolveLinks(r link.Resolver)
- type Field
- type Form
- type PrismicError
- type Ref
- 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() (*SearchResult, error)
- type SearchResult
Constants ¶
const ( StatusOK = iota StatusOverCapacity )
const ( OrderAsc = iota OrderDesc )
Variables ¶
var DefaultConfig = Config{ Workers: 3, Timeout: 5 * time.Second, }
Default configuration
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct { URL string AccessToken string Data ApiData Config Config Status int // contains filtered or unexported fields }
type Document ¶
type Document struct { Id string `json:"id"` Type string `json:"type"` Href string `json:"href"` Tags []string `json:"tags"` Slugs []string `json:"slugs"` Fragments fragment.Tree `json:"data"` }
A document is made of fragments of various types
func (*Document) GetColorFragment ¶
Returns a color fragment (the first found)
func (*Document) GetDateFragment ¶
Returns a date fragment (the first found)
func (*Document) GetFragment ¶
Returns the first fragment of a certain name
func (*Document) GetFragmentAt ¶
Returns the nth fragment of a certain name
func (*Document) GetFragments ¶
Returns the list of fragments of a certain name
func (*Document) GetGeoPointFragment ¶
Returns a geopoint fragment (returns the first found)
func (*Document) GetImageFragment ¶
Returns an image fragment (the first found)
func (*Document) GetLinkFragment ¶
Returns a link fragment (the first found)
func (*Document) GetNumberFragment ¶
Returns a number fragment (the first found)
func (*Document) GetStructuredTextBlocks ¶
Returns the list of blocks of a structured text fragment
func (*Document) GetStructuredTextFragment ¶
func (d *Document) GetStructuredTextFragment(field string) (*fragment.StructuredText, bool)
Returns a structured text fragment (returns the first found)
func (*Document) GetTextFragment ¶
Returns a text fragment (the first found)
type Form ¶
type Form struct { Name string `json:"name"` Method string `json:"method"` Rel string `json:"rel"` EncType string `json:"enctype"` Action string `json:"action"` Fields map[string]Field `json:"fields"` }
A form
type PrismicError ¶
type PrismicError struct { Message string `json:"message"` Type string `json:"type"` Line int `json:"line"` Column int `json:"column"` Until int64 `json:"until"` }
func (*PrismicError) Error ¶
func (e *PrismicError) Error() string
func (*PrismicError) IsOverCapacity ¶
func (e *PrismicError) IsOverCapacity() bool
type Ref ¶
type Ref struct { Id string `json:"id"` Ref string `json:"ref"` Label string `json:"label"` IsMasterRef bool `json:"isMasterRef"` ScheduledAt int64 `json:"scheduledAt"` }
func (*Ref) ScheduledTime ¶
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() (*SearchResult, error)
Searches the repository