gcpspanner

package
v0.0.0-...-ad2bff6 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 23 Imported by: 8

Documentation

Index

Constants

View Source
const LatestDailyChromiumHistogramMetricsTable = "LatestDailyChromiumHistogramMetrics"
View Source
const LatestWPTRunFeatureMetricsTable = "LatestWPTRunFeatureMetrics"
View Source
const WPTRunFeatureMetricTable = "WPTRunFeatureMetrics"

Variables

View Source
var (
	// ErrUsageMetricUpsertNoFeatureIDFound indicates that no web feature ID was found
	// when attempting to upsert a usage metric using the chromiumHistogramEnumValueID.
	// This typically occurs when there is no corresponding web feature associated with
	// the given chromiumHistogramEnumValueID.
	ErrUsageMetricUpsertNoFeatureIDFound = errors.New("no web feature id found when upserting usage metric")

	// ErrUsageMetricUpsertNoHistogramFound indicates that the chromium histogram metric
	// was not found when attempting to upsert a usage metric.
	ErrUsageMetricUpsertNoHistogramFound = errors.New("histogram not found when upserting usage metric")
)

DailyChromiumHistogramMetrics specific errors.

View Source
var (
	ErrSyncReadFailed                = errors.New("sync failed during read phase")
	ErrSyncMutationCreationFailed    = errors.New("sync failed to create mutation")
	ErrSyncAtomicWriteFailed         = errors.New("sync atomic write failed")
	ErrSyncBatchWriteFailed          = errors.New("sync batch write failed")
	ErrSyncFailedToGetChildMutations = errors.New("sync failed to get child mutations")
	ErrSyncFailedToGetPreDeleteHooks = errors.New("sync failed to get pre delete hooks")
)

entitySynchronizer specific errors.

View Source
var (
	ErrAlreadyLocked = errors.New("resource already locked by another worker")
	ErrLockNotOwned  = errors.New("cannot release lock not owned by worker")
)
View Source
var (
	// ErrUserSearchBookmarkLimitExceeded indicates that the user already has
	// reached the limit of saved searches that a given user can bookmark.
	ErrUserSearchBookmarkLimitExceeded = errors.New("user bookmark limit reached")
	// ErrOwnerCannotDeleteBookmark indicates that the user is the owner of the
	// saved search and cannot delete the bookmark.
	ErrOwnerCannotDeleteBookmark = errors.New("user is the owner of the saved search and cannot delete the bookmark")
)
View Source
var ErrBadClientConfig = errors.New("projectID, instanceID and name must not be empty")

ErrBadClientConfig indicates the the config to setup a Client is invalid.

View Source
var ErrFailedToEstablishClient = errors.New("failed to establish spanner client")

ErrFailedToEstablishClient indicates the spanner client failed to create.

View Source
var ErrInternalMutationFailure = errors.New("internal spanner mutation failure")

ErrInternalMutationFailure is a generic error for when a spanner mutation fails.

View Source
var ErrInternalQueryFailure = errors.New("internal spanner query failure")

ErrInternalQueryFailure is a catch-all error for now.

View Source
var ErrInvalidCursorFormat = errors.New("invalid cursor format")

ErrInvalidCursorFormat indicates the cursor is not the correct format.

View Source
var ErrMissingRequiredRole = errors.New("user is missing required role")

ErrMissingRequiredRole indicates that the user is missing the required role for the transaction.

View Source
var (
	ErrOwnerNotificationChannelLimitExceeded = errors.New("owner notification channel limit exceeded")
)

NotificationChannels specific errors.

View Source
var (
	// ErrOwnerSavedSearchLimitExceeded indicates that the user already has
	// reached the limit of saved searches that a given user can own.
	ErrOwnerSavedSearchLimitExceeded = errors.New("saved search limit reached")
)
View Source
var ErrQueryReturnedNoResults = errors.New("query returned no results")

ErrQueryReturnedNoResults indicates no results were returned.

View Source
var (
	// ErrSubscriptionLimitExceeded indicates that the user already has
	// reached the limit of subscriptions that a given user can own.
	ErrSubscriptionLimitExceeded = errors.New("subscription limit reached")
)

Functions

This section is empty.

Types

type AttemptDetails

type AttemptDetails struct {
	Message string `json:"message"`
	EventID string `json:"event_id"`
}

type BaseQueryTemplate

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

func NewQueryTemplate

func NewQueryTemplate(in string) BaseQueryTemplate

func (*BaseQueryTemplate) Execute

func (t *BaseQueryTemplate) Execute(data any) string

TODO: Pass in context to be used by slog.ErrorContext.

type BaselineDateType

type BaselineDateType string

BaselineDateType is an enum representing the type of date to use for baseline counts.

const (
	// BaselineDateTypeLow uses the LowDate from FeatureBaselineStatus.
	BaselineDateTypeLow BaselineDateType = "low"
)

type BaselineStatus

type BaselineStatus string

Options come from https://github.com/web-platform-dx/web-features/blob/3d4d066c47c9f07514bf743b3955572a6073ff1e/packages/web-features/README.md nolint: lll

const (
	BaselineStatusNone BaselineStatus = "none"
	BaselineStatusLow  BaselineStatus = "low"
	BaselineStatusHigh BaselineStatus = "high"
)

type BaselineStatusCountMetric

type BaselineStatusCountMetric struct {
	Date        time.Time `spanner:"Date"`
	StatusCount int64     `spanner:"StatusCount"`
}

BaselineStatusCountMetric represents a single data point in the baseline status count time series.

type BaselineStatusCountResultPage

type BaselineStatusCountResultPage struct {
	NextPageToken *string
	Metrics       []BaselineStatusCountMetric
}

BaselineStatusCountResultPage is a page of results for the baseline status count query.

type BrowserFeatureAvailability

type BrowserFeatureAvailability struct {
	BrowserName    string
	BrowserVersion string
}

BrowserFeatureAvailability contains availability information for a particular feature in a browser.

type BrowserFeatureCountCursor

type BrowserFeatureCountCursor struct {
	LastReleaseDate     time.Time `json:"last_release_date"`
	LastCumulativeCount int64     `json:"last_cumulative_count"`
}

BrowserFeatureCountCursor: Represents a point for resuming feature count queries. Designed for efficient pagination by storing the following:

  • LastReleaseDate: The release date of the last result from the previous page, used to continue fetching from the correct point.
  • LastCumulativeCount: The cumulative count of features up to (and including) the 'LastReleaseDate'. This eliminates the need to recalculate the count for prior pages.

type BrowserFeatureCountMetric

type BrowserFeatureCountMetric struct {
	ReleaseDate  time.Time `spanner:"ReleaseDate"`
	FeatureCount int64     `spanner:"FeatureCount"`
}

BrowserFeatureCountMetric contains a row of data returned by the feature count query.

type BrowserFeatureCountResultPage

type BrowserFeatureCountResultPage struct {
	NextPageToken *string
	Metrics       []BrowserFeatureCountMetric
}

type BrowserFeatureCountTemplateData

type BrowserFeatureCountTemplateData struct {
	BrowserFilter string
}

BrowserFeatureCountTemplateData contains the variables for the template query.

type BrowserFeatureSupportEvent

type BrowserFeatureSupportEvent struct {
	TargetBrowserName string                      `spanner:"TargetBrowserName"`
	EventBrowserName  string                      `spanner:"EventBrowserName"`
	EventReleaseDate  time.Time                   `spanner:"EventReleaseDate"`
	WebFeatureID      string                      `spanner:"WebFeatureID"`
	SupportStatus     BrowserFeatureSupportStatus `spanner:"SupportStatus"`
}

type BrowserFeatureSupportStatus

type BrowserFeatureSupportStatus string
const (
	UnsupportedFeatureSupport BrowserFeatureSupportStatus = "unsupported"
	SupportedFeatureSupport   BrowserFeatureSupportStatus = "supported"
)

type BrowserImplementationStatus

type BrowserImplementationStatus string

BrowserImplementationStatus is an enumeration of the possible implementation states for a feature in a browser.

const (
	Available   BrowserImplementationStatus = "available"
	Unavailable BrowserImplementationStatus = "unavailable"
)

type BrowserRelease

type BrowserRelease struct {
	BrowserName    string    `spanner:"BrowserName"`
	BrowserVersion string    `spanner:"BrowserVersion"`
	ReleaseDate    time.Time `spanner:"ReleaseDate"`
}

BrowserRelease contains information regarding a certain browser release.

type ChromeDailyUsageCursor

type ChromeDailyUsageCursor struct {
	LastDate civil.Date `json:"last_date"`
}

type ChromeDailyUsageStatWithDate

type ChromeDailyUsageStatWithDate struct {
	Date  civil.Date `spanner:"Date"`
	Usage *big.Rat   `spanner:"Usage"`
}

ChromeDailyUsageStatsWithDate contains usage stats for a feature at a given date.

type ChromeDailyUsageTemplateData

type ChromeDailyUsageTemplateData struct {
	PageFilter string
}

ChromeDailyUsageTemplateData contains the variables for getChromeDailyUsageBaseRawTemplate.

type ChromiumHistogramEnum

type ChromiumHistogramEnum struct {
	HistogramName string `spanner:"HistogramName"`
}

type ChromiumHistogramEnumValue

type ChromiumHistogramEnumValue struct {
	ChromiumHistogramEnumID string `spanner:"ChromiumHistogramEnumID"`
	BucketID                int64  `spanner:"BucketID"`
	Label                   string `spanner:"Label"`
}

type Client

type Client struct {
	*spanner.Client
	// contains filtered or unexported fields
}

Client is the client for interacting with GCP Spanner.

func NewSpannerClient

func NewSpannerClient(projectID string, instanceID string, name string) (*Client, error)

NewSpannerClient returns a Client for the Google Spanner service.

func (*Client) AddUserSearchBookmark

func (c *Client) AddUserSearchBookmark(ctx context.Context, req UserSavedSearchBookmark) error

func (*Client) CreateNewUserSavedSearch

func (c *Client) CreateNewUserSavedSearch(
	ctx context.Context,
	newSearch CreateUserSavedSearchRequest) (*string, error)

CreateNewUserSavedSearch creates a new user-owned saved search. It returns the ID of the newly created saved search if successful.

func (*Client) CreateNewUserSavedSearchWithUUID

func (c *Client) CreateNewUserSavedSearchWithUUID(
	ctx context.Context, newSearch CreateUserSavedSearchRequest, id string) (*string, error)

CreateNewUserSavedSearchWithUUID creates a new user-owned saved search with the given UUID. Useful for tests and utils. Typically, you should use CreateNewUserSavedSearch instead.

func (*Client) CreateNotificationChannel

func (c *Client) CreateNotificationChannel(
	ctx context.Context,
	req CreateNotificationChannelRequest,
) (*string, error)

CreateNotificationChannel creates a new notification channel.

func (*Client) CreateNotificationChannelDeliveryAttempt

func (c *Client) CreateNotificationChannelDeliveryAttempt(
	ctx context.Context, req CreateNotificationChannelDeliveryAttemptRequest) (*string, error)

CreateNotificationChannelDeliveryAttempt creates a new delivery attempt log, prunes old ones, and returns its ID.

func (*Client) CreateSavedSearchSubscription

func (c *Client) CreateSavedSearchSubscription(
	ctx context.Context,
	req CreateSavedSearchSubscriptionRequest,
) (*string, error)

CreateSavedSearchSubscription creates a new saved search subscription.

func (*Client) CreateSpannerWPTRunFeatureMetric

func (c *Client) CreateSpannerWPTRunFeatureMetric(
	webFeatureID string,
	wptRunData WPTRunDataForMetrics,
	in WPTRunFeatureMetric) SpannerWPTRunFeatureMetric

func (*Client) CreateSubscriptionWithUUID

func (c *Client) CreateSubscriptionWithUUID(
	ctx context.Context,
	req CreateSavedSearchSubscriptionRequest,
	uuid string,
) (*string, error)

CreateSubscriptionWithUUID creates a new saved search subscription with a specified UUID.

func (*Client) DeleteNotificationChannel

func (c *Client) DeleteNotificationChannel(
	ctx context.Context, channelID string, userID string) error

DeleteNotificationChannel deletes a notification channel if it belongs to the specified user.

func (*Client) DeleteSavedSearchSubscription

func (c *Client) DeleteSavedSearchSubscription(
	ctx context.Context, subscriptionID string, userID string) error

DeleteSavedSearchSubscription deletes a subscription if it belongs to the specified user.

func (*Client) DeleteSystemManagedSavedSearch

func (c *Client) DeleteSystemManagedSavedSearch(
	ctx context.Context,
	featureID string,
) error

DeleteSystemManagedSavedSearch deletes a system managed saved search.

func (*Client) DeleteUserSavedSearch

func (c *Client) DeleteUserSavedSearch(ctx context.Context, req DeleteUserSavedSearchRequest) error

DeleteUserSavedSearch deletes a user's saved search.

func (*Client) DeleteUserSearchBookmark

func (c *Client) DeleteUserSearchBookmark(ctx context.Context, req UserSavedSearchBookmark) error

func (*Client) FeaturesSearch

func (c *Client) FeaturesSearch(
	ctx context.Context,
	pageToken *string,
	pageSize int,
	searchNode *searchtypes.SearchNode,
	sortOrder Sortable,
	wptMetricView WPTMetricView,
	browsers []string,
) (*FeatureResultPage, error)

func (*Client) FetchAllFeatureKeys

func (c *Client) FetchAllFeatureKeys(ctx context.Context) ([]string, error)

func (*Client) FetchAllWebFeatureIDsAndKeys

func (c *Client) FetchAllWebFeatureIDsAndKeys(ctx context.Context) ([]SpannerFeatureIDAndKey, error)

func (*Client) FindAllActivePushSubscriptions

func (c *Client) FindAllActivePushSubscriptions(
	ctx context.Context,
	savedSearchID string,
	frequency SavedSearchSnapshotType,
) ([]SubscriberDestination, error)

FindAllActivePushSubscriptions Finds all active subscriptions for the given Search + Frequency AND joins them with their NotificationChannel to get the delivery address. It also filters out channels that have been disabled by the system (Health Status).

func (*Client) GetAllLatestFeatureDeveloperSignals

func (c *Client) GetAllLatestFeatureDeveloperSignals(ctx context.Context) ([]FeatureDeveloperSignal, error)

func (*Client) GetAllMovedWebFeatures

func (c *Client) GetAllMovedWebFeatures(ctx context.Context) ([]MovedWebFeature, error)

func (*Client) GetFeature

func (c *Client) GetFeature(
	ctx context.Context,
	filter Filterable,
	wptMetricView WPTMetricView,
	browsers []string,
) (*FeatureResult, error)

func (*Client) GetGroupIDFromGroupKey

func (c *Client) GetGroupIDFromGroupKey(ctx context.Context, groupKey string) (*string, error)

func (*Client) GetIDFromChromiumHistogramEnumValueKey

func (c *Client) GetIDFromChromiumHistogramEnumValueKey(
	ctx context.Context, chromiumHistogramEnumID string, bucketID int64) (*string, error)

func (*Client) GetIDFromChromiumHistogramKey

func (c *Client) GetIDFromChromiumHistogramKey(
	ctx context.Context, histogramName string) (*string, error)

func (*Client) GetIDFromFeatureKey

func (c *Client) GetIDFromFeatureKey(ctx context.Context, filter *FeatureIDFilter) (*string, error)

func (*Client) GetLatestSavedSearchNotificationEvent

func (c *Client) GetLatestSavedSearchNotificationEvent(
	ctx context.Context, savedSearchID string,
	snapshotType SavedSearchSnapshotType) (*SavedSearchNotificationEvent, error)

func (*Client) GetMovedWebFeatureDetailsByOriginalFeatureKey

func (c *Client) GetMovedWebFeatureDetailsByOriginalFeatureKey(
	ctx context.Context, originalFeatureKey string) (*MovedWebFeature, error)

GetMovedWebFeatureDetailsByOriginalFeatureKey returns the details about the moved feature. If details are not found for the feature key, it returns ErrQueryReturnedNoResults. Other errors should be investigated and handled appropriately.

func (*Client) GetNotificationChannel

func (c *Client) GetNotificationChannel(
	ctx context.Context, channelID string, userID string) (*NotificationChannel, error)

GetNotificationChannel retrieves a notification channel if it belongs to the specified user.

func (*Client) GetNotificationChannelDeliveryAttempt

func (c *Client) GetNotificationChannelDeliveryAttempt(
	ctx context.Context, attemptID string, channelID string) (*NotificationChannelDeliveryAttempt, error)

GetNotificationChannelDeliveryAttempt retrieves a single delivery attempt.

func (*Client) GetNotificationChannelState

func (c *Client) GetNotificationChannelState(
	ctx context.Context, channelID string) (*NotificationChannelState, error)

GetNotificationChannelState retrieves a notification channel state by its ID.

func (*Client) GetSavedSearch

func (c *Client) GetSavedSearch(ctx context.Context, id string) (*SavedSearch, error)

GetSavedSearch retrieves a saved search by its ID.

func (*Client) GetSavedSearchNotificationEvent

func (c *Client) GetSavedSearchNotificationEvent(
	ctx context.Context, eventID string) (*SavedSearchNotificationEvent, error)

func (*Client) GetSavedSearchState

func (c *Client) GetSavedSearchState(
	ctx context.Context,
	savedSearchID string,
	snapshotType SavedSearchSnapshotType) (*SavedSearchState, error)

GetSavedSearchState retrieves the SavedSearchState for the given saved search and snapshot type. If no such row exists, ErrQueryReturnedNoResults is returned.

func (*Client) GetSavedSearchSubscription

func (c *Client) GetSavedSearchSubscription(
	ctx context.Context, subscriptionID string, userID string) (*SavedSearchSubscriptionView, error)

GetSavedSearchSubscription retrieves a subscription if it belongs to the specified user.

func (*Client) GetSnapshotIDFromSnapshotKey

func (c *Client) GetSnapshotIDFromSnapshotKey(ctx context.Context, snapshotKey string) (*string, error)

func (*Client) GetSplitWebFeatureByOriginalFeatureKey

func (c *Client) GetSplitWebFeatureByOriginalFeatureKey(
	ctx context.Context, featureKey string) (*SplitWebFeature, error)

GetSplitWebFeatureByOriginalFeatureKey returns the details about the split feature. If details are not found for the feature key, it returns ErrQueryReturnedNoResults. Other errors should be investigated and handled appropriately.

func (*Client) GetSystemManagedSavedSearchByFeatureID

func (c *Client) GetSystemManagedSavedSearchByFeatureID(
	ctx context.Context,
	featureID string,
) (*SystemManagedSavedSearch, error)

func (*Client) GetUserSavedSearch

func (c *Client) GetUserSavedSearch(
	ctx context.Context,
	savedSearchID string,
	authenticatedUserID *string) (*UserSavedSearch, error)

GetUserSavedSearch returns a single user saved search by its id. If the user is authenticated, it will also return their role and bookmark status.

func (*Client) GetWPTRunDataByRunIDForMetrics

func (c *Client) GetWPTRunDataByRunIDForMetrics(ctx context.Context, runID int64) (*WPTRunDataForMetrics, error)

GetWPTRunDataByRunIDForMetrics is a helper function to help get a subsection of the WPT Run information. This information will be used to create the WPT Run metrics.

func (*Client) GetWebFeatureByID

func (c *Client) GetWebFeatureByID(ctx context.Context, id string) (*SpannerWebFeature, error)

func (*Client) HasDailyChromiumHistogramCapstone

func (c *Client) HasDailyChromiumHistogramCapstone(
	ctx context.Context, in DailyChromiumHistogramEnumCapstone) (*bool, error)

func (*Client) InsertBrowserRelease

func (c *Client) InsertBrowserRelease(ctx context.Context, release BrowserRelease) error

InsertBrowserRelease will insert the given browser release.

func (*Client) InsertWPTRun

func (c *Client) InsertWPTRun(ctx context.Context, run WPTRun) error

InsertWPTRun will insert the given WPT Run.

func (*Client) ListAllSavedSearches

func (c *Client) ListAllSavedSearches(
	ctx context.Context) ([]SavedSearchBriefDetails, error)

Used by the Cloud Scheduler batch job to find all entities to process.

func (*Client) ListAllSystemManagedSavedSearches

func (c *Client) ListAllSystemManagedSavedSearches(
	ctx context.Context) ([]SystemManagedSavedSearch, error)

ListAllSystemManagedSavedSearches returns all system managed saved searches.

func (*Client) ListBaselineStatusCounts

func (c *Client) ListBaselineStatusCounts(
	ctx context.Context,
	dateType BaselineDateType,
	startAt time.Time,
	endAt time.Time,
	pageSize int,
	pageToken *string,
) (*BaselineStatusCountResultPage, error)

ListBaselineStatusCounts retrieves a cumulative count of baseline features over time.

func (*Client) ListBrowserFeatureCountMetric

func (c *Client) ListBrowserFeatureCountMetric(
	ctx context.Context,
	targetBrowser string,
	targetMobileBrowser *string,
	startAt time.Time,
	endAt time.Time,
	pageSize int,
	pageToken *string,
) (*BrowserFeatureCountResultPage, error)

func (*Client) ListChromeDailyUsageStatsForFeatureID

func (c *Client) ListChromeDailyUsageStatsForFeatureID(
	ctx context.Context,
	featureKey string,
	startAt time.Time,
	endAt time.Time,
	pageSize int,
	pageToken *string,
) ([]ChromeDailyUsageStatWithDate, *string, error)

nolint: revive

func (*Client) ListMetricsForFeatureIDBrowserAndChannel

func (c *Client) ListMetricsForFeatureIDBrowserAndChannel(
	ctx context.Context,
	featureKey string,
	browser string,
	channel string,
	metric WPTMetricView,
	startAt time.Time,
	endAt time.Time,
	pageSize int,
	pageToken *string,
) ([]WPTRunFeatureMetricWithTime, *string, error)

ListMetricsForFeatureIDBrowserAndChannel attempts to return a page of metrics based on a web feature key, browser name and channel. A time window must be specified to analyze the runs according to the TimeStart of the run. If the page size matches the pageSize, a page token is returned. Else, no page token is returned.

func (*Client) ListMetricsOverTimeWithAggregatedTotals

func (c *Client) ListMetricsOverTimeWithAggregatedTotals(
	ctx context.Context,
	featureKeys []string,
	browser string,
	channel string,
	metric WPTMetricView,
	startAt, endAt time.Time,
	pageSize int,
	pageToken *string,
) ([]WPTRunAggregationMetricWithTime, *string, error)

ListMetricsOverTimeWithAggregatedTotals attempts to return a page of metrics based on browser name and channel. Users can provide a list of web feature keys. If the list is provided, the aggregation will be scoped to those feature keys. If an empty or nil list is provided, the aggregation is applied to all features. A time window must be specified to analyze the runs according to the TimeStart of the run. If the page size matches the pageSize, a page token is returned. Else, no page token is returned.

func (*Client) ListMissingOneImplCounts

func (c *Client) ListMissingOneImplCounts(
	ctx context.Context,
	targetBrowser string,
	targetMobileBrowser *string,
	otherBrowsers []string,
	startAt time.Time,
	endAt time.Time,
	pageSize int,
	pageToken *string,
) (*MissingOneImplCountPage, error)

func (*Client) ListMissingOneImplementationFeatures

func (c *Client) ListMissingOneImplementationFeatures(
	ctx context.Context,
	targetBrowser string,
	targetMobileBrowser *string,
	otherBrowsers []string,
	targetDate time.Time,
	pageSize int,
	pageToken *string,
) (*MissingOneImplFeatureListPage, error)

func (*Client) ListNotificationChannelDeliveryAttempts

func (c *Client) ListNotificationChannelDeliveryAttempts(
	ctx context.Context,
	req ListNotificationChannelDeliveryAttemptsRequest,
) ([]NotificationChannelDeliveryAttempt, *string, error)

ListNotificationChannelDeliveryAttempts lists all delivery attempts for a channel.

func (*Client) ListNotificationChannels

func (c *Client) ListNotificationChannels(
	ctx context.Context, req ListNotificationChannelsRequest) ([]NotificationChannel, *string, error)

ListNotificationChannels lists all notification channels for a user.

func (*Client) ListSavedSearchSubscriptions

func (c *Client) ListSavedSearchSubscriptions(
	ctx context.Context, req ListSavedSearchSubscriptionsRequest) ([]SavedSearchSubscriptionView, *string, error)

ListSavedSearchSubscriptions retrieves a list of subscriptions for a user with pagination.

func (*Client) ListSubscriptionsBySavedSearchID

func (c *Client) ListSubscriptionsBySavedSearchID(
	ctx context.Context,
	savedSearchID string,
) ([]SavedSearchSubscription, error)

func (*Client) ListSystemManagedSavedSearchesByFeatureIDs

func (c *Client) ListSystemManagedSavedSearchesByFeatureIDs(
	ctx context.Context,
	featureIDs []string,
) ([]SystemManagedSavedSearch, error)

ListSystemManagedSavedSearchesByFeatureIDs returns the mappings for the given feature IDs. It processes the IDs in chunks to stay well within Spanner statement size limits.

func (*Client) ListUserSavedSearches

func (c *Client) ListUserSavedSearches(
	ctx context.Context,
	userID string,
	pageSize int,
	pageToken *string) (*UserSavedSearchesPage, error)

TODO: Change signature to take ListUserSavedSearchesRequest.

func (*Client) PrecalculateBrowserFeatureSupportEvents

func (c *Client) PrecalculateBrowserFeatureSupportEvents(ctx context.Context, startAt, endAt time.Time) error

PrecalculateBrowserFeatureSupportEvents populates the BrowserFeatureSupportEvents table with pre-calculated data.

func (*Client) PublishSavedSearchNotificationEvent

func (c *Client) PublishSavedSearchNotificationEvent(ctx context.Context,
	event SavedSearchNotificationCreateRequest, newStatePath, workerID string, opts ...CreateOption) (*string, error)

PublishSavedSearchNotificationEvent records a new saved search notification event. This saves the event and updates the state pointer, but explicitly KEEPS the lock. The worker is expected to call ReleaseLock via defer.

func (*Client) RecordNotificationChannelFailure

func (c *Client) RecordNotificationChannelFailure(
	ctx context.Context, channelID string, errorMsg string, timestamp time.Time,
	isPermanent bool, eventID string) error

RecordNotificationChannelFailure increments the consecutive failures count in the NotificationChannelStates table and logs a failure delivery attempt in the NotificationChannelDeliveryAttempts table. If isPermanent is true, it increments the failure count and potentially disables the channel. If isPermanent is false (transient), it logs the error but does not penalize the channel health.

func (*Client) RecordNotificationChannelSuccess

func (c *Client) RecordNotificationChannelSuccess(
	ctx context.Context, channelID string, timestamp time.Time, eventID string) error

RecordNotificationChannelSuccess resets the consecutive failures count in the NotificationChannelStates table and logs a successful delivery attempt in the NotificationChannelDeliveryAttempts table.

func (*Client) ReleaseSavedSearchStateWorkerLock

func (c *Client) ReleaseSavedSearchStateWorkerLock(
	ctx context.Context,
	savedSearchID string,
	snapshotType SavedSearchSnapshotType,
	workerID string) error

ReleaseSavedSearchStateWorkerLock releases the worker lock for the given saved search and snapshot type. The caller must own the lock. If not, ErrLockNotOwned is returned.

func (*Client) SetFeatureSearchBaseQuery

func (c *Client) SetFeatureSearchBaseQuery(query FeatureSearchBaseQuery)

func (*Client) SetMisingOneImplementationQuery

func (c *Client) SetMisingOneImplementationQuery(query MissingOneImplementationQuery)

func (*Client) StoreDailyChromiumHistogramMetrics

func (c *Client) StoreDailyChromiumHistogramMetrics(
	ctx context.Context,
	histogramName metricdatatypes.HistogramName,
	metrics map[int64]DailyChromiumHistogramMetric) error

StoreDailyChromiumHistogramMetrics stores a slice of daily chromium histogram metrics in a bulk insert.

func (*Client) SyncBrowserFeatureAvailabilities

func (c *Client) SyncBrowserFeatureAvailabilities(
	ctx context.Context,
	availabilities map[string][]BrowserFeatureAvailability,
) error

SyncBrowserFeatureAvailabilities reconciles the BrowserFeatureAvailabilities table with the provided list of availabilities.

func (*Client) SyncChromiumHistogramEnumValues

func (c *Client) SyncChromiumHistogramEnumValues(ctx context.Context, in []ChromiumHistogramEnumValue) error

func (*Client) SyncLatestDailyChromiumHistogramMetrics

func (c *Client) SyncLatestDailyChromiumHistogramMetrics(ctx context.Context) error

SyncLatestDailyChromiumHistogramMetrics reconciles the LatestDailyChromiumHistogramMetrics table.

func (*Client) SyncLatestFeatureDeveloperSignals

func (c *Client) SyncLatestFeatureDeveloperSignals(ctx context.Context, input []FeatureDeveloperSignal) error

func (*Client) SyncMovedWebFeatures

func (c *Client) SyncMovedWebFeatures(ctx context.Context, movedWebFeatures []MovedWebFeature) error

SyncMovedWebFeatures reconciles the MovedWebFeatures table with the provided list of features. It will insert new details for moved web features, update existing ones, and delete any moved web features that are no longer present in the provided list.

func (*Client) SyncSplitWebFeatures

func (c *Client) SyncSplitWebFeatures(ctx context.Context, splitWebFeatures []SplitWebFeature) error

SyncSplitWebFeatures reconciles the SplitWebFeatures table with the provided list of features. It will insert new details for split web features, update existing ones, and delete any split web features that are in the database but not in the provided list.

func (*Client) SyncSystemManagedSavedQuery

func (c *Client) SyncSystemManagedSavedQuery(ctx context.Context) error

SyncSystemManagedSavedQuery ensures that every WebFeature has a corresponding system-managed saved search. It also updates existing searches if the feature key has changed and removes searches for deleted features.

func (*Client) SyncUserProfileInfo

func (c *Client) SyncUserProfileInfo(
	ctx context.Context, userProfile UserProfile) error

func (*Client) SyncWebFeatureChromiumHistogramEnumValues

func (c *Client) SyncWebFeatureChromiumHistogramEnumValues(
	ctx context.Context,
	in []WebFeatureChromiumHistogramEnumValue,
) error

func (*Client) SyncWebFeatures

func (c *Client) SyncWebFeatures(
	ctx context.Context,
	features []WebFeature,
	opts ...SyncWebFeaturesOption,
) error

SyncWebFeatures reconciles the WebFeatures table with the provided list of features. It will insert new features, update existing ones, and delete any features that are in the database but not in the provided list.

func (*Client) SyncWebFeaturesMappingData

func (c *Client) SyncWebFeaturesMappingData(
	ctx context.Context,
	data []WebFeaturesMappingData,
) error

SyncWebFeaturesMappingData syncs the web features mapping data.

func (*Client) TryAcquireSavedSearchStateWorkerLock

func (c *Client) TryAcquireSavedSearchStateWorkerLock(
	ctx context.Context,
	savedSearchID string,
	snapshotType SavedSearchSnapshotType,
	workerID string,
	ttl time.Duration) (bool, error)

TryAcquireSavedSearchStateWorkerLock attempts to acquire a worker lock for the given saved search and snapshot type. If the lock is already held by another worker and is still active, ErrAlreadyLocked is returned. A caller can re-acquire a lock it already holds it (thereby extending the expiration).

func (*Client) UpdateNotificationChannel

func (c *Client) UpdateNotificationChannel(
	ctx context.Context, req UpdateNotificationChannelRequest) error

UpdateNotificationChannel updates a notification channel if it belongs to the specified user.

func (*Client) UpdateSavedSearchStateLastKnownStateBlobPath

func (c *Client) UpdateSavedSearchStateLastKnownStateBlobPath(
	ctx context.Context,
	savedSearchID string,
	snapshotType SavedSearchSnapshotType,
	blobPath string) error

UpdateSavedSearchStateLastKnownStateBlobPath updates the LastKnownStateBlobPath for the given saved search and snapshot type. The row must already exist. Else, ErrQueryReturnedNoResults is returned.

func (*Client) UpdateSavedSearchSubscription

func (c *Client) UpdateSavedSearchSubscription(
	ctx context.Context, req UpdateSavedSearchSubscriptionRequest) error

UpdateSavedSearchSubscription updates a subscription if it belongs to the specified user.

func (*Client) UpdateUserSavedSearch

func (c *Client) UpdateUserSavedSearch(ctx context.Context, req UpdateSavedSearchRequest) error

func (*Client) UpsertChromiumHistogramEnum

func (c *Client) UpsertChromiumHistogramEnum(
	ctx context.Context,
	histogram ChromiumHistogramEnum,
) (*string, error)

func (*Client) UpsertDailyChromiumHistogramCapstone

func (c *Client) UpsertDailyChromiumHistogramCapstone(
	ctx context.Context, in DailyChromiumHistogramEnumCapstone) error

func (*Client) UpsertFeatureBaselineStatus

func (c *Client) UpsertFeatureBaselineStatus(ctx context.Context,
	featureKey string, input FeatureBaselineStatus) error

UpsertWebFeature will update the given baseline status. If the status, does not exist, it will insert a new status. If the status exists, it will allow updates to the status, low date and high date.

func (*Client) UpsertFeatureDiscouragedDetails

func (c *Client) UpsertFeatureDiscouragedDetails(
	ctx context.Context, featureID string, in FeatureDiscouragedDetails) error

func (*Client) UpsertFeatureGroupLookups

func (c *Client) UpsertFeatureGroupLookups(
	ctx context.Context, featureKeyToGroupsMapping map[string][]string,
	childGroupKeyToParentGroupKey map[string]string) error

func (*Client) UpsertFeatureSpec

func (c *Client) UpsertFeatureSpec(
	ctx context.Context,
	webFeatureID string,
	input FeatureSpec) error

InsertFeatureSpec will insert the given feature spec information. If the spec info, does not exist, it will insert a new spec info. If the spec info exists, it currently overwrites the data.

func (*Client) UpsertGroup

func (c *Client) UpsertGroup(ctx context.Context, group Group) (*string, error)

UpsertGroup inserts or updates a Group.

func (*Client) UpsertNotificationChannelState

func (c *Client) UpsertNotificationChannelState(
	ctx context.Context, state NotificationChannelState) error

UpsertNotificationChannelState inserts or updates a notification channel state.

func (*Client) UpsertSnapshot

func (c *Client) UpsertSnapshot(ctx context.Context, snapshot Snapshot) (*string, error)

UpsertSnapshot inserts or updates a Snapshot.

func (*Client) UpsertSystemManagedSavedSearch

func (c *Client) UpsertSystemManagedSavedSearch(
	ctx context.Context,
	systemManagedSearch SystemManagedSavedSearch,
) error

UpsertSystemManagedSavedSearch inserts or updates a system managed saved search.

func (*Client) UpsertWPTRunFeatureMetrics

func (c *Client) UpsertWPTRunFeatureMetrics(
	ctx context.Context,
	externalRunID int64,
	inputMetrics map[string]WPTRunFeatureMetric) error

UpsertWPTRunFeatureMetrics will upsert WPT Run metrics for a given WPT Run ID. The RunID must exist in a row in the WPTRuns table.

func (*Client) UpsertWebFeatureSnapshot

func (c *Client) UpsertWebFeatureSnapshot(ctx context.Context, snapshot WebFeatureSnapshot) error

type CommonFSCountTemplateData

type CommonFSCountTemplateData struct {
	BaseQueryFragment string
	Filters           []string
}

CommonFSCountTemplateData contains the template for commonCountQueryTemplate.

type CommonFSSelectTemplateData

type CommonFSSelectTemplateData struct {
	BaseQueryFragment    string
	StableMetrics        string
	ExperimentalMetrics  string
	ImplementationStatus string
	PageFilters          []string
	Filters              []string
	SortClause           string
	Offset               int
	PageSize             int
	OptionalJoins        []JoinData
}

type CreateNotificationChannelDeliveryAttemptRequest

type CreateNotificationChannelDeliveryAttemptRequest struct {
	ChannelID        string
	AttemptTimestamp time.Time
	Status           NotificationChannelDeliveryAttemptStatus
	Details          spanner.NullJSON
}

CreateNotificationChannelDeliveryAttemptRequest is the request to create a delivery attempt.

type CreateNotificationChannelRequest

type CreateNotificationChannelRequest struct {
	UserID        string
	Name          string
	Type          NotificationChannelType
	EmailConfig   *EmailConfig
	WebhookConfig *WebhookConfig
}

CreateNotificationChannelRequest is the request to create a channel.

type CreateOption

type CreateOption func(*createOptions)

CreateOption is a function that configures the creation of an entity.

func WithID

func WithID(id string) CreateOption

WithID is a CreateOption that specifies the ID to use for the new entity.

type CreateSavedSearchSubscriptionRequest

type CreateSavedSearchSubscriptionRequest struct {
	UserID        string
	ChannelID     string
	SavedSearchID string
	Triggers      []SubscriptionTrigger
	Frequency     SavedSearchSnapshotType
}

CreateSavedSearchSubscriptionRequest is the request to create a subscription.

type CreateUserSavedSearchRequest

type CreateUserSavedSearchRequest struct {
	Name        string
	Query       string
	OwnerUserID string
	Description *string
}

CreateUserSavedSearchRequest is the request to create a new user saved search.

type DailyChromiumHistogramEnumCapstone

type DailyChromiumHistogramEnumCapstone struct {
	Day           civil.Date
	HistogramName metricdatatypes.HistogramName
}

type DailyChromiumHistogramMetric

type DailyChromiumHistogramMetric struct {
	Day  civil.Date `spanner:"Day"`
	Rate big.Rat    `spanner:"Rate"`
}

type DeleteUserSavedSearchRequest

type DeleteUserSavedSearchRequest struct {
	RequestingUserID string
	SavedSearchID    string
}

DeleteUserSavedSearchRequest contains the request parameters for DeleteUserSavedSearch.

type EmailConfig

type EmailConfig struct {
	Address           string  `json:"address,omitempty"`
	IsVerified        bool    `json:"is_verified,omitempty"`
	VerificationToken *string `json:"verification_token,omitempty"`
}

EmailConfig represents the JSON structure for an email notification channel.

type ExtraMutationsGroup

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

type FeatureBaselineStatus

type FeatureBaselineStatus struct {
	Status   *BaselineStatus `spanner:"-"` // Spanner can not handle pointer to custom type. So ignore it.
	LowDate  *time.Time      `spanner:"LowDate"`
	HighDate *time.Time      `spanner:"HighDate"`
}

FeatureBaselineStatus contains information about the current baseline status of a feature.

type FeatureDeveloperSignal

type FeatureDeveloperSignal struct {
	WebFeatureKey string `spanner:"WebFeatureKey"`
	Upvotes       int64  `spanner:"Upvotes"`
	Link          string `spanner:"Link"`
}

type FeatureDiscouragedDetails

type FeatureDiscouragedDetails struct {
	AccordingTo  []string `spanner:"AccordingTo"`
	Alternatives []string `spanner:"Alternatives"`
}

FeatureDiscouragedDetails contains information about why a feature is discouraged.

type FeatureIDFilter

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

FeatureIDFilter will limit the search to a particular feature ID.

func NewFeatureKeyFilter

func NewFeatureKeyFilter(featureKey string) *FeatureIDFilter

func (FeatureIDFilter) Clause

func (f FeatureIDFilter) Clause() string

func (FeatureIDFilter) Params

func (f FeatureIDFilter) Params() map[string]interface{}

type FeatureMetricsTemplateData

type FeatureMetricsTemplateData struct {
	TotalColumn      string
	PassColumn       string
	PageFilter       string
	FeatureKeyFilter string
	ExtraFilter      string
	IsSingleFeature  bool
}

FeatureMetricsTemplateData contains the variables for getFeatureMetricBaseRawTemplate.

type FeatureResult

type FeatureResult struct {
	FeatureKey                 string                  `spanner:"FeatureKey"`
	Name                       string                  `spanner:"Name"`
	SystemManagedSavedSearchID *string                 `spanner:"SystemManagedSavedSearchID"`
	Status                     *string                 `spanner:"Status"`
	StableMetrics              []*FeatureResultMetric  `spanner:"StableMetrics"`
	ExperimentalMetrics        []*FeatureResultMetric  `spanner:"ExperimentalMetrics"`
	ImplementationStatuses     []*ImplementationStatus `spanner:"ImplementationStatuses"`
	LowDate                    *time.Time              `spanner:"LowDate"`
	HighDate                   *time.Time              `spanner:"HighDate"`
	SpecLinks                  []string                `spanner:"SpecLinks"`
	AccordingTo                []string                `spanner:"AccordingTo"`
	Alternatives               []string                `spanner:"Alternatives"`
	ChromiumUsage              *big.Rat                `spanner:"ChromiumUsage"`
	DeveloperSignalUpvotes     *int64                  `spanner:"DeveloperSignalUpvotes"`
	DeveloperSignalLink        *string                 `spanner:"DeveloperSignalLink"`
	VendorPositions            spanner.NullJSON        `spanner:"VendorPositions"`
}

FeatureResult contains information regarding a particular feature.

type FeatureResultMetric

type FeatureResultMetric struct {
	BrowserName       string                 `spanner:"BrowserName"`
	PassRate          *big.Rat               `spanner:"PassRate"`
	FeatureRunDetails map[string]interface{} `spanner:"-"`
}

FeatureResultMetric contains metric information for a feature result query. Very similar to WPTRunFeatureMetric.

type FeatureResultOffsetCursor

type FeatureResultOffsetCursor struct {
	Offset int `json:"offset"`
}

FeatureResultOffsetCursor: A numerical offset from the start of the result set. Enables the construction of human-friendly URLs specifying an exact page offset. Disclaimer: External users should be aware that the format of this token is subject to change and should not be treated as a stable interface. Instead, external users should rely on the returned pagination token long term.

type FeatureResultPage

type FeatureResultPage struct {
	Total         int64
	NextPageToken *string
	Features      []FeatureResult
}

FeatureResultPage contains the details for the feature search request.

type FeatureSearchBaseQuery

type FeatureSearchBaseQuery interface {
	// Query generates a query to return rows about the features in the system.
	// Each row includes:
	//  1. The Internal ID of the feature
	//  2. The external ID from web features repo
	//  3. The human readable name.
	//  4. The baseline status.
	//  5. The latest metrics from WPT.
	//     It provides these metrics for both "stable" and "experimental" channels.
	//     The metrics retrieved are for each unique BrowserName/Channel/WebFeatureID.
	Query(args FeatureSearchQueryArgs) (string, map[string]interface{})

	// CountQuery generates the base query to return only the count of items.
	CountQuery(args FeatureSearchCountArgs) string
}

FeatureSearchBaseQuery contains the base query for all feature search related queries.

type FeatureSearchColumn

type FeatureSearchColumn string

FeatureSearchColumn is the high level column returned in the FeatureSearch Query from spanner.

func (FeatureSearchColumn) ToFilterColumn

func (f FeatureSearchColumn) ToFilterColumn() string

type FeatureSearchCompiledFilter

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

func (FeatureSearchCompiledFilter) Filters

func (f FeatureSearchCompiledFilter) Filters() []string

func (FeatureSearchCompiledFilter) Params

func (f FeatureSearchCompiledFilter) Params() map[string]interface{}

type FeatureSearchCountArgs

type FeatureSearchCountArgs struct {
	Filters []string
}

type FeatureSearchFilterBuilder

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

func NewFeatureSearchFilterBuilder

func NewFeatureSearchFilterBuilder() *FeatureSearchFilterBuilder

func (*FeatureSearchFilterBuilder) Build

Build constructs a Spanner query for the FeaturesSearch function.

type FeatureSearchQueryArgs

type FeatureSearchQueryArgs struct {
	MetricView                  WPTMetricView
	Filters                     []string
	PageFilters                 []string
	PageSize                    int
	Offset                      int
	SortClause                  string
	SortByStableBrowserImpl     *SortByBrowserImplDetails
	SortByExpBrowserImpl        *SortByBrowserImplDetails
	SortByBrowserFeatureSupport *SortByBrowserFeatureSupportDetails
	Browsers                    []string
}

type FeatureSearchQueryBuilder

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

FeatureSearchQueryBuilder builds a query to search for features.

func (FeatureSearchQueryBuilder) Build

func (FeatureSearchQueryBuilder) CountQueryBuild

type FeatureSpec

type FeatureSpec struct {
	Links []string
}

FeatureSpec contains availability information for a particular feature in a browser.

type FeaturesSearchSortTarget

type FeaturesSearchSortTarget string

FeaturesSearchSortTarget is an enumeration of the data that is being targeted for the sort operation. This is used to know which column(s) to encode and decode in the pagination token.

const (
	IDSort                     FeaturesSearchSortTarget = "id"
	NameSort                   FeaturesSearchSortTarget = "name"
	StatusSort                 FeaturesSearchSortTarget = "status"
	StableImplSort             FeaturesSearchSortTarget = "stable_browser_impl"
	ExperimentalImplSort       FeaturesSearchSortTarget = "experimental_browser_impl"
	ChromiumUsageSort          FeaturesSearchSortTarget = "chromium_usage"
	BrowserFeatureSupportSort  FeaturesSearchSortTarget = "browser_feature_support"
	DeveloperSignalUpvotesSort FeaturesSearchSortTarget = "developer_signal_upvotes"
)

type Filterable

type Filterable interface {
	Params() map[string]interface{}
	Clause() string
}

Filterable modifies a query with a given filter.

type GCPFSBrowserFeatureSupportTemplateData

type GCPFSBrowserFeatureSupportTemplateData struct {
	BrowserNameParam string
}

GCPFSBrowserFeatureSupportTemplateData contains the template data for gcpFSBrowserFeatureSupportTemplate.

type GCPFSBrowserImplStatusTemplateData

type GCPFSBrowserImplStatusTemplateData struct {
	BrowserNameParam string
}

GCPFSBrowserImplStatusTemplateData contains the template data for gcpFSBrowserImplementationStatusTemplate.

type GCPFSBrowserMetricTemplateData

type GCPFSBrowserMetricTemplateData struct {
	BrowserNameParam string
	GCPFSMetricsTemplateData
}

GCPFSBrowserMetricTemplateData contains the template data for gcpFSPassRateForBrowserTemplate.

type GCPFSCountTemplateData

type GCPFSCountTemplateData struct {
	CommonFSCountTemplateData
}

GCPFSCountTemplateData contains the template for gcpFSCountQueryTemplate.

type GCPFSMetricsTemplateData

type GCPFSMetricsTemplateData struct {
	Channel        string
	BrowserList    []string
	PassRateColumn string
	ChannelParam   string
	MetricIndex    string
}

GCPFSMetricsTemplateData contains the template data for gcpFSMetricsSubQueryTemplate.

type GCPFSSelectTemplateData

type GCPFSSelectTemplateData struct {
	CommonFSSelectTemplateData
}

GCPFSSelectTemplateData contains the template data for gcpFSSelectQueryTemplate.

type GCPFeatureSearchBaseQuery

type GCPFeatureSearchBaseQuery struct{}

GCPFeatureSearchBaseQuery provides a base query that is optimal for GCP Spanner to retrieve the information described in the FeatureBaseQuery interface.

func (GCPFeatureSearchBaseQuery) CountQuery

func (GCPFeatureSearchBaseQuery) Query

func (f GCPFeatureSearchBaseQuery) Query(args FeatureSearchQueryArgs) (
	string, map[string]interface{})

Query uses the latest browsername/channel/timestart mapping to build a query.

type GCPMissingOneImplementationQuery

type GCPMissingOneImplementationQuery struct{}

GCPMissingOneImplementationQuery provides a base query that is optimal for GCP Spanner to retrieve the information described in the MissingOneImplementationQuery interface.

func (GCPMissingOneImplementationQuery) Query

func (q GCPMissingOneImplementationQuery) Query(data missingOneImplTemplateData) string

type GetFeatureQueryBuilder

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

GetFeatureQueryBuilder builds a query to search for one feature.

func (GetFeatureQueryBuilder) Build

type Group

type Group struct {
	GroupKey string `spanner:"GroupKey"`
	Name     string `spanner:"Name"`
}

Group contains common metadata for a group from the WebDX web-feature repository. Columns come from the ../../infra/storage/spanner/migrations/*.sql files.

type ImplementationStatus

type ImplementationStatus struct {
	BrowserName           string                      `spanner:"BrowserName"`
	ImplementationStatus  BrowserImplementationStatus `spanner:"ImplementationStatus"`
	ImplementationDate    *time.Time                  `spanner:"ImplementationDate"`
	ImplementationVersion *string                     `spanner:"ImplementationVersion"`
}

ImplementationStatus contains the implementation status information for a given browser.

type JoinData

type JoinData struct {
	Alias    string
	Template string
}

JoinData contains template data for the optional joins.

type LatestRunResult

type LatestRunResult struct {
	Channel     string    `spanner:"Channel"`
	BrowserName string    `spanner:"BrowserName"`
	TimeStart   time.Time `spanner:"TimeStart"`
}

LatestRunResult contains the information for when a given BrowserName & Channel combination last ran.

type LatestRunResultsGroupedByChannel

type LatestRunResultsGroupedByChannel map[string][]LatestRunResult

LatestRunResultsGroupedByChannel is a mapping of channel to list LatestRunResult. Useful for building the filter per channel in the Query method of GCPFeatureSearchBaseQuery.

type ListNotificationChannelDeliveryAttemptsRequest

type ListNotificationChannelDeliveryAttemptsRequest struct {
	ChannelID string
	PageSize  int
	PageToken *string
}

ListNotificationChannelDeliveryAttemptsRequest is the request struct for listing delivery attempts.

func (ListNotificationChannelDeliveryAttemptsRequest) GetPageSize

GetPageSize returns the page size for the request.

type ListNotificationChannelsRequest

type ListNotificationChannelsRequest struct {
	UserID    string
	PageSize  int
	PageToken *string
}

ListNotificationChannelsRequest is a request to list notification channels.

func (ListNotificationChannelsRequest) GetPageSize

func (r ListNotificationChannelsRequest) GetPageSize() int

func (ListNotificationChannelsRequest) GetPageToken

func (r ListNotificationChannelsRequest) GetPageToken() *string

type ListRequest

type ListRequest interface {
	GetPageSize() int
}

ListRequest is an interface for list requests that support pagination.

type ListSavedSearchSubscriptionsRequest

type ListSavedSearchSubscriptionsRequest struct {
	UserID    string
	PageSize  int
	PageToken *string
}

ListSavedSearchSubscriptionsRequest is a request to list saved search subscriptions.

func (ListSavedSearchSubscriptionsRequest) GetPageSize

func (r ListSavedSearchSubscriptionsRequest) GetPageSize() int

GetPageSize returns the page size for the request.

func (ListSavedSearchSubscriptionsRequest) GetPageToken

func (r ListSavedSearchSubscriptionsRequest) GetPageToken() *string

GetPageToken returns the page token for the request.

type ListUserSavedSearchesRequest

type ListUserSavedSearchesRequest struct {
	UserID    string
	PageSize  int
	PageToken *string
}

ListUserSavedSearchesRequest is a request to list user saved searches.

func (ListUserSavedSearchesRequest) GetPageSize

func (r ListUserSavedSearchesRequest) GetPageSize() int

GetPageSize returns the page size for the request.

type LocalBatchWriter

type LocalBatchWriter struct{}

LocalBatchWriter is a batch writer for local environments using the emulator. BatchWrite is not implemented in the emulator. https://github.com/GoogleCloudPlatform/cloud-spanner-emulator/issues/154 Instead, do Apply which does multiple statements atomically. Remove this once the emulator supports BatchWrite. This is only exported for the load_fake_data utility.

func (LocalBatchWriter) BatchWriteMutations

func (w LocalBatchWriter) BatchWriteMutations(
	ctx context.Context, client *spanner.Client, mutations []*spanner.Mutation) error

type LocalFSBrowserFeatureSupportTemplateData

type LocalFSBrowserFeatureSupportTemplateData struct {
	BrowserNameParam string
}

LocalFSBrowserFeatureSupportTemplateData contains the template data for localFSBrowserFeatureSupportTemplate.

type LocalFSBrowserImplStatusTemplateData

type LocalFSBrowserImplStatusTemplateData struct {
	BrowserNameParam string
}

LocalFSBrowserImplStatusTemplateData contains the template data for localFSBrowserImplementationStatusTemplate.

type LocalFSBrowserMetricTemplateData

type LocalFSBrowserMetricTemplateData struct {
	BrowserNameParam string
	LocalFSMetricsTemplateData
}

LocalFSBrowserMetricTemplateData contains the template data for localFSPassRateForBrowserTemplate.

type LocalFSCountTemplateData

type LocalFSCountTemplateData struct {
	CommonFSCountTemplateData
}

LocalFSCountTemplateData contains the template for localFSCountQueryTemplate.

type LocalFSMetricsTemplateData

type LocalFSMetricsTemplateData struct {
	Channel        string
	PassRateColumn string
	ChannelParam   string
}

LocalFSMetricsTemplateData contains the template for localFSMetricsSubQueryTemplate.

type LocalFSSelectTemplateData

type LocalFSSelectTemplateData struct {
	CommonFSSelectTemplateData
	PassRateColumn string
}

LocalFSSelectTemplateData contains the template data for localFSSelectQueryTemplate.

type LocalFeatureBaseQuery

type LocalFeatureBaseQuery struct{}

LocalFeatureBaseQuery is a version of the base query that works well on the local emulator. For some reason, the local emulator takes forever for the GCPFeatureSearchBaseQuery as the number of features and metrics grows. But GCPFeatureSearchBaseQuery works extremely well on GCP. At least 1.5-2x faster than LocalFeatureBaseQuery with 2400 metrics as of March 2024. Rather han sacrifice performance for the sake of compatibility, we have this LocalFeatureBaseQuery implementation which is good for the volume of data locally. TODO. Consolidate to using either LocalFeatureBaseQuery to reduce the maintenance burden.

func (LocalFeatureBaseQuery) CountQuery

func (LocalFeatureBaseQuery) Query

func (f LocalFeatureBaseQuery) Query(args FeatureSearchQueryArgs) (
	string, map[string]interface{})

Query is a version of the base query that works on the local emulator. It leverages a common table expression CTE to help query the metrics.

type LocalMissingOneImplementationQuery

type LocalMissingOneImplementationQuery struct{}

LocalMissingOneImplementationQuery is a version of the base query that works well on the local emulator. For some reason, the local emulator takes at least 1 minute with the fake data when using the GCPMissingOneImplementationQuery. Rather than sacrifice performance for the sake of compatibility, we have this LocalMissingOneImplementationQuery implementation which is good for the volume of data locally. TODO. Consolidate to using either LocalMissingOneImplementationQuery or GCPMissingOneImplementationQuery to reduce the maintenance burden.

func (LocalMissingOneImplementationQuery) Query

func (q LocalMissingOneImplementationQuery) Query(data missingOneImplTemplateData) string

type MissingOneImplCount

type MissingOneImplCount struct {
	EventReleaseDate time.Time `spanner:"EventReleaseDate"`
	Count            int64     `spanner:"Count"`
}

MissingOneImplCount contains information regarding the count of features implemented in all other browsers but not in the target browser.

type MissingOneImplCountPage

type MissingOneImplCountPage struct {
	NextPageToken *string
	Metrics       []MissingOneImplCount
}

MissingOneImplCountPage contains the details for the missing one implementation count request.

type MissingOneImplFeature

type MissingOneImplFeature struct {
	WebFeatureID string `spanner:"KEY"`
}

MissingOneImplFeature contains information regarding the list of features implemented in all other browsers but not in the target browser.

type MissingOneImplFeatureListPage

type MissingOneImplFeatureListPage struct {
	NextPageToken *string
	FeatureList   []MissingOneImplFeature
}

MissingOneImplFeatureListPage contains the details for the missing one implementation feature list request.

type MissingOneImplementationQuery

type MissingOneImplementationQuery interface {
	Query(missingOneImplTemplateData) string
}

MissingOneImplementationQuery contains the base query for all missing one implementation related queries.

type MovedWebFeature

type MovedWebFeature struct {
	OriginalFeatureKey string `spanner:"OriginalFeatureKey"`
	NewFeatureKey      string `spanner:"NewFeatureKey"`
}

type NotificationChannel

type NotificationChannel struct {
	ID            string
	UserID        string
	Name          string
	Type          NotificationChannelType
	EmailConfig   *EmailConfig
	WebhookConfig *WebhookConfig
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

NotificationChannel represents a user-facing notification channel.

type NotificationChannelDeliveryAttempt

type NotificationChannelDeliveryAttempt struct {
	ID               string                                   `spanner:"ID"`
	ChannelID        string                                   `spanner:"ChannelID"`
	AttemptTimestamp time.Time                                `spanner:"AttemptTimestamp"`
	Status           NotificationChannelDeliveryAttemptStatus `spanner:"Status"`
	AttemptDetails   *AttemptDetails                          `spanner:"AttemptDetails"`
}

type NotificationChannelDeliveryAttemptStatus

type NotificationChannelDeliveryAttemptStatus string
const (
	// DeliveryAttemptStatusSuccess indicates that the delivery attempt was successful.
	DeliveryAttemptStatusSuccess NotificationChannelDeliveryAttemptStatus = "SUCCESS"
	// DeliveryAttemptStatusFailure indicates that the delivery attempt failed.
	DeliveryAttemptStatusFailure NotificationChannelDeliveryAttemptStatus = "FAILURE"
)

type NotificationChannelState

type NotificationChannelState struct {
	ChannelID           string    `spanner:"ChannelID"`
	IsDisabledBySystem  bool      `spanner:"IsDisabledBySystem"`
	ConsecutiveFailures int64     `spanner:"ConsecutiveFailures"`
	CreatedAt           time.Time `spanner:"CreatedAt"`
	UpdatedAt           time.Time `spanner:"UpdatedAt"`
}

NotificationChannelState represents a row in the NotificationChannelState table.

type NotificationChannelType

type NotificationChannelType string
const (
	NotificationChannelTypeEmail   NotificationChannelType = "email"
	NotificationChannelTypeWebhook NotificationChannelType = "webhook"
)

type OptionallySet

type OptionallySet[T any] struct {
	Value T
	IsSet bool
}

OptionallySet allows distinguishing between setting a value and leaving it unchanged. Useful for PATCH operations where only specific fields are updated.

type SavedSearch

type SavedSearch struct {
	ID          string           `spanner:"ID"`
	Name        string           `spanner:"Name"`
	Description *string          `spanner:"Description"`
	Query       string           `spanner:"Query"`
	Scope       SavedSearchScope `spanner:"Scope"`
	AuthorID    string           `spanner:"AuthorID"`
	CreatedAt   time.Time        `spanner:"CreatedAt"`
	UpdatedAt   time.Time        `spanner:"UpdatedAt"`
}

SavedSearch represents a saved search row in the SavedSearches table.

type SavedSearchBriefDetails

type SavedSearchBriefDetails struct {
	ID    string `spanner:"ID"`
	Query string `spanner:"Query"`
}

type SavedSearchNotificationCreateRequest

type SavedSearchNotificationCreateRequest struct {
	SavedSearchID string                  `spanner:"SavedSearchId"`
	SnapshotType  SavedSearchSnapshotType `spanner:"SnapshotType"`
	Timestamp     time.Time               `spanner:"Timestamp"`
	EventType     string                  `spanner:"EventType"`
	Reasons       []string                `spanner:"Reasons"`
	BlobPath      string                  `spanner:"BlobPath"`
	DiffBlobPath  string                  `spanner:"DiffBlobPath"`
	Summary       spanner.NullJSON        `spanner:"Summary"`
}

type SavedSearchNotificationEvent

type SavedSearchNotificationEvent struct {
	ID            string                  `spanner:"EventId"`
	SavedSearchID string                  `spanner:"SavedSearchId"`
	SnapshotType  SavedSearchSnapshotType `spanner:"SnapshotType"`
	Timestamp     time.Time               `spanner:"Timestamp"`
	EventType     string                  `spanner:"EventType"`
	Reasons       []string                `spanner:"Reasons"`
	BlobPath      string                  `spanner:"BlobPath"`
	DiffBlobPath  string                  `spanner:"DiffBlobPath"`
	Summary       spanner.NullJSON        `spanner:"Summary"`
}

type SavedSearchRole

type SavedSearchRole string

SavedSearchRole is the enum for the saved searches role.

const (
	// SavedSearchOwner indicates the user owns the saved search query.
	SavedSearchOwner SavedSearchRole = "OWNER"
)

type SavedSearchScope

type SavedSearchScope string

SavedSearchScope represents the scope of a saved search.

const (
	// UserPublicScope indicates that this is user created saved search meant to be publicly accessible.
	UserPublicScope SavedSearchScope = "USER_PUBLIC"
	// SystemManagedScope indicates that this is a system managed saved search for a feature.
	SystemManagedScope SavedSearchScope = "SYSTEM_MANAGED"
)

type SavedSearchSnapshotType

type SavedSearchSnapshotType string
const (
	SavedSearchSnapshotTypeImmediate SavedSearchSnapshotType = "IMMEDIATE"
	SavedSearchSnapshotTypeWeekly    SavedSearchSnapshotType = "WEEKLY"
	SavedSearchSnapshotTypeMonthly   SavedSearchSnapshotType = "MONTHLY"
	SavedSearchSnapshotTypeUnknown   SavedSearchSnapshotType = "UNKNOWN"
)

type SavedSearchState

type SavedSearchState struct {
	SavedSearchID          string                  `spanner:"SavedSearchId"`
	SnapshotType           SavedSearchSnapshotType `spanner:"SnapshotType"`
	LastKnownStateBlobPath *string                 `spanner:"LastKnownStateBlobPath"`
	WorkerLockID           *string                 `spanner:"WorkerLockId"`
	WorkerLockExpiresAt    *time.Time              `spanner:"WorkerLockExpiresAt"`
}

type SavedSearchSubscription

type SavedSearchSubscription struct {
	ID            string                  `spanner:"ID"`
	ChannelID     string                  `spanner:"ChannelID"`
	SavedSearchID string                  `spanner:"SavedSearchID"`
	Triggers      []SubscriptionTrigger   `spanner:"Triggers"`
	Frequency     SavedSearchSnapshotType `spanner:"Frequency"`
	CreatedAt     time.Time               `spanner:"CreatedAt"`
	UpdatedAt     time.Time               `spanner:"UpdatedAt"`
}

SavedSearchSubscription represents a row in the SavedSearchSubscription table.

type SavedSearchSubscriptionView

type SavedSearchSubscriptionView struct {
	SavedSearchSubscription
	SavedSearchName string `spanner:"SavedSearchName"`
}

SavedSearchSubscriptionView represents the joined result for display.

type SavedSearchUserRole

type SavedSearchUserRole struct {
	SavedSearchID string          `spanner:"SavedSearchID"`
	UserID        string          `spanner:"UserID"`
	UserRole      SavedSearchRole `spanner:"UserRole"`
}

SavedSearchUserRole represents a user's role in relation to a saved search.

type Snapshot

type Snapshot struct {
	SnapshotKey string `spanner:"SnapshotKey"`
	Name        string `spanner:"Name"`
}

Snapshot contains common metadata for a snapshot from the WebDX web-feature repository. Columns come from the ../../infra/storage/spanner/migrations/*.sql files.

type SortByBrowserFeatureSupportDetails

type SortByBrowserFeatureSupportDetails struct {
	BrowserName string
}

SortByBrowserFeatureSupportDetails contains parameter data for the Browser Feature Support templates.

type SortByBrowserImplDetails

type SortByBrowserImplDetails struct {
	BrowserName string
}

SortByBrowserImplDetails contains parameter data for the Implementation Status templates.

type Sortable

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

Sortable is a basic class that all/most sortables can include.

func NewBaselineStatusSort

func NewBaselineStatusSort(isAscending bool) Sortable

NewBaselineStatusSort returns a Sortable specifically for the Status column.

func NewBrowserFeatureSupportSort

func NewBrowserFeatureSupportSort(isAscending bool, browserName string) Sortable

NewBrowserFeatureSupportSort creates a Sortable configuration for ordering Web Features. The primary sorting criterion is the date of when the feature became available.

Arguments:

  • isAscending: Whether the sorting should be ascending (true) or descending (false).
  • browserName: The name of the browser ("chrome", "firefox", etc.).

func NewBrowserImplSort

func NewBrowserImplSort(isAscending bool, browserName string, isStable bool) Sortable

NewBrowserImplSort creates a Sortable configuration for ordering Web Features. The primary sorting criterion is the pass rate of stable or experimental WPT (Web Platform Tests) metrics for the specified browser. The secondary sorting criterion is the implementation status ("available" or "unavailable") of the feature in the specified browser.

Arguments:

  • isAscending: Whether the sorting should be ascending (true) or descending (false).
  • browserName: The name of the browser ("chrome", "firefox", etc.).
  • isStable: Whether to use stable (true) or experimental (false) WPT metrics.

func NewChromiumUsageSort

func NewChromiumUsageSort(isAscending bool) Sortable

NewChromiumUsageSort returns a Sortable specifically for the ChromiumUsage column.

func NewDeveloperSignalUpvotesSort

func NewDeveloperSignalUpvotesSort(isAscending bool) Sortable

NewDeveloperSignalUpvotesSort returns a Sortable specifically for the DeveloperSignalUpvotes column.

func NewFeatureNameSort

func NewFeatureNameSort(isAscending bool) Sortable

NewFeatureNameSort returns a Sortable specifically for the Name column.

func (Sortable) BrowserTarget

func (s Sortable) BrowserTarget() string

func (Sortable) Clause

func (s Sortable) Clause() string

func (Sortable) SortTarget

func (s Sortable) SortTarget() FeaturesSearchSortTarget

type SpannerFeatureIDAndKey

type SpannerFeatureIDAndKey struct {
	ID         string `spanner:"ID"`
	FeatureKey string `spanner:"FeatureKey"`
}

type SpannerFeatureResult

type SpannerFeatureResult struct {
	ID                         string                        `spanner:"ID"`
	FeatureKey                 string                        `spanner:"FeatureKey"`
	SystemManagedSavedSearchID *string                       `spanner:"SystemManagedSavedSearchID"`
	Name                       string                        `spanner:"Name"`
	Status                     *string                       `spanner:"Status"`
	StableMetrics              []*SpannerFeatureResultMetric `spanner:"StableMetrics"`
	ExperimentalMetrics        []*SpannerFeatureResultMetric `spanner:"ExperimentalMetrics"`
	ImplementationStatuses     []*ImplementationStatus       `spanner:"ImplementationStatuses"`
	LowDate                    *time.Time                    `spanner:"LowDate"`
	HighDate                   *time.Time                    `spanner:"HighDate"`
	SpecLinks                  []string                      `spanner:"SpecLinks"`
	AccordingTo                []string                      `spanner:"AccordingTo"`
	Alternatives               []string                      `spanner:"Alternatives"`
	ChromiumUsage              *big.Rat                      `spanner:"ChromiumUsage"`
	DeveloperSignalUpvotes     *int64                        `spanner:"DeveloperSignalUpvotes"`
	DeveloperSignalLink        *string                       `spanner:"DeveloperSignalLink"`
	VendorPositions            spanner.NullJSON              `spanner:"VendorPositions"`
}

SpannerFeatureResult is a wrapper for the feature result that is actually stored in spanner. This is useful because the spanner id is not useful to return to the end user.

type SpannerFeatureResultMetric

type SpannerFeatureResultMetric struct {
	BrowserName       string           `spanner:"BrowserName"`
	PassRate          *big.Rat         `spanner:"PassRate"`
	FeatureRunDetails spanner.NullJSON `spanner:"FeatureRunDetails"`
}

type SpannerFeatureSpec

type SpannerFeatureSpec struct {
	WebFeatureID string
	FeatureSpec
}

type SpannerLatestDailyChromiumHistogramMetric

type SpannerLatestDailyChromiumHistogramMetric struct {
	WebFeatureID                 string     `spanner:"WebFeatureID"`
	ChromiumHistogramEnumValueID string     `spanner:"ChromiumHistogramEnumValueID"`
	Day                          civil.Date `spanner:"Day"`
}

type SpannerLatestWPTRunFeatureMetric

type SpannerLatestWPTRunFeatureMetric struct {
	RunMetricID  string `spanner:"RunMetricID"`
	WebFeatureID string `spanner:"WebFeatureID"`
	BrowserName  string `spanner:"BrowserName"`
	Channel      string `spanner:"Channel"`
}

SpannerLatestWPTRunFeatureMetric represents a pointer to an entry in WPTRunFeatureMetrics.

type SpannerWPTRunFeatureMetric

type SpannerWPTRunFeatureMetric struct {
	ID                string           `spanner:"ID"`
	WebFeatureID      string           `spanner:"WebFeatureID"`
	FeatureRunDetails spanner.NullJSON `spanner:"FeatureRunDetails"`
	WPTRunFeatureMetric
	// Calculated pass rate
	TestPassRate    *big.Rat `spanner:"TestPassRate"`
	SubtestPassRate *big.Rat `spanner:"SubtestPassRate"`
	// Denormalized data from wpt runs.
	BrowserName string    `spanner:"BrowserName"`
	Channel     string    `spanner:"Channel"`
	TimeStart   time.Time `spanner:"TimeStart"`
}

SpannerWPTRunFeatureMetric is a wrapper for the metric data that is actually stored in spanner. This is useful because the spanner id is not useful to return to the end user since it is used to decouple the primary keys between this system and wpt.fyi.

type SpannerWebFeature

type SpannerWebFeature struct {
	ID string `spanner:"ID"`
	WebFeature
}

SpannerWebFeature is a wrapper for the feature that is actually stored in spanner. This is useful because the spanner id is not useful to return to the end user since it is only used to decouple the primary keys between this system and web features repo.

type SpannerWebFeatureSyncInfo

type SpannerWebFeatureSyncInfo struct {
	ID         string `spanner:"ID"`
	FeatureKey string `spanner:"FeatureKey"`
	Name       string `spanner:"Name"`
}

SpannerWebFeatureSyncInfo contains the basic feature information needed for sync jobs.

type SplitWebFeature

type SplitWebFeature struct {
	OriginalFeatureKey string   `spanner:"OriginalFeatureKey"`
	TargetFeatureKeys  []string `spanner:"TargetFeatureKeys"`
}

type SubscriberDestination

type SubscriberDestination struct {
	SubscriptionID string
	UserID         string
	ChannelID      string
	Type           NotificationChannelType
	Triggers       []SubscriptionTrigger
	// If type is EMAIL, EmailConfig is set.
	EmailConfig *EmailConfig
	// If type is WEBHOOK, WebhookConfig is set.
	WebhookConfig *WebhookConfig
}

type SubscriptionTrigger

type SubscriptionTrigger string
const (
	SubscriptionTriggerBrowserImplementationAnyComplete SubscriptionTrigger = "feature.browser_implementation." +
		"any_complete"
	SubscriptionTriggerFeatureBaselinePromoteToNewly      SubscriptionTrigger = "feature.baseline.promote_to_newly"
	SubscriptionTriggerFeatureBaselinePromoteToWidely     SubscriptionTrigger = "feature.baseline.promote_to_widely"
	SubscriptionTriggerFeatureBaselineRegressionToLimited SubscriptionTrigger = "feature.baseline.regression_to_limited"
	SubscriptionTriggerUnknown                            SubscriptionTrigger = "unknown"
)

type SyncWebFeaturesOption

type SyncWebFeaturesOption func(*webFeatureSpannerMapper)

func WithRedirectTargets

func WithRedirectTargets(redirects map[string]string) SyncWebFeaturesOption

type SystemManagedSavedSearch

type SystemManagedSavedSearch struct {
	FeatureID     string    `spanner:"FeatureID"`
	SavedSearchID string    `spanner:"SavedSearchID"`
	CreatedAt     time.Time `spanner:"CreatedAt"`
	UpdatedAt     time.Time `spanner:"UpdatedAt"`
}

SystemManagedSavedSearch represents a row in the SystemManagedSavedSearches table.

type UpdateNotificationChannelRequest

type UpdateNotificationChannelRequest struct {
	ID            string
	UserID        string
	Name          OptionallySet[string]
	Type          OptionallySet[NotificationChannelType]
	EmailConfig   OptionallySet[*EmailConfig]
	WebhookConfig OptionallySet[*WebhookConfig]
}

UpdateNotificationChannelRequest is a request to update a notification channel.

type UpdateSavedSearchRequest

type UpdateSavedSearchRequest struct {
	ID          string
	AuthorID    string
	Query       OptionallySet[string]
	Name        OptionallySet[string]
	Description OptionallySet[*string]
}

UpdateSavedSearchRequest is a request to update the saved search.

type UpdateSavedSearchSubscriptionRequest

type UpdateSavedSearchSubscriptionRequest struct {
	ID        string
	UserID    string
	Triggers  OptionallySet[[]SubscriptionTrigger]
	Frequency OptionallySet[SavedSearchSnapshotType]
}

UpdateSavedSearchSubscriptionRequest is a request to update a saved search subscription.

type UserProfile

type UserProfile struct {
	UserID       string
	GitHubUserID int64
	Emails       []string
}

UserProfile represents a user's profile information.

type UserSavedSearch

type UserSavedSearch struct {
	SavedSearch
	// Role will be nil if the user is not authenticated.
	Role *string `spanner:"Role"`
	// IsBookmarked will be nil if the user is not authenticated.
	IsBookmarked *bool `spanner:"IsBookmarked"`
}

UserSavedSearch represents a SavedSearch and a user's attributes related to that SavedSearch.

type UserSavedSearchBookmark

type UserSavedSearchBookmark struct {
	UserID        string `spanner:"UserID"`
	SavedSearchID string `spanner:"SavedSearchID"`
}

UserSavedSearchBookmark represents a user's bookmark for a saved search.

type UserSavedSearchesCursor

type UserSavedSearchesCursor struct {
	LastID   string `json:"last_id"`
	LastName string `json:"last_name"`
}

UserSavedSearchesCursor represents a point for resuming queries based on the last date. Useful for pagination.

type UserSavedSearchesPage

type UserSavedSearchesPage struct {
	NextPageToken *string
	Searches      []UserSavedSearch
}

UserSavedSearchesPage contains the details for a page of UserSavedSearches.

type WPTMetricView

type WPTMetricView string
const (
	WPTSubtestView WPTMetricView = "subtest"
	WPTTestView    WPTMetricView = "test"
)

type WPTRun

type WPTRun struct {
	RunID            int64     `spanner:"ExternalRunID"`
	TimeStart        time.Time `spanner:"TimeStart"`
	TimeEnd          time.Time `spanner:"TimeEnd"`
	BrowserName      string    `spanner:"BrowserName"`
	BrowserVersion   string    `spanner:"BrowserVersion"`
	Channel          string    `spanner:"Channel"`
	OSName           string    `spanner:"OSName"`
	OSVersion        string    `spanner:"OSVersion"`
	FullRevisionHash string    `spanner:"FullRevisionHash"`
}

WPTRun contains common metadata for a run. Columns come from the ../../infra/storage/spanner/migrations/*.sql files.

type WPTRunAggregationMetricWithTime

type WPTRunAggregationMetricWithTime struct {
	WPTRunFeatureMetricWithTime
}

WPTRunAggregationMetricWithTime contains metrics for a particular aggregation at a given time. For now, it is the same metrics as WPTRunFeatureMetricWithTime.

type WPTRunCursor

type WPTRunCursor struct {
	LastTimeStart time.Time `json:"last_time_start"`
	LastRunID     int64     `json:"last_run_id"`
}

WPTRunCursor: Represents a point for resuming queries based on the last TimeStart and ExternalRunID. Useful for pagination.

type WPTRunDataForMetrics

type WPTRunDataForMetrics struct {
	ID          string    `spanner:"ID"`
	BrowserName string    `spanner:"BrowserName"`
	Channel     string    `spanner:"Channel"`
	TimeStart   time.Time `spanner:"TimeStart"`
}

WPTRunDataForMetrics contains duplicate data from WPTRuns that will be stored in the individual metrics. It will allow for quicker look up of metrics.

type WPTRunFeatureMetric

type WPTRunFeatureMetric struct {
	TotalTests        *int64                 `spanner:"TotalTests"`
	TestPass          *int64                 `spanner:"TestPass"`
	TotalSubtests     *int64                 `spanner:"TotalSubtests"`
	SubtestPass       *int64                 `spanner:"SubtestPass"`
	FeatureRunDetails map[string]interface{} `spanner:"-"` // Not directly stored in Spanner
}

WPTRunFeatureMetric represents the metrics for a particular feature in a run.

type WPTRunFeatureMetricWithTime

type WPTRunFeatureMetricWithTime struct {
	TimeStart  time.Time `spanner:"TimeStart"`
	RunID      int64     `spanner:"ExternalRunID"`
	TotalTests *int64    `spanner:"TotalTests"`
	TestPass   *int64    `spanner:"TestPass"`
}

WPTRunFeatureMetricWithTime contains metrics for a feature at a given time.

type WebFeature

type WebFeature struct {
	FeatureKey      string `spanner:"FeatureKey"`
	Name            string `spanner:"Name"`
	Description     string `spanner:"Description"`
	DescriptionHTML string `spanner:"DescriptionHtml"`
}

WebFeature contains common metadata for a Web Feature. Columns come from the ../../infra/storage/spanner/migrations/*.sql files.

type WebFeatureChromiumHistogramEnumValue

type WebFeatureChromiumHistogramEnumValue struct {
	WebFeatureID                 string `spanner:"WebFeatureID"`
	ChromiumHistogramEnumValueID string `spanner:"ChromiumHistogramEnumValueID"`
}

WebFeatureChromiumHistogramEnumValue contains the mapping between ChromiumHistogramEnumValues and WebFeatures. Columns come from the ../../infra/storage/spanner/migrations/*.sql files.

type WebFeatureSnapshot

type WebFeatureSnapshot struct {
	WebFeatureID string   `spanner:"WebFeatureID"`
	SnapshotIDs  []string `spanner:"SnapshotIDs"`
}

WebFeatureSnapshot contains the mapping between WebDXSnapshots and WebFeatures. Columns come from the ../../infra/storage/spanner/migrations/*.sql files.

type WebFeaturesMappingData

type WebFeaturesMappingData struct {
	WebFeatureID    string
	VendorPositions spanner.NullJSON
}

WebFeaturesMappingData is the struct for ingesting WebFeaturesMappingData. The WebFeatureID field is expected to be the feature key.

type WebhookConfig

type WebhookConfig struct {
	URL string `json:"url"`
}

WebhookConfig represents the JSON structure for a webhook notification channel.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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