queryhistory

package
v0.0.0-...-fb7f86c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrQueryNotFound        = errors.New("query in query history not found")
	ErrStarredQueryNotFound = errors.New("starred query not found")
	ErrQueryAlreadyStarred  = errors.New("query was already starred")
)

Functions

This section is empty.

Types

type CreateQueryInQueryHistoryCommand

type CreateQueryInQueryHistoryCommand struct {
	// UID of the data source for which are queries stored.
	// example: PE1C5CBDA0504A6A3
	DatasourceUID string `json:"datasourceUid"`
	// The JSON model of queries.
	// required: true
	Queries *simplejson.Json `json:"queries"`
}

CreateQueryInQueryHistoryCommand is the command for adding query history swagger:model

type CreateQueryParams

type CreateQueryParams struct {
	// in:body
	// required:true
	Body CreateQueryInQueryHistoryCommand `json:"body"`
}

swagger:parameters createQuery

type GetQueryHistoryDeleteQueryResponse

type GetQueryHistoryDeleteQueryResponse struct {
	// in: body
	Body QueryHistoryDeleteQueryResponse `json:"body"`
}

swagger:response getQueryHistoryDeleteQueryResponse

type GetQueryHistoryResponse

type GetQueryHistoryResponse struct {
	// in: body
	Body QueryHistoryResponse `json:"body"`
}

swagger:response getQueryHistoryResponse

type GetQueryHistorySearchResponse

type GetQueryHistorySearchResponse struct {
	// in: body
	Body QueryHistorySearchResponse `json:"body"`
}

type PatchQueryCommentInQueryHistoryCommand

type PatchQueryCommentInQueryHistoryCommand struct {
	// Updated comment
	Comment string `json:"comment"`
}

PatchQueryCommentInQueryHistoryCommand is the command for updating comment for query in query history swagger:model

type PatchQueryCommentParams

type PatchQueryCommentParams struct {
	// in:body
	// required:true
	Body PatchQueryCommentInQueryHistoryCommand `json:"body"`
}

swagger:parameters patchQueryComment

type QueryHistory

type QueryHistory struct {
	ID            int64  `xorm:"pk autoincr 'id'"`
	UID           string `xorm:"uid"`
	DatasourceUID string `xorm:"datasource_uid"`
	OrgID         int64  `xorm:"org_id"`
	CreatedBy     int64
	CreatedAt     int64
	Comment       string
	Queries       *simplejson.Json
}

QueryHistory is the model for query history definitions

type QueryHistoryByUID

type QueryHistoryByUID struct {
	// in:path
	// required:true
	UID string `json:"query_history_uid"`
}

swagger:parameters starQuery patchQueryComment deleteQuery unstarQuery

type QueryHistoryDTO

type QueryHistoryDTO struct {
	UID           string           `json:"uid" xorm:"uid"`
	DatasourceUID string           `json:"datasourceUid" xorm:"datasource_uid"`
	CreatedBy     int64            `json:"createdBy"`
	CreatedAt     int64            `json:"createdAt"`
	Comment       string           `json:"comment"`
	Queries       *simplejson.Json `json:"queries"`
	Starred       bool             `json:"starred"`
}

type QueryHistoryDeleteQueryResponse

type QueryHistoryDeleteQueryResponse struct {
	ID      int64  `json:"id"`
	Message string `json:"message"`
}

QueryHistoryDeleteQueryResponse is the response struct for deleting a query from query history

type QueryHistoryResponse

type QueryHistoryResponse struct {
	Result QueryHistoryDTO `json:"result"`
}

QueryHistoryResponse is a response struct for QueryHistoryDTO

type QueryHistorySearchResponse

type QueryHistorySearchResponse struct {
	Result QueryHistorySearchResult `json:"result"`
}

type QueryHistorySearchResult

type QueryHistorySearchResult struct {
	TotalCount   int               `json:"totalCount"`
	QueryHistory []QueryHistoryDTO `json:"queryHistory"`
	Page         int               `json:"page"`
	PerPage      int               `json:"perPage"`
}

type QueryHistoryService

type QueryHistoryService struct {
	Cfg           *setting.Cfg
	RouteRegister routing.RouteRegister
	// contains filtered or unexported fields
}

func ProvideService

func ProvideService(cfg *setting.Cfg, sqlStore db.DB, routeRegister routing.RouteRegister) *QueryHistoryService

func (QueryHistoryService) CreateQueryInQueryHistory

func (QueryHistoryService) DeleteQueryFromQueryHistory

func (s QueryHistoryService) DeleteQueryFromQueryHistory(ctx context.Context, user *user.SignedInUser, UID string) (int64, error)

func (QueryHistoryService) DeleteStaleQueriesInQueryHistory

func (s QueryHistoryService) DeleteStaleQueriesInQueryHistory(ctx context.Context, olderThan int64) (int, error)

func (QueryHistoryService) EnforceRowLimitInQueryHistory

func (s QueryHistoryService) EnforceRowLimitInQueryHistory(ctx context.Context, limit int, starredQueries bool) (int, error)

func (QueryHistoryService) PatchQueryCommentInQueryHistory

func (s QueryHistoryService) PatchQueryCommentInQueryHistory(ctx context.Context, user *user.SignedInUser, UID string, cmd PatchQueryCommentInQueryHistoryCommand) (QueryHistoryDTO, error)

func (QueryHistoryService) SearchInQueryHistory

func (QueryHistoryService) StarQueryInQueryHistory

func (s QueryHistoryService) StarQueryInQueryHistory(ctx context.Context, user *user.SignedInUser, UID string) (QueryHistoryDTO, error)

func (QueryHistoryService) UnstarQueryInQueryHistory

func (s QueryHistoryService) UnstarQueryInQueryHistory(ctx context.Context, user *user.SignedInUser, UID string) (QueryHistoryDTO, error)

type QueryHistoryStar

type QueryHistoryStar struct {
	ID       int64  `xorm:"pk autoincr 'id'"`
	QueryUID string `xorm:"query_uid"`
	UserID   int64  `xorm:"user_id"`
}

QueryHistory is the model for query history star definitions

type SearchInQueryHistoryQuery

type SearchInQueryHistoryQuery struct {
	DatasourceUIDs []string `json:"datasourceUids"`
	SearchString   string   `json:"searchString"`
	OnlyStarred    bool     `json:"onlyStarred"`
	Sort           string   `json:"sort"`
	Page           int      `json:"page"`
	Limit          int      `json:"limit"`
	From           int64    `json:"from"`
	To             int64    `json:"to"`
}

type SearchQueriesParams

type SearchQueriesParams struct {
	// List of data source UIDs to search for
	// in:query
	// required: false
	// type: array
	// collectionFormat: multi
	DatasourceUid []string `json:"datasourceUid"`
	// Text inside query or comments that is searched for
	// in:query
	// required: false
	SearchString string `json:"searchString"`
	// Flag indicating if only starred queries should be returned
	// in:query
	// required: false
	OnlyStarred bool `json:"onlyStarred"`
	// Sort method
	// in:query
	// required: false
	// default: time-desc
	// Enum: time-desc,time-asc
	Sort string `json:"sort"`
	// Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.
	// in:query
	// required: false
	Page int `json:"page"`
	// Limit the number of returned results
	// in:query
	// required: false
	Limit int `json:"limit"`
	// From range for the query history search
	// in:query
	// required: false
	From int64 `json:"from"`
	// To range for the query history search
	// in:query
	// required: false
	To int64 `json:"to"`
}

swagger:parameters searchQueries

type Service

type Service interface {
	CreateQueryInQueryHistory(ctx context.Context, user *user.SignedInUser, cmd CreateQueryInQueryHistoryCommand) (QueryHistoryDTO, error)
	SearchInQueryHistory(ctx context.Context, user *user.SignedInUser, query SearchInQueryHistoryQuery) (QueryHistorySearchResult, error)
	DeleteQueryFromQueryHistory(ctx context.Context, user *user.SignedInUser, UID string) (int64, error)
	PatchQueryCommentInQueryHistory(ctx context.Context, user *user.SignedInUser, UID string, cmd PatchQueryCommentInQueryHistoryCommand) (QueryHistoryDTO, error)
	StarQueryInQueryHistory(ctx context.Context, user *user.SignedInUser, UID string) (QueryHistoryDTO, error)
	UnstarQueryInQueryHistory(ctx context.Context, user *user.SignedInUser, UID string) (QueryHistoryDTO, error)
	DeleteStaleQueriesInQueryHistory(ctx context.Context, olderThan int64) (int, error)
	EnforceRowLimitInQueryHistory(ctx context.Context, limit int, starredQueries bool) (int, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL