Documentation
¶
Index ¶
- func AddStoredQueryToCache(query ESStoredQueryDOC) error
- func DeleteStoredQueryToCache(id string) bool
- func FromContext(ctx context.Context) ([]string, error)
- func NewContext(ctx context.Context, storedqueries []string) context.Context
- func SetStoredQueriesToCache(queries []ESStoredQueryDOC) error
- type CacheSyncScript
- type ESStoredQueryCached
- type ESStoredQueryDOC
- type ESStoredQueryGET
- type ESStoredQueryRequest
- type ESStoredQueryRequestBody
- type ExecuteQueryRequestBody
- type ExecuteQueryRequestBodyID
- type StoredQuery
- type ValidateQueryRequestBody
- type ValidateQueryRequestBodyID
- type ValidateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddStoredQueryToCache ¶
func AddStoredQueryToCache(query ESStoredQueryDOC) error
AddStoredQueryToCache adds a query to cache
func DeleteStoredQueryToCache ¶
DeleteStoredQueryToCache deletes a query from cache
func FromContext ¶
FromContext retrieves the storedqueries against the ctxKey from the context.
func NewContext ¶
NewContext returns a new context with the given request body.
func SetStoredQueriesToCache ¶
func SetStoredQueriesToCache(queries []ESStoredQueryDOC) error
SetStoredQueriesToCache sets the queries
Types ¶
type CacheSyncScript ¶
type CacheSyncScript struct {
// contains filtered or unexported fields
}
func (CacheSyncScript) Index ¶
func (s CacheSyncScript) Index() string
func (CacheSyncScript) PluginName ¶
func (s CacheSyncScript) PluginName() string
func (CacheSyncScript) SetCache ¶
func (s CacheSyncScript) SetCache(response *elastic.SearchResult) error
type ESStoredQueryCached ¶
type ESStoredQueryCached struct {
ID *string `json:"id,omitempty"`
Index *string `json:"index,omitempty"`
Description *string `json:"description,omitempty"`
Query *interface{} `json:"query,omitempty"`
QueryInBytes []byte `json:"queryInBytes,omitempty"`
Params *map[string]interface{} `json:"params,omitempty"`
CreatedAt *int64 `json:"created_at,omitempty"`
UpdatedAt *int64 `json:"updated_at,omitempty"`
}
func GetStoredQueriesFromCache ¶
func GetStoredQueriesFromCache() []ESStoredQueryCached
GetStoredQueriesFromCache returns a list of cached stored queries
func GetStoredQueryFromCache ¶
func GetStoredQueryFromCache(id string) *ESStoredQueryCached
GetStoredQueryFromCache returns a stored query by ID
func IsStoredQueryExistsInCache ¶
func IsStoredQueryExistsInCache(id string) (*ESStoredQueryCached, *int)
IsStoredQueryExistsInCache checks if a query is present in cache
type ESStoredQueryDOC ¶
type ESStoredQueryDOC struct {
ID *string `json:"id,omitempty"`
Index *string `json:"index,omitempty"`
Description *string `json:"description,omitempty"`
Query *string `json:"query,omitempty"`
Params *map[string]interface{} `json:"params,omitempty"`
CreatedAt *int64 `json:"created_at,omitempty"`
UpdatedAt *int64 `json:"updated_at,omitempty"`
}
ESStoredQueryDOC represents the shape of a stored query doc stored in ES
type ESStoredQueryGET ¶
type ESStoredQueryGET struct {
ID *string `json:"id,omitempty"`
Index *string `json:"index,omitempty"`
Description *string `json:"description,omitempty"`
Query *interface{} `json:"query,omitempty"`
Params *map[string]interface{} `json:"params,omitempty"`
CreatedAt *int64 `json:"created_at,omitempty"`
UpdatedAt *int64 `json:"updated_at,omitempty"`
}
type ESStoredQueryRequest ¶
type ESStoredQueryRequest struct {
ID *string `json:"id,omitempty"`
Index *string `json:"index,omitempty"`
Description *string `json:"description,omitempty"`
Query *string `json:"query,omitempty"`
Params *map[string]interface{} `json:"params,omitempty"`
}
ESStoredQueryRequest represents the request body for PUT stored query route
type ESStoredQueryRequestBody ¶
type ESStoredQueryRequestBody struct {
Index *string `json:"index,omitempty"`
Description *string `json:"description,omitempty"`
Query *interface{} `json:"query,omitempty"`
Params *map[string]interface{} `json:"params,omitempty"`
}
ESStoredQueryRequestBody represents the shape of the request body for stored query
type ExecuteQueryRequestBody ¶
type ExecuteQueryRequestBodyID ¶
type ExecuteQueryRequestBodyID struct {
Params *map[string]interface{} `json:"params,omitempty"`
}
type StoredQuery ¶
type StoredQuery struct {
// contains filtered or unexported fields
}
StoredQuery plugin deals with managing query templates.
func Instance ¶
func Instance() *StoredQuery
Instance returns the singleton instance of the plugin. Instance should be the only way (both within or outside the package) to fetch the instance of the plugin, in order to avoid stateless duplicates.
func (*StoredQuery) AlternateRoutes ¶
func (r *StoredQuery) AlternateRoutes() []plugins.Route
Expose plugin specific routes
func (*StoredQuery) ESMiddleware ¶
func (r *StoredQuery) ESMiddleware() []middleware.Middleware
func (*StoredQuery) InitFunc ¶
func (s *StoredQuery) InitFunc() error
InitFunc initializes the dao, i.e. elasticsearch client, and should be executed only once in the lifetime of the plugin.
func (*StoredQuery) Name ¶
func (s *StoredQuery) Name() string
Name returns the name of the plugin: storedquery
func (*StoredQuery) RSMiddleware ¶
func (r *StoredQuery) RSMiddleware() []middleware.Middleware
func (*StoredQuery) Routes ¶
func (r *StoredQuery) Routes() []plugins.Route
Routes returns an empty slices since the plugin solely acts as a middleware.
type ValidateQueryRequestBody ¶
type ValidateQueryRequestBody struct {
Query *interface{} `json:"query,omitempty"`
Params *map[string]interface{} `json:"params,omitempty"`
}
type ValidateQueryRequestBodyID ¶
type ValidateQueryRequestBodyID struct {
Params *map[string]interface{} `json:"params,omitempty"`
}
type ValidateResponse ¶
type ValidateResponse struct {
Valid bool `json:"valid"`
}