scheduler

package
v0.0.0-...-d0044fe Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle()

Types

type Conf

type Conf struct {
	DB struct {
		Host     string `yaml:"host"`
		Port     string `yaml:"port"`
		User     string `yaml:"user"`
		Password string `yaml:"password"`
		DBName   string `yaml:"dbname"`
	}
	MSG struct {
		Host     string `yaml:"host"`
		Port     string `yaml:"port"`
		User     string `yaml:"user"`
		Password string `yaml:"password"`
	}
	SDL struct {
		Cron string `yaml:"cron"`
	}
}

func NewConf

func NewConf() *Conf

type DB

type DB interface {
	Connect() (*gorm.DB, error)
}

func NewDB

func NewDB(config *Conf) *DB

type EncodeService

type EncodeService interface {
	Encode(interface{}) (string, error)
}

func NewJsonEncoder

func NewJsonEncoder() *EncodeService

type Item

type Item struct {
	Url string
}

func NewItem

func NewItem(url *string) *Item

type JsonEncoder

type JsonEncoder struct {
}

func (*JsonEncoder) Encode

func (j *JsonEncoder) Encode(item interface{}) (string, error)

type Mq

type Mq interface {
	Connect() error
	Close()
	Send(string) error
}

func NewMq

func NewMq(config *Conf, name string) *Mq

type MqImpl

type MqImpl struct {
	Config *Conf

	Conn *amqp.Connection
	Ch   *amqp.Channel
	Q    *amqp.Queue
	// contains filtered or unexported fields
}

func (*MqImpl) Close

func (m *MqImpl) Close()

func (*MqImpl) Connect

func (m *MqImpl) Connect() error

func (*MqImpl) Send

func (m *MqImpl) Send(msg string) error

type Publisher

type Publisher interface {
	Publish() error
}

func NewPublisher

func NewPublisher(conf *Conf, encoder *EncodeService) *Publisher

type Scheduler

type Scheduler interface {
	Run(func())
}

func NewScheduler

func NewScheduler(cronExpr string) *Scheduler

type SourceService

type SourceService interface {
	Add(Item) error

	Get() <-chan rxgo.Item
}

func NewSourceService

func NewSourceService(config *Conf) *SourceService

type UrlItem

type UrlItem struct {
	gorm.Model
	Url string
}

func NewUrlItem

func NewUrlItem(url string) *UrlItem

Jump to

Keyboard shortcuts

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