override

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: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SearchCursor

type SearchCursor struct {
	ID string `json:"i,omitempty"`
}

SearchCursor is used to indicate a position in a paginated list.

type SearchOptions

type SearchOptions struct {
	After SearchCursor `json:"a,omitempty"`
	Limit int          `json:"-"`

	// Omit specifies a list of override IDs to exclude from the results.
	Omit []string

	ScheduleID string `json:"d,omitempty"`

	AddUserIDs    []string `json:"u,omitempty"`
	RemoveUserIDs []string `json:"r,omitempty"`
	AnyUserIDs    []string `json:"n,omitempty"`

	Start time.Time `json:"t,omitempty"`
	End   time.Time `json:"e,omitempty"`
}

SearchOptions allow filtering and paginating the list of rotations.

type Store

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

Store is used to manage active overrides.

func NewStore added in v0.30.0

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

NewStore initializes a new DB using an existing sql connection.

func (*Store) CreateUserOverrideTx

func (s *Store) CreateUserOverrideTx(ctx context.Context, tx *sql.Tx, o *UserOverride) (*UserOverride, error)

CreateUserOverrideTx adds a UserOverride to the DB with a new ID.

func (*Store) DeleteUserOverrideTx

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

DeleteUserOverride removes a UserOverride from the DB matching the given ID.

func (*Store) FindAllUserOverrides

func (s *Store) FindAllUserOverrides(ctx context.Context, start, end time.Time, t assignment.Target) ([]UserOverride, error)

FindAllUserOverrides will return all UserOverrides that belong to the provided Target within the provided time range.

func (*Store) FindOneUserOverrideTx

func (s *Store) FindOneUserOverrideTx(ctx context.Context, tx *sql.Tx, id string, forUpdate bool) (*UserOverride, error)

func (*Store) Search

func (s *Store) Search(ctx context.Context, db gadb.DBTX, opts *SearchOptions) ([]UserOverride, error)

func (*Store) UpdateUserOverride

func (s *Store) UpdateUserOverride(ctx context.Context, o *UserOverride) error

UpdateUserOverride updates an existing UserOverride.

func (*Store) UpdateUserOverrideTx

func (s *Store) UpdateUserOverrideTx(ctx context.Context, tx *sql.Tx, o *UserOverride) error

UpdateUserOverrideTx updates an existing UserOverride, inside an optional transaction.

type UserOverride

type UserOverride struct {
	ID           string    `json:"id,omitempty"`
	AddUserID    string    `json:"add_user_id,omitempty"`
	RemoveUserID string    `json:"remove_user_id,omitempty"`
	Start        time.Time `json:"start_time,omitempty"`
	End          time.Time `json:"end_time,omitempty"`
	Target       assignment.Target
}

A UserOverride is used to add, remove, or change which user is on call.

func (UserOverride) Normalize

func (o UserOverride) Normalize() (*UserOverride, error)

Normalize will validate fields and return a normalized copy.

func (UserOverride) String

func (o UserOverride) String() string

Jump to

Keyboard shortcuts

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