entities

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Connect()
	GetServices() []Service
	SaveResult(Result)
	Close()
}
var DB_instance DB

type DB_TYPE

type DB_TYPE string
const (
	Mongo_DB    DB_TYPE = "mongo"
	Postgres_DB DB_TYPE = "postgres"
	JSON        DB_TYPE = "json"
)

type EmptyService

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

func (*EmptyService) Run

func (service *EmptyService) Run() Result

type HTTPService

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

func (*HTTPService) Run

func (service *HTTPService) Run() (res Result)

type JsonDB

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

func (*JsonDB) Close

func (db *JsonDB) Close()

func (*JsonDB) Connect

func (db *JsonDB) Connect()

func (*JsonDB) GetServices

func (db *JsonDB) GetServices() []Service

func (*JsonDB) SaveResult

func (db *JsonDB) SaveResult(res Result)

type JsonFile

type JsonFile struct {
	Services []Service `json:"services"`
	Results  []Result  `json:"results"`
}

type MongoService

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

func (*MongoService) Run

func (service *MongoService) Run() (res Result)

type PostgresDB

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

func (*PostgresDB) Close

func (db *PostgresDB) Close()

func (*PostgresDB) Connect

func (db *PostgresDB) Connect()

func (*PostgresDB) GetServices

func (db *PostgresDB) GetServices() []Service

func (*PostgresDB) SaveResult

func (db *PostgresDB) SaveResult(res Result)

type RedisService

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

func (*RedisService) Run

func (service *RedisService) Run() (res Result)

type Result

type Result struct {
	ServiceId int64     `mapstructure:"id" json:"id" gorm:"primaryKey"`
	Success   bool      `mapstructure:"success" json:"success"`
	Reason    string    `mapstructure:"reason" json:"reason"`
	CronTime  time.Time `mapstructure:"cron_time" json:"cron_time"`
}

type SQLService

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

func (*SQLService) Run

func (service *SQLService) Run() (res Result)

type Service

type Service struct {
	Id   int64       `mapstructure:"id" json:"id" gorm:"primaryKey"`
	Name string      `mapstructure:"name" json:"name"`
	Url  string      `mapstructure:"url" json:"url"`
	Type ServiceType `mapstructure:"type" json:"type"`
	Cron string      `mapstructure:"cron" json:"cron"`
	Data ServiceData `mapstructure:"data" json:"data"`
}

type ServiceData

type ServiceData map[string]interface{}

func (*ServiceData) Scan

func (a *ServiceData) Scan(value interface{}) error

func (*ServiceData) Value

func (a *ServiceData) Value() (driver.Value, error)

type ServiceI

type ServiceI interface {
	Run() Result
}

func MapService

func MapService(s Service) ServiceI

type ServiceType

type ServiceType string
const (
	HTTP  ServiceType = "http"
	Redis ServiceType = "redis"
	SQL   ServiceType = "sql"
	Mongo ServiceType = "mongo"
	Empty ServiceType = ""
)

Jump to

Keyboard shortcuts

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