Documentation ¶
Index ¶
- Constants
- func NewPostgresStorage(config PostgresDBConfig) (postgres *postgresStorage, err error)
- type MemoryStorage
- type MongoDBConfig
- type MongoDBStorage
- func (mongodb MongoDBStorage) Add(task TaskAttributes) error
- func (mongodb *MongoDBStorage) Close() error
- func (mongodb *MongoDBStorage) Connect() error
- func (mongodb MongoDBStorage) Fetch() ([]TaskAttributes, error)
- func (mongodb *MongoDBStorage) Initialize() error
- func (mongodb MongoDBStorage) Remove(task TaskAttributes) error
- type NoOpStorage
- type PostgresDBConfig
- type Sqlite3Config
- type Sqlite3Storage
- func (sqlite Sqlite3Storage) Add(task TaskAttributes) error
- func (sqlite Sqlite3Storage) Close() error
- func (sqlite *Sqlite3Storage) Connect() error
- func (sqlite Sqlite3Storage) Fetch() ([]TaskAttributes, error)
- func (sqlite *Sqlite3Storage) Initialize() error
- func (sqlite Sqlite3Storage) Remove(task TaskAttributes) error
- type TaskAttributes
- type TaskStore
Constants ¶
const COLLECTION_NAME string = "task_store"
Variables ¶
This section is empty.
Functions ¶
func NewPostgresStorage ¶
func NewPostgresStorage(config PostgresDBConfig) (postgres *postgresStorage, err error)
creates new instance of postgres DB
Types ¶
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage is a memory task store
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
NewMemoryStorage returns an instance of MemoryStorage.
func (*MemoryStorage) Add ¶
func (memStore *MemoryStorage) Add(task TaskAttributes) error
Add adds a task to the memory store.
func (*MemoryStorage) Close ¶
func (memStore *MemoryStorage) Close() error
func (*MemoryStorage) Fetch ¶
func (memStore *MemoryStorage) Fetch() ([]TaskAttributes, error)
Fetch will return all tasks stored.
func (*MemoryStorage) Remove ¶
func (memStore *MemoryStorage) Remove(task TaskAttributes) error
Remove will remove task from store
type MongoDBConfig ¶
MongoDBConfig is the config structure holding information about mongo db.
type MongoDBStorage ¶
type MongoDBStorage struct {
// contains filtered or unexported fields
}
MongoDBStorage is the structure responsible for handling mongo storage.
func NewMongoDBStorage ¶
func NewMongoDBStorage(config MongoDBConfig) *MongoDBStorage
NewMongoDBStorage returns a new instance of MongoDBStorage.
func (MongoDBStorage) Add ¶
func (mongodb MongoDBStorage) Add(task TaskAttributes) error
Stores the task to mongo
func (*MongoDBStorage) Close ¶
func (mongodb *MongoDBStorage) Close() error
Close will close the open DB file.
func (*MongoDBStorage) Connect ¶
func (mongodb *MongoDBStorage) Connect() error
Connect creates the database file.
func (MongoDBStorage) Fetch ¶
func (mongodb MongoDBStorage) Fetch() ([]TaskAttributes, error)
Fetch will return the list of all stored tasks.
func (*MongoDBStorage) Initialize ¶
func (mongodb *MongoDBStorage) Initialize() error
Initialize mongodb collection
func (MongoDBStorage) Remove ¶
func (mongodb MongoDBStorage) Remove(task TaskAttributes) error
Remove will delete the task from storage.
type NoOpStorage ¶
type NoOpStorage struct { }
NoOpStorage is an ineffective storage which can be used to prevent storing tasks altogether.
func NewNoOpStorage ¶
func NewNoOpStorage() NoOpStorage
NewNoOpStorage returns an instance of NoOpStorage
func (NoOpStorage) Close ¶
func (noop NoOpStorage) Close() error
func (NoOpStorage) Fetch ¶
func (noop NoOpStorage) Fetch() ([]TaskAttributes, error)
Fetch returns an empty list of tasks
func (NoOpStorage) Remove ¶
func (noop NoOpStorage) Remove(task TaskAttributes) error
Remove does nothing
type PostgresDBConfig ¶
type PostgresDBConfig struct {
DbURL string
}
type Sqlite3Config ¶
type Sqlite3Config struct {
DbName string
}
Sqlite3Config is the config structure holding information about sqlite db.
type Sqlite3Storage ¶
type Sqlite3Storage struct {
// contains filtered or unexported fields
}
Sqlite3Storage is the structure responsible for handling sqlite3 storage.
func NewSqlite3Storage ¶
func NewSqlite3Storage(config Sqlite3Config) Sqlite3Storage
NewSqlite3Storage returns a new instance of Sqlite3Storage.
func (Sqlite3Storage) Add ¶
func (sqlite Sqlite3Storage) Add(task TaskAttributes) error
Add stores the task to sqlite.
func (Sqlite3Storage) Close ¶
func (sqlite Sqlite3Storage) Close() error
Close will close the open DB file.
func (*Sqlite3Storage) Connect ¶
func (sqlite *Sqlite3Storage) Connect() error
Connect creates the database file.
func (Sqlite3Storage) Fetch ¶
func (sqlite Sqlite3Storage) Fetch() ([]TaskAttributes, error)
Fetch will return the list of all stored tasks.
func (*Sqlite3Storage) Initialize ¶
func (sqlite *Sqlite3Storage) Initialize() error
Initialize will run once to initialize the state of the database into the required one. In this case, it'll create the tables required to store task information.
func (Sqlite3Storage) Remove ¶
func (sqlite Sqlite3Storage) Remove(task TaskAttributes) error
Remove will delete the task from storage.
type TaskAttributes ¶
type TaskAttributes struct { Hash string Name string LastRun string NextRun string Duration string IsRecurring string Params string }
TaskAttributes is a struct which is used to transfer data from/to stores. All task data are converted from/to string to prevent the store from worrying about details of converting data to the proper formats.
type TaskStore ¶
type TaskStore interface { Add(TaskAttributes) error Fetch() ([]TaskAttributes, error) Remove(TaskAttributes) error Close() error }
TaskStore is the interface to implement when adding custom task storage.