schedule

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func NewDB

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

func (*DB) Create

func (db *DB) Create(ctx context.Context, s *Schedule) (*Schedule, error)

func (*DB) CreateScheduleTx

func (db *DB) CreateScheduleTx(ctx context.Context, tx *sql.Tx, s *Schedule) (*Schedule, error)

func (*DB) Delete

func (db *DB) Delete(ctx context.Context, id string) error

func (*DB) DeleteManyTx

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

func (*DB) DeleteTx

func (db *DB) DeleteTx(ctx context.Context, tx *sql.Tx, id string) error

func (*DB) FindAll

func (db *DB) FindAll(ctx context.Context) ([]Schedule, error)

func (*DB) FindMany

func (db *DB) FindMany(ctx context.Context, ids []string) ([]Schedule, error)

func (*DB) FindOne

func (db *DB) FindOne(ctx context.Context, id string) (*Schedule, error)

func (*DB) FindOneForUpdate

func (db *DB) FindOneForUpdate(ctx context.Context, tx *sql.Tx, id string) (*Schedule, error)

func (*DB) Search

func (db *DB) Search(ctx context.Context, opts *SearchOptions) ([]Schedule, error)

func (*DB) Update

func (db *DB) Update(ctx context.Context, s *Schedule) error

func (*DB) UpdateTx

func (db *DB) UpdateTx(ctx context.Context, tx *sql.Tx, s *Schedule) error

type ReadStore

type ReadStore interface {
	FindAll(context.Context) ([]Schedule, error)
	FindOne(context.Context, string) (*Schedule, error)
}

type Schedule

type Schedule struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	TimeZone    *time.Location `json:"time_zone"`
	// contains filtered or unexported fields
}

func (Schedule) IsUserFavorite added in v0.23.0

func (s Schedule) IsUserFavorite() bool

IsUserFavorite returns a boolean value based on if the schedule is a user favorite

func (Schedule) Normalize

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

type SearchCursor

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

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

type SearchOptions

type SearchOptions struct {
	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:"g,omitempty"`

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

	After SearchCursor `json:"a,omitempty"`

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

	Limit int `json:"-"`
}

SearchOptions allow filtering and paginating the list of schedules.

type Store

type Store interface {
	ReadStore
	Create(context.Context, *Schedule) (*Schedule, error)
	CreateScheduleTx(context.Context, *sql.Tx, *Schedule) (*Schedule, error)
	Update(context.Context, *Schedule) error
	UpdateTx(context.Context, *sql.Tx, *Schedule) error
	Delete(context.Context, string) error
	DeleteTx(context.Context, *sql.Tx, string) error
	DeleteManyTx(context.Context, *sql.Tx, []string) error
	FindMany(context.Context, []string) ([]Schedule, error)
	FindOneForUpdate(ctx context.Context, tx *sql.Tx, id string) (*Schedule, error)

	Search(context.Context, *SearchOptions) ([]Schedule, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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