Documentation ¶
Index ¶
- Variables
- type DocumentId
- type ErrorType
- type Get
- type GetParameter
- type GetResponse
- type NewClientParams
- type OperationalParams
- type Put
- type Query
- func (q *Query) AddParameter(p QueryParameter) *Query
- func (q *Query) AddVariable(key string, value string) *Query
- func (q *Query) AddYQL(yql string) *Query
- func (q *Query) Exec() (QueryResponse, error)
- func (q *Query) Get(dest any) (QueryResponse, error)
- func (q *Query) Select(dest any) (QueryResponse, error)
- func (q *Query) WithContext(c context.Context) *Query
- type QueryParameter
- type QueryResponse
- type Remove
- type RemoveParams
- type Root
- type Update
- func (u *Update) Add(field string, value []any) *Update
- func (u *Update) AddParameter(p OperationalParams) *Update
- func (u *Update) AddWeightedSet(field string, ws map[any]int) *Update
- func (u *Update) Assign(field string, value any) *Update
- func (u *Update) Decrement(field string, value any) *Update
- func (u *Update) Divide(field string, value any) *Update
- func (q *Update) Exec() error
- func (u *Update) Increment(field string, value any) *Update
- func (u *Update) Match(field string, element string, operation string, value any) *Update
- func (u *Update) Multiply(field string, value any) *Update
- func (u *Update) Remove(field string) *Update
- func (u *Update) RemoveWeightedSet(field string, element string) *Update
- func (u *Update) WithContext(c context.Context) *Update
- type VespaClient
Constants ¶
This section is empty.
Variables ¶
var ErrNoDoc = errors.New("no document found")
Functions ¶
This section is empty.
Types ¶
type DocumentId ¶
func (DocumentId) String ¶
func (i DocumentId) String() string
type Get ¶
type Get struct {
// contains filtered or unexported fields
}
func (*Get) AddParameter ¶
func (r *Get) AddParameter(p GetParameter) *Get
type GetParameter ¶
type GetParameter struct {
// contains filtered or unexported fields
}
type GetResponse ¶
type NewClientParams ¶
type OperationalParams ¶
type OperationalParams struct {
// contains filtered or unexported fields
}
type Put ¶
type Put struct {
// contains filtered or unexported fields
}
func (*Put) AddParameter ¶
func (p *Put) AddParameter(param OperationalParams) *Put
func (*Put) BindStruct ¶
BindStruct adds all values of the struct with the tag `vespa:"field_name"` to the fields object of the Put Request. use `vespa:"-" to exclude the value in the fields object`. Empty fields are ignored.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) AddParameter ¶
func (q *Query) AddParameter(p QueryParameter) *Query
func (*Query) AddVariable ¶
AddVariables can be used to add any kind of key/value pair to the query. For example, AddVariable("ranking", "rank_albums") would select "rank_albums" as the Ranking Profile.
func (*Query) Exec ¶
func (q *Query) Exec() (QueryResponse, error)
Exec runs the Query but doesn't scan the fields of the result into a destination.
func (*Query) Get ¶
func (q *Query) Get(dest any) (QueryResponse, error)
Get scans the fields of the first result/children into a destination. The destination needs to be a pointer to a struct which fields are annotated with the "vespa" Tag.
type QueryParameter ¶
type QueryParameter struct { Offset uint64 Hits uint32 QueryProfile string GroupingSessionCache *bool SearchChain string Timeout time.Duration }
groupingSessionCache is a pointer so that we can distinguish between true/false/not defined
type QueryResponse ¶
type QueryResponse struct {
Root Root `json:"root"`
}
type Remove ¶
type Remove struct {
// contains filtered or unexported fields
}
func (*Remove) AddParameter ¶
func (r *Remove) AddParameter(p RemoveParams) *Remove
type RemoveParams ¶
type RemoveParams struct {
// contains filtered or unexported fields
}
type Root ¶
type Root struct { Id string `json:"id,omitempty"` Relevance float64 `json:"relevance"` Label string `json:"label,omitempty"` Source string `json:"source,omitempty"` Value string `json:"value,omitempty"` Types []string `json:"types,omitempty"` Children []children `json:"children"` Fields fields `json:"fields"` Coverage coverage `json:"coverage"` Limits limits `json:"limits"` Errors []vespaError `json:"errors,omitempty"` }
type Update ¶
type Update struct {
// contains filtered or unexported fields
}
func (*Update) AddParameter ¶
func (u *Update) AddParameter(p OperationalParams) *Update
func (*Update) AddWeightedSet ¶
Adds a Weighted Set to a field. The weight can either be an Interger or a String. See documentation https://docs.vespa.ai/en/reference/document-json-format.html#add
func (*Update) Match ¶
Can be used to do an operation on a specific element in a weighted set or array. See https://docs.vespa.ai/en/reference/document-json-format.html#match
func (*Update) Remove ¶
Remove can be used to remove an element from a map. See https://docs.vespa.ai/en/reference/document-json-format.html#composite-remove
func (*Update) RemoveWeightedSet ¶
type VespaClient ¶
type VespaClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(params NewClientParams) *VespaClient
func (*VespaClient) Get ¶
func (v *VespaClient) Get(docId DocumentId) *Get
func (*VespaClient) Put ¶
func (v *VespaClient) Put(docId DocumentId) *Put
func (*VespaClient) Query ¶
func (v *VespaClient) Query() *Query
func (*VespaClient) Remove ¶
func (v *VespaClient) Remove(docId DocumentId) *Remove
func (*VespaClient) Update ¶
func (v *VespaClient) Update(docId DocumentId) *Update