models

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2018 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AgentNodeView = &agentNodeViewType{
	s: parse.StructInfo{Type: "AgentNode", SQLSchema: "", SQLName: "agent_nodes", Fields: []parse.FieldInfo{{Name: "AgentID", Type: "int32", Column: "agent_id"}, {Name: "NodeID", Type: "int32", Column: "node_id"}}, PKFieldIndex: -1},
	z: new(AgentNode).Values(),
}

AgentNodeView represents agent_nodes view or table in SQL database.

View Source
var AgentServiceView = &agentServiceViewType{
	s: parse.StructInfo{Type: "AgentService", SQLSchema: "", SQLName: "agent_services", Fields: []parse.FieldInfo{{Name: "AgentID", Type: "int32", Column: "agent_id"}, {Name: "ServiceID", Type: "int32", Column: "service_id"}}, PKFieldIndex: -1},
	z: new(AgentService).Values(),
}

AgentServiceView represents agent_services view or table in SQL database.

View Source
var AgentTable = &agentTableType{
	s: parse.StructInfo{Type: "Agent", SQLSchema: "", SQLName: "agents", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Type", Type: "AgentType", Column: "type"}, {Name: "RunsOnNodeID", Type: "int32", Column: "runs_on_node_id"}}, PKFieldIndex: 0},
	z: new(Agent).Values(),
}

AgentTable represents agents view or table in SQL database.

View Source
var MySQLdExporterTable = &mySQLdExporterTableType{
	s: parse.StructInfo{Type: "MySQLdExporter", SQLSchema: "", SQLName: "agents", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Type", Type: "AgentType", Column: "type"}, {Name: "RunsOnNodeID", Type: "int32", Column: "runs_on_node_id"}, {Name: "ServiceUsername", Type: "*string", Column: "service_username"}, {Name: "ServicePassword", Type: "*string", Column: "service_password"}, {Name: "ListenPort", Type: "*uint16", Column: "listen_port"}}, PKFieldIndex: 0},
	z: new(MySQLdExporter).Values(),
}

MySQLdExporterTable represents agents view or table in SQL database.

View Source
var NodeTable = &nodeTableType{
	s: parse.StructInfo{Type: "Node", SQLSchema: "", SQLName: "nodes", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Type", Type: "NodeType", Column: "type"}, {Name: "Name", Type: "string", Column: "name"}}, PKFieldIndex: 0},
	z: new(Node).Values(),
}

NodeTable represents nodes view or table in SQL database.

View Source
var QanAgentTable = &qanAgentTableType{
	s: parse.StructInfo{Type: "QanAgent", SQLSchema: "", SQLName: "agents", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Type", Type: "AgentType", Column: "type"}, {Name: "RunsOnNodeID", Type: "int32", Column: "runs_on_node_id"}, {Name: "ServiceUsername", Type: "*string", Column: "service_username"}, {Name: "ServicePassword", Type: "*string", Column: "service_password"}, {Name: "ListenPort", Type: "*uint16", Column: "listen_port"}, {Name: "QANDBInstanceUUID", Type: "*string", Column: "qan_db_instance_uuid"}}, PKFieldIndex: 0},
	z: new(QanAgent).Values(),
}

QanAgentTable represents agents view or table in SQL database.

View Source
var RDSExporterTable = &rDSExporterTableType{
	s: parse.StructInfo{Type: "RDSExporter", SQLSchema: "", SQLName: "agents", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Type", Type: "AgentType", Column: "type"}, {Name: "RunsOnNodeID", Type: "int32", Column: "runs_on_node_id"}, {Name: "ListenPort", Type: "*uint16", Column: "listen_port"}}, PKFieldIndex: 0},
	z: new(RDSExporter).Values(),
}

RDSExporterTable represents agents view or table in SQL database.

View Source
var RDSNodeTable = &rDSNodeTableType{
	s: parse.StructInfo{Type: "RDSNode", SQLSchema: "", SQLName: "nodes", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Type", Type: "NodeType", Column: "type"}, {Name: "Name", Type: "string", Column: "name"}, {Name: "Region", Type: "string", Column: "region"}}, PKFieldIndex: 0},
	z: new(RDSNode).Values(),
}

RDSNodeTable represents nodes view or table in SQL database.

View Source
var RDSServiceTable = &rDSServiceTableType{
	s: parse.StructInfo{Type: "RDSService", SQLSchema: "", SQLName: "services", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Type", Type: "ServiceType", Column: "type"}, {Name: "NodeID", Type: "int32", Column: "node_id"}, {Name: "AWSAccessKey", Type: "*string", Column: "aws_access_key"}, {Name: "AWSSecretKey", Type: "*string", Column: "aws_secret_key"}, {Name: "Address", Type: "*string", Column: "address"}, {Name: "Port", Type: "*uint16", Column: "port"}, {Name: "Engine", Type: "*string", Column: "engine"}, {Name: "EngineVersion", Type: "*string", Column: "engine_version"}}, PKFieldIndex: 0},
	z: new(RDSService).Values(),
}

RDSServiceTable represents services view or table in SQL database.

View Source
var ServiceTable = &serviceTableType{
	s: parse.StructInfo{Type: "Service", SQLSchema: "", SQLName: "services", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Type", Type: "ServiceType", Column: "type"}, {Name: "NodeID", Type: "int32", Column: "node_id"}}, PKFieldIndex: 0},
	z: new(Service).Values(),
}

ServiceTable represents services view or table in SQL database.

Functions

func OpenDB

func OpenDB(name, username, password string, logf reform.Printf) (*sql.DB, error)

Types

type Agent

type Agent struct {
	ID           int32     `reform:"id,pk"`
	Type         AgentType `reform:"type"`
	RunsOnNodeID int32     `reform:"runs_on_node_id"`
}

func AgentsForNodeID

func AgentsForNodeID(q *reform.Querier, nodeID int32) ([]Agent, error)

AgentsForNodeID returns agents providing insights for a given node.

func AgentsForServiceID

func AgentsForServiceID(q *reform.Querier, serviceID int32) ([]Agent, error)

AgentsForServiceID returns agents providing insights for a given service.

func (*Agent) HasPK

func (s *Agent) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Agent) PKPointer

func (s *Agent) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Agent) PKValue

func (s *Agent) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Agent) Pointers

func (s *Agent) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Agent) SetPK

func (s *Agent) SetPK(pk interface{})

SetPK sets record primary key.

func (Agent) String

func (s Agent) String() string

String returns a string representation of this struct or record.

func (*Agent) Table

func (s *Agent) Table() reform.Table

Table returns Table object for that record.

func (*Agent) Values

func (s *Agent) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Agent) View

func (s *Agent) View() reform.View

View returns View object for that struct.

type AgentNode

type AgentNode struct {
	AgentID int32 `reform:"agent_id"`
	NodeID  int32 `reform:"node_id"`
}

func (*AgentNode) Pointers

func (s *AgentNode) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (AgentNode) String

func (s AgentNode) String() string

String returns a string representation of this struct or record.

func (*AgentNode) Values

func (s *AgentNode) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*AgentNode) View

func (s *AgentNode) View() reform.View

View returns View object for that struct.

type AgentService

type AgentService struct {
	AgentID   int32 `reform:"agent_id"`
	ServiceID int32 `reform:"service_id"`
}

func (*AgentService) Pointers

func (s *AgentService) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (AgentService) String

func (s AgentService) String() string

String returns a string representation of this struct or record.

func (*AgentService) Values

func (s *AgentService) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*AgentService) View

func (s *AgentService) View() reform.View

View returns View object for that struct.

type AgentType

type AgentType string
const (
	MySQLdExporterAgentType AgentType = "mysqld_exporter"
	RDSExporterAgentType    AgentType = "rds_exporter"
	QanAgentAgentType       AgentType = "qan-agent"
)

func (*AgentType) Scan

func (u *AgentType) Scan(src interface{}) error

func (AgentType) Value

func (u AgentType) Value() (driver.Value, error)

type MySQLdExporter

type MySQLdExporter struct {
	ID           int32     `reform:"id,pk"`
	Type         AgentType `reform:"type"`
	RunsOnNodeID int32     `reform:"runs_on_node_id"`

	ServiceUsername *string `reform:"service_username"`
	ServicePassword *string `reform:"service_password"`
	ListenPort      *uint16 `reform:"listen_port"`
}

func (*MySQLdExporter) DSN

func (m *MySQLdExporter) DSN(service *RDSService) string

func (*MySQLdExporter) HasPK

func (s *MySQLdExporter) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*MySQLdExporter) NameForSupervisor

func (m *MySQLdExporter) NameForSupervisor() string

func (*MySQLdExporter) PKPointer

func (s *MySQLdExporter) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*MySQLdExporter) PKValue

func (s *MySQLdExporter) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*MySQLdExporter) Pointers

func (s *MySQLdExporter) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*MySQLdExporter) SetPK

func (s *MySQLdExporter) SetPK(pk interface{})

SetPK sets record primary key.

func (MySQLdExporter) String

func (s MySQLdExporter) String() string

String returns a string representation of this struct or record.

func (*MySQLdExporter) Table

func (s *MySQLdExporter) Table() reform.Table

Table returns Table object for that record.

func (*MySQLdExporter) Values

func (s *MySQLdExporter) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*MySQLdExporter) View

func (s *MySQLdExporter) View() reform.View

View returns View object for that struct.

type Node

type Node struct {
	ID   int32    `reform:"id,pk"`
	Type NodeType `reform:"type"`
	Name string   `reform:"name"`
}

func (*Node) HasPK

func (s *Node) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Node) PKPointer

func (s *Node) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Node) PKValue

func (s *Node) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Node) Pointers

func (s *Node) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Node) SetPK

func (s *Node) SetPK(pk interface{})

SetPK sets record primary key.

func (Node) String

func (s Node) String() string

String returns a string representation of this struct or record.

func (*Node) Table

func (s *Node) Table() reform.Table

Table returns Table object for that record.

func (*Node) Values

func (s *Node) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Node) View

func (s *Node) View() reform.View

View returns View object for that struct.

type NodeType

type NodeType string
const (
	PMMServerNodeType NodeType = "pmm-server"
	RDSNodeType       NodeType = "rds"
)

func (*NodeType) Scan

func (u *NodeType) Scan(src interface{}) error

func (NodeType) Value

func (u NodeType) Value() (driver.Value, error)

type QanAgent

type QanAgent struct {
	ID           int32     `reform:"id,pk"`
	Type         AgentType `reform:"type"`
	RunsOnNodeID int32     `reform:"runs_on_node_id"`

	ServiceUsername   *string `reform:"service_username"`
	ServicePassword   *string `reform:"service_password"`
	ListenPort        *uint16 `reform:"listen_port"`
	QANDBInstanceUUID *string `reform:"qan_db_instance_uuid"` // MySQL instance UUID in QAN
}

func (*QanAgent) DSN

func (q *QanAgent) DSN(service *RDSService) string

func (*QanAgent) HasPK

func (s *QanAgent) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*QanAgent) NameForSupervisor

func (q *QanAgent) NameForSupervisor() string

func (*QanAgent) PKPointer

func (s *QanAgent) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*QanAgent) PKValue

func (s *QanAgent) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*QanAgent) Pointers

func (s *QanAgent) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*QanAgent) SetPK

func (s *QanAgent) SetPK(pk interface{})

SetPK sets record primary key.

func (QanAgent) String

func (s QanAgent) String() string

String returns a string representation of this struct or record.

func (*QanAgent) Table

func (s *QanAgent) Table() reform.Table

Table returns Table object for that record.

func (*QanAgent) Values

func (s *QanAgent) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*QanAgent) View

func (s *QanAgent) View() reform.View

View returns View object for that struct.

type RDSExporter added in v1.6.0

type RDSExporter struct {
	ID           int32     `reform:"id,pk"`
	Type         AgentType `reform:"type"`
	RunsOnNodeID int32     `reform:"runs_on_node_id"`

	ListenPort *uint16 `reform:"listen_port"`
}

func (*RDSExporter) HasPK added in v1.6.0

func (s *RDSExporter) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*RDSExporter) NameForSupervisor added in v1.6.0

func (r *RDSExporter) NameForSupervisor() string

func (*RDSExporter) PKPointer added in v1.6.0

func (s *RDSExporter) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*RDSExporter) PKValue added in v1.6.0

func (s *RDSExporter) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*RDSExporter) Pointers added in v1.6.0

func (s *RDSExporter) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*RDSExporter) SetPK added in v1.6.0

func (s *RDSExporter) SetPK(pk interface{})

SetPK sets record primary key.

func (RDSExporter) String added in v1.6.0

func (s RDSExporter) String() string

String returns a string representation of this struct or record.

func (*RDSExporter) Table added in v1.6.0

func (s *RDSExporter) Table() reform.Table

Table returns Table object for that record.

func (*RDSExporter) Values added in v1.6.0

func (s *RDSExporter) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*RDSExporter) View added in v1.6.0

func (s *RDSExporter) View() reform.View

View returns View object for that struct.

type RDSNode

type RDSNode struct {
	ID   int32    `reform:"id,pk"`
	Type NodeType `reform:"type"`
	Name string   `reform:"name"` // DBInstanceIdentifier

	Region string `reform:"region"`
}

func (*RDSNode) HasPK

func (s *RDSNode) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*RDSNode) PKPointer

func (s *RDSNode) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*RDSNode) PKValue

func (s *RDSNode) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*RDSNode) Pointers

func (s *RDSNode) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*RDSNode) SetPK

func (s *RDSNode) SetPK(pk interface{})

SetPK sets record primary key.

func (RDSNode) String

func (s RDSNode) String() string

String returns a string representation of this struct or record.

func (*RDSNode) Table

func (s *RDSNode) Table() reform.Table

Table returns Table object for that record.

func (*RDSNode) Values

func (s *RDSNode) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*RDSNode) View

func (s *RDSNode) View() reform.View

View returns View object for that struct.

type RDSService

type RDSService struct {
	ID     int32       `reform:"id,pk"`
	Type   ServiceType `reform:"type"`
	NodeID int32       `reform:"node_id"`

	AWSAccessKey  *string `reform:"aws_access_key"` // may be nil
	AWSSecretKey  *string `reform:"aws_secret_key"` // may be nil
	Address       *string `reform:"address"`
	Port          *uint16 `reform:"port"`
	Engine        *string `reform:"engine"`
	EngineVersion *string `reform:"engine_version"`
}

func (*RDSService) HasPK

func (s *RDSService) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*RDSService) PKPointer

func (s *RDSService) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*RDSService) PKValue

func (s *RDSService) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*RDSService) Pointers

func (s *RDSService) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*RDSService) SetPK

func (s *RDSService) SetPK(pk interface{})

SetPK sets record primary key.

func (RDSService) String

func (s RDSService) String() string

String returns a string representation of this struct or record.

func (*RDSService) Table

func (s *RDSService) Table() reform.Table

Table returns Table object for that record.

func (*RDSService) Values

func (s *RDSService) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*RDSService) View

func (s *RDSService) View() reform.View

View returns View object for that struct.

type Service

type Service struct {
	ID     int32       `reform:"id,pk"`
	Type   ServiceType `reform:"type"`
	NodeID int32       `reform:"node_id"`
}

func (*Service) HasPK

func (s *Service) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Service) PKPointer

func (s *Service) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Service) PKValue

func (s *Service) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Service) Pointers

func (s *Service) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Service) SetPK

func (s *Service) SetPK(pk interface{})

SetPK sets record primary key.

func (Service) String

func (s Service) String() string

String returns a string representation of this struct or record.

func (*Service) Table

func (s *Service) Table() reform.Table

Table returns Table object for that record.

func (*Service) Values

func (s *Service) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Service) View

func (s *Service) View() reform.View

View returns View object for that struct.

type ServiceType

type ServiceType string
const (
	RDSServiceType ServiceType = "rds"
)

func (*ServiceType) Scan

func (u *ServiceType) Scan(src interface{}) error

func (ServiceType) Value

func (u ServiceType) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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