db

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Username string `yaml:"Username" mapstructure:"Username"`
	Password string `yaml:"Password" mapstructure:"Password"`
	IP       string `yaml:"IP" mapstructure:"IP"`
	Port     int    `yaml:"Port" mapstructure:"Port"`
	Database string `yaml:"Database" mapstructure:"Database"`
	Charset  string `yaml:"Charset" mapstructure:"Charset"`
}

func NewConfig

func NewConfig() Config

type DB

type DB struct {
	Config Config
	DB     *util.DB
	Logger *zap.Logger

	Closing chan struct{}
	Closed  chan struct{}
}

func NewDB

func NewDB(config Config) (*DB, error)

func (*DB) AddMetric

func (db *DB) AddMetric(metric *Metric) error

func (*DB) AddMetricNodeDB

func (db *DB) AddMetricNodeDB(metricNodeDB *MetricNodeDB) error

func (*DB) AddNode

func (db *DB) AddNode(node *Node) error

func (*DB) AddNodeDB

func (db *DB) AddNodeDB(nodeDB *NodeDB) error

func (*DB) AddTask

func (db *DB) AddTask(task *Task) error

func (*DB) Close

func (db *DB) Close() error

func (*DB) GetMetricByID

func (db *DB) GetMetricByID(id int64) (*Metric, error)

func (*DB) GetNodeByID

func (db *DB) GetNodeByID(id int64) (*Node, error)

func (*DB) GetNodeDBByID

func (db *DB) GetNodeDBByID(id int64) (*NodeDB, error)

func (*DB) GetTaskByID

func (db *DB) GetTaskByID(taskID int64) (*Task, error)

func (*DB) ListMetricNodeDB

func (db *DB) ListMetricNodeDB() ([]*MetricNodeDB, error)

func (*DB) ListMetricNodeDBByMetricID

func (db *DB) ListMetricNodeDBByMetricID(metricID int64) ([]*MetricNodeDB, error)

func (*DB) ListMetrics

func (db *DB) ListMetrics() ([]*Metric, error)

func (*DB) ListNodeDB

func (db *DB) ListNodeDB() ([]*NodeDB, error)

func (*DB) ListNodeDBByNodeID

func (db *DB) ListNodeDBByNodeID(nodeID int64) ([]*NodeDB, error)

func (*DB) ListNodes

func (db *DB) ListNodes() ([]*Node, error)

func (*DB) ListTask

func (db *DB) ListTask(taskStatus ...int) ([]*Task, error)

func (*DB) Open

func (db *DB) Open() error

func (*DB) UpdateMetric

func (db *DB) UpdateMetric(metric *Metric, columns ...string) (int64, error)

func (*DB) UpdateNode

func (db *DB) UpdateNode(node *Node, columns ...string) (int64, error)

func (*DB) UpdateNodeDB

func (db *DB) UpdateNodeDB(nodeDB *NodeDB, columns ...string) (int64, error)

func (*DB) UpdateTask

func (db *DB) UpdateTask(task *Task, columns ...string) (int64, error)

func (*DB) UpdatedMetricNodeDB

func (db *DB) UpdatedMetricNodeDB(metricNodeDB *MetricNodeDB, columns ...string) (int64, error)

func (*DB) WithLogger

func (db *DB) WithLogger(logger *zap.Logger)

Jump to

Keyboard shortcuts

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