service

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDetailsLength = 6 * 1024 // 6KiB

Variables

This section is empty.

Functions

This section is empty.

Types

type SearchCursor

type SearchCursor struct {
	Name       string `json:"n"`
	IsFavorite bool   `json:"f"`
}

type SearchOptions

type SearchOptions struct {
	// Search is matched case-insensitive against the service name and description.
	Search string `json:"s,omitempty"`

	// FavoritesUserID specifies the UserID whose favorite services want to be displayed.
	FavoritesUserID string `json:"u,omitempty"`

	// FavoritesOnly controls filtering the results to those marked as favorites by FavoritesUserID.
	FavoritesOnly bool `json:"o,omitempty"`

	// Omit specifies a list of service IDs to exclude from the results.
	Omit []string `json:"m,omitempty"`

	// FavoritesFirst indicates that services marked as favorite (by FavoritesUserID) should be returned first (before any non-favorites).
	FavoritesFirst bool `json:"f,omitempty"`

	// Limit will limit the number of results.
	Limit int `json:"-"`

	After SearchCursor `json:"a,omitempty"`
}

SearchOptions contains criteria for filtering and sorting services.

type Service

type Service struct {
	ID                   string
	Name                 string
	Description          string
	EscalationPolicyID   string
	MaintenanceExpiresAt time.Time
	// contains filtered or unexported fields
}

func (Service) EscalationPolicyName

func (s Service) EscalationPolicyName() string

func (Service) IsUserFavorite

func (s Service) IsUserFavorite() bool

IsUserFavorite returns a boolean value based on if the service is a favorite of the user or not.

func (Service) Normalize

func (s Service) Normalize() (*Service, error)

Normalize will validate and 'normalize' the Service -- such as setting the minimum duration to 0.

type Store

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

func NewStore added in v0.30.0

func NewStore(ctx context.Context, db *sql.DB) (*Store, error)

func (*Store) CreateServiceTx

func (s *Store) CreateServiceTx(ctx context.Context, tx *sql.Tx, svc *Service) (*Service, error)

func (*Store) DeleteManyTx

func (s *Store) DeleteManyTx(ctx context.Context, tx *sql.Tx, ids []string) error

func (*Store) FindAllByEP

func (s *Store) FindAllByEP(ctx context.Context, epID string) ([]Service, error)

func (*Store) FindMany

func (s *Store) FindMany(ctx context.Context, ids []string) ([]Service, error)

FindMany returns slice of Service objects given a slice of serviceIDs

func (*Store) FindOne

func (s *Store) FindOne(ctx context.Context, id string) (*Service, error)

func (*Store) FindOneForUpdate

func (s *Store) FindOneForUpdate(ctx context.Context, tx *sql.Tx, id string) (*Service, error)

func (*Store) FindOneForUser

func (s *Store) FindOneForUser(ctx context.Context, userID, serviceID string) (*Service, error)

func (*Store) Search

func (s *Store) Search(ctx context.Context, opts *SearchOptions) ([]Service, error)

Search will return a list of matching services and the total number of matches available.

func (*Store) UpdateTx

func (s *Store) UpdateTx(ctx context.Context, tx *sql.Tx, svc *Service) error

Jump to

Keyboard shortcuts

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