sqlstore

package
v1.26.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const MySQLCharset = "DEFAULT CHARACTER SET utf8mb4"

Variables

This section is empty.

Functions

func LatestVersion

func LatestVersion() semver.Version

func NewChannelActionStore added in v1.26.0

func NewChannelActionStore(pluginAPI PluginAPIClient, log bot.Logger, sqlStore *SQLStore) app.ChannelActionStore

NewPlaybookStore creates a new store for playbook service.

func NewPlaybookRunStore

func NewPlaybookRunStore(pluginAPI PluginAPIClient, log bot.Logger, sqlStore *SQLStore) app.PlaybookRunStore

NewPlaybookRunStore creates a new store for playbook run ServiceImpl.

func NewPlaybookStore

func NewPlaybookStore(pluginAPI PluginAPIClient, log bot.Logger, sqlStore *SQLStore) app.PlaybookStore

NewPlaybookStore creates a new store for playbook service.

func NewUserInfoStore

func NewUserInfoStore(sqlStore *SQLStore) app.UserInfoStore

Types

type ConfigurationAPI

type ConfigurationAPI interface {
	GetConfig() *model.Config
}

type KVAPI

type KVAPI interface {
	Get(key string, out interface{}) error
}

KVAPI is the key value store interface for the pluginkv stores. It is implemented by mattermost-plugin-api/Client.KV, or by the mock KVAPI.

type Migration

type Migration struct {
	// contains filtered or unexported fields
}

type PluginAPIClient

type PluginAPIClient struct {
	Store         StoreAPI
	KV            KVAPI
	Configuration ConfigurationAPI
}

PluginAPIClient is the struct combining the interfaces defined above, which is everything from pluginapi that the store currently uses.

func NewClient

func NewClient(api *pluginapi.Client) PluginAPIClient

NewClient receives a pluginapi.Client and returns the PluginAPIClient, which is what the store will use to access pluginapi.Client.

type SQLStore

type SQLStore struct {
	// contains filtered or unexported fields
}

func New

func New(pluginAPI PluginAPIClient, log bot.Logger, scheduler app.JobOnceScheduler) (*SQLStore, error)

New constructs a new instance of SQLStore.

func (*SQLStore) GetCurrentVersion

func (sqlStore *SQLStore) GetCurrentVersion() (semver.Version, error)

func (*SQLStore) Migrate

func (sqlStore *SQLStore) Migrate(originalSchemaVersion semver.Version) error

func (*SQLStore) RunMigrations

func (sqlStore *SQLStore) RunMigrations() error

RunMigrations will run the migrations (if any). The caller should hold a cluster mutex if there is a danger of this being run on multiple servers at once.

func (*SQLStore) SetCurrentVersion

func (sqlStore *SQLStore) SetCurrentVersion(e queryExecer, currentVersion semver.Version) error

type StatsFilters

type StatsFilters struct {
	TeamID     string
	PlaybookID string
}

type StatsStore

type StatsStore struct {
	// contains filtered or unexported fields
}

func NewStatsStore

func NewStatsStore(pluginAPI PluginAPIClient, log bot.Logger, sqlStore *SQLStore) *StatsStore

func (*StatsStore) ActiveParticipantsPerDayLastXDays

func (s *StatsStore) ActiveParticipantsPerDayLastXDays(x int, filters *StatsFilters) ([]int, [][]int64)

ActiveParticipantsPerDayLastXDays returns the number of active participants per day for the last X days. Returns data in order of oldest day to most recent day.

func (*StatsStore) ActiveRunsPerDayLastXDays

func (s *StatsStore) ActiveRunsPerDayLastXDays(x int, filters *StatsFilters) ([]int, [][]int64)

ActiveRunsPerDayLastXDays returns the number of active runs per day for the last X days. Returns data in order of oldest day to most recent day.

func (*StatsStore) MetricOverallAverage

func (s *StatsStore) MetricOverallAverage(filters *StatsFilters) []int64

MetricOverallAverage returns list of average values of playbook's metrics. Only published metrics values are included. Returns empty list when Playbook doesn't have metrics or there are no any published metrics values

func (*StatsStore) MetricRollingAverageAndChange

func (s *StatsStore) MetricRollingAverageAndChange(x int, filters *StatsFilters) (metricRollingAverage []int64, metricRollingAverageChange []int64)

MetricRollingAverageAndChange for each metric returns average of last `x` published values and change with comparison to the previous period returns empty list if there are no available published metrics values

func (*StatsStore) MetricRollingValuesLastXRuns

func (s *StatsStore) MetricRollingValuesLastXRuns(x int, offset int, filters *StatsFilters) ([][]int64, []string)

MetricRollingValuesLastXRuns for each metric returns list of last `x` published values, starting from `offset` first element in the list is most recent. And returns the names of the last `x` runs. Retruns empty list if Playbook doesn't have metrics. Returns list with null values, if Playbook has metrics but there are no any published values

func (*StatsStore) MetricValueRange

func (s *StatsStore) MetricValueRange(filters *StatsFilters) [][]int64

MetricValueRange returns min and max values for each metric Only published metrics are included. If there are no any published values, returns empty list

func (*StatsStore) MovingWindowQueryActive

func (s *StatsStore) MovingWindowQueryActive(query sq.SelectBuilder, numDays int) ([]int, error)

Not efficient. One query per day.

func (*StatsStore) RunsFinishedBetweenDays

func (s *StatsStore) RunsFinishedBetweenDays(filters *StatsFilters, startDay, endDay int) int

RunsFinishedBetweenDays are calculated from startDay to endDay (inclusive), where "days" are "number of days ago". E.g., for the last 30 days, begin day would be 30 (days ago), end day would be 0 (days ago) (up until now).

func (*StatsStore) RunsStartedPerWeekLastXWeeks

func (s *StatsStore) RunsStartedPerWeekLastXWeeks(x int, filters *StatsFilters) ([]int, [][]int64)

RunsStartedPerWeekLastXWeeks returns the number of runs started each week for the last X weeks. Returns data in order of oldest week to most recent week.

func (*StatsStore) TotalActiveParticipants

func (s *StatsStore) TotalActiveParticipants(filters *StatsFilters) int

func (*StatsStore) TotalInProgressPlaybookRuns

func (s *StatsStore) TotalInProgressPlaybookRuns(filters *StatsFilters) int

type StoreAPI

type StoreAPI interface {
	GetMasterDB() (*sql.DB, error)
	DriverName() string
}

StoreAPI is the interface exposing the underlying database, provided by pluginapi It is implemented by mattermost-plugin-api/Client.Store, or by the mock StoreAPI.

Directories

Path Synopsis
Package mock_sqlstore is a generated GoMock package.
Package mock_sqlstore is a generated GoMock package.
Package mock_sqlstore is a generated GoMock package.
Package mock_sqlstore is a generated GoMock package.

Jump to

Keyboard shortcuts

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