Documentation ¶
Index ¶
- Constants
- Variables
- func SetupDB()
- type AccessLogDAOInterface
- type AgentLogDAOInterface
- type AgentValueDAOInterface
- type AuditLogDAOInterface
- type AvgExpr
- type BaseDriver
- type DriverInterface
- type Expr
- type MaxExpr
- type MinExpr
- type MongoAccessLogDAO
- func (this *MongoAccessLogDAO) FindAccessLogCookie(day string, logId string) (*accesslogs.AccessLog, error)
- func (this *MongoAccessLogDAO) FindRequestHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error)
- func (this *MongoAccessLogDAO) FindResponseHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error)
- func (this *MongoAccessLogDAO) HasAccessLog(day string, serverId string) (bool, error)
- func (this *MongoAccessLogDAO) HasNextAccessLog(day string, serverId string, fromId string, onlyErrors bool, searchIP string) (bool, error)
- func (this *MongoAccessLogDAO) Init()
- func (this *MongoAccessLogDAO) InsertAccessLogs(accessLogList []interface{}) error
- func (this *MongoAccessLogDAO) InsertOne(accessLog *accesslogs.AccessLog) error
- func (this *MongoAccessLogDAO) ListAccessLogs(day string, serverId string, fromId string, onlyErrors bool, searchIP string, ...) ([]*accesslogs.AccessLog, error)
- func (this *MongoAccessLogDAO) ListLatestAccessLogs(day string, serverId string, fromId string, onlyErrors bool, size int) ([]*accesslogs.AccessLog, error)
- func (this *MongoAccessLogDAO) ListTopAccessLogs(day string, size int) ([]*accesslogs.AccessLog, error)
- func (this *MongoAccessLogDAO) QueryAccessLogs(day string, serverId string, query *Query) ([]*accesslogs.AccessLog, error)
- func (this *MongoAccessLogDAO) TableName(day string) string
- type MongoAgentLogDAO
- func (this *MongoAgentLogDAO) FindLatestTaskLog(agentId string, taskId string) (*agents.ProcessLog, error)
- func (this *MongoAgentLogDAO) FindLatestTaskLogs(agentId string, taskId string, fromId string, size int) ([]*agents.ProcessLog, error)
- func (this *MongoAgentLogDAO) Init()
- func (this *MongoAgentLogDAO) InsertOne(agentId string, log *agents.ProcessLog) error
- func (this *MongoAgentLogDAO) TableName(agentId string) string
- type MongoAgentValueDAO
- func (this *MongoAgentValueDAO) ClearItemValues(agentId string, appId string, itemId string, level notices.NoticeLevel) error
- func (this *MongoAgentValueDAO) DropAgentTable(agentId string) error
- func (this *MongoAgentValueDAO) FindLatestItemValue(agentId string, appId string, itemId string) (*agents.Value, error)
- func (this *MongoAgentValueDAO) FindLatestItemValueNoError(agentId string, appId string, itemId string) (*agents.Value, error)
- func (this *MongoAgentValueDAO) FindLatestItemValues(agentId string, appId string, itemId string, noticeLevel notices.NoticeLevel, ...) ([]*agents.Value, error)
- func (this *MongoAgentValueDAO) GroupValuesByTime(query *Query, timeField string, result map[string]Expr) ([]*agents.Value, error)
- func (this *MongoAgentValueDAO) Init()
- func (this *MongoAgentValueDAO) Insert(agentId string, value *agents.Value) error
- func (this *MongoAgentValueDAO) ListItemValues(agentId string, appId string, itemId string, noticeLevel notices.NoticeLevel, ...) ([]*agents.Value, error)
- func (this *MongoAgentValueDAO) QueryValues(query *Query) ([]*agents.Value, error)
- func (this *MongoAgentValueDAO) TableName(agentId string) string
- type MongoAuditLogDAO
- type MongoDriver
- func (this *MongoDriver) Avg(query *Query, field string) (float64, error)
- func (this *MongoDriver) Count(query *Query) (int64, error)
- func (this *MongoDriver) DeleteOnes(query *Query) error
- func (this *MongoDriver) FindOne(query *Query, modelPtr interface{}) (interface{}, error)
- func (this *MongoDriver) FindOnes(query *Query, modelPtr interface{}) ([]interface{}, error)
- func (this *MongoDriver) Group(query *Query, field string, result map[string]Expr) ([]maps.Map, error)
- func (this *MongoDriver) Init()
- func (this *MongoDriver) InsertOne(table string, modelPtr interface{}) error
- func (this *MongoDriver) InsertOnes(table string, modelPtrSlice interface{}) error
- func (this *MongoDriver) Max(query *Query, field string) (float64, error)
- func (this *MongoDriver) Min(query *Query, field string) (float64, error)
- func (this *MongoDriver) Sum(query *Query, field string) (float64, error)
- func (this *MongoDriver) Test() error
- type MongoNoticeDAO
- func (this *MongoNoticeDAO) CountAllReadNotices() (int, error)
- func (this *MongoNoticeDAO) CountAllUnreadNotices() (int, error)
- func (this *MongoNoticeDAO) CountReadNoticesForAgent(agentId string) (int, error)
- func (this *MongoNoticeDAO) CountReceivedNotices(receiverId string, cond map[string]interface{}, minutes int) (int, error)
- func (this *MongoNoticeDAO) CountUnreadNoticesForAgent(agentId string) (int, error)
- func (this *MongoNoticeDAO) DeleteNoticesForAgent(agentId string) error
- func (this *MongoNoticeDAO) ExistNoticesWithHash(hash string, cond map[string]interface{}, duration time.Duration) (bool, error)
- func (this *MongoNoticeDAO) Init()
- func (this *MongoNoticeDAO) InsertOne(notice *notices.Notice) error
- func (this *MongoNoticeDAO) ListAgentNotices(agentId string, isRead bool, offset int, size int) ([]*notices.Notice, error)
- func (this *MongoNoticeDAO) ListNotices(isRead bool, offset int, size int) ([]*notices.Notice, error)
- func (this *MongoNoticeDAO) NotifyProxyMessage(cond notices.ProxyCond, message string) error
- func (this *MongoNoticeDAO) NotifyProxyServerMessage(serverId string, level notices.NoticeLevel, message string) error
- func (this *MongoNoticeDAO) TableName() string
- func (this *MongoNoticeDAO) UpdateAgentNoticesRead(agentId string, noticeIds []string) error
- func (this *MongoNoticeDAO) UpdateAllAgentNoticesRead(agentId string) error
- func (this *MongoNoticeDAO) UpdateAllNoticesRead() error
- func (this *MongoNoticeDAO) UpdateNoticeReceivers(noticeId string, receiverIds []string) error
- func (this *MongoNoticeDAO) UpdateNoticesRead(noticeIds []string) error
- type MongoServerValueDAO
- func (this *MongoServerValueDAO) CreateIndex(serverId string, fields []*shared.IndexField) error
- func (this *MongoServerValueDAO) DeleteExpiredValues(serverId string, period stats.ValuePeriod, life int) error
- func (this *MongoServerValueDAO) DropServerTable(serverId string) error
- func (this *MongoServerValueDAO) FindOneWithItem(serverId string, item string) (*stats.Value, error)
- func (this *MongoServerValueDAO) FindSameItemValue(serverId string, item *stats.Value) (*stats.Value, error)
- func (this *MongoServerValueDAO) Init()
- func (this *MongoServerValueDAO) InsertOne(serverId string, value *stats.Value) error
- func (this *MongoServerValueDAO) QueryValues(query *Query) ([]*stats.Value, error)
- func (this *MongoServerValueDAO) TableName(serverId string) string
- func (this *MongoServerValueDAO) UpdateItemValueAndTimestamp(serverId string, valueId string, value map[string]interface{}, timestamp int64) error
- type MySQLDriver
- type NoticeDAOInterface
- type Operand
- type OperandCode
- type OperandMap
- type PostgresDriver
- type Query
- func (this *Query) Asc(field string) *Query
- func (this *Query) Attr(field string, value interface{}) *Query
- func (this *Query) Avg(field string) (float64, error)
- func (this *Query) Count() (int64, error)
- func (this *Query) Debug() *Query
- func (this *Query) Delete() error
- func (this *Query) Desc(field string) *Query
- func (this *Query) FindOne(modelPtr interface{}) (interface{}, error)
- func (this *Query) FindOnes(modelPtr interface{}) ([]interface{}, error)
- func (this *Query) Group(field string, result map[string]Expr) ([]maps.Map, error)
- func (this *Query) Gt(field string, value interface{}) *Query
- func (this *Query) Gte(field string, value interface{}) *Query
- func (this *Query) Init() *Query
- func (this *Query) InsertOne(modelPtr interface{}) error
- func (this *Query) InsertOnes(modelPtrSlice interface{}) error
- func (this *Query) Limit(size int) *Query
- func (this *Query) Lt(field string, value interface{}) *Query
- func (this *Query) Lte(field string, value interface{}) *Query
- func (this *Query) Max(field string) (float64, error)
- func (this *Query) Min(field string) (float64, error)
- func (this *Query) Node() *Query
- func (this *Query) Not(field string, value interface{}) *Query
- func (this *Query) Offset(offset int) *Query
- func (this *Query) Op(field string, operandCode OperandCode, value interface{}) *Query
- func (this *Query) Or(fieldValues []OperandMap) *Query
- func (this *Query) Result(field ...string) *Query
- func (this *Query) Sum(field string) (float64, error)
- func (this *Query) Table(table string) *Query
- func (this *Query) Timeout(timeout time.Duration) *Query
- type ServerValueDAOInterface
- type SortField
- type SortType
- type SumExpr
Constants ¶
View Source
const ( SortAsc = "asc" SortDesc = "desc" )
Variables ¶
Functions ¶
Types ¶
type AccessLogDAOInterface ¶
type AccessLogDAOInterface interface { // 初始化 Init() // 获取表名 TableName(day string) string // 写入一条日志 InsertOne(accessLog *accesslogs.AccessLog) error // 写入一组日志 InsertAccessLogs(accessLogList []interface{}) error // 查找某条访问日志的cookie信息 FindAccessLogCookie(day string, logId string) (*accesslogs.AccessLog, error) // 查找某条访问日志的请求信息 FindRequestHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error) // 查找某条访问日志的响应信息 FindResponseHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error) // 列出日志 ListAccessLogs(day string, serverId string, fromId string, onlyErrors bool, searchIP string, offset int, size int) ([]*accesslogs.AccessLog, error) // 检查是否有下一条日志 HasNextAccessLog(day string, serverId string, fromId string, onlyErrors bool, searchIP string) (bool, error) // 判断某个代理服务是否有日志 HasAccessLog(day string, serverId string) (bool, error) // 列出最近的某些日志 ListLatestAccessLogs(day string, serverId string, fromId string, onlyErrors bool, size int) ([]*accesslogs.AccessLog, error) // 列出某天的一些日志 ListTopAccessLogs(day string, size int) ([]*accesslogs.AccessLog, error) // 根据查询条件来查找日志 QueryAccessLogs(day string, serverId string, query *Query) ([]*accesslogs.AccessLog, error) }
func AccessLogDAO ¶
func AccessLogDAO() AccessLogDAOInterface
type AgentLogDAOInterface ¶
type AgentLogDAOInterface interface { // 初始化 Init() // 插入一条数据 InsertOne(agentId string, log *agents.ProcessLog) error // 获取最新任务的日志 FindLatestTaskLogs(agentId string, taskId string, fromId string, size int) ([]*agents.ProcessLog, error) // 获取任务最后一次的执行日志 FindLatestTaskLog(agentId string, taskId string) (*agents.ProcessLog, error) }
func AgentLogDAO ¶
func AgentLogDAO() AgentLogDAOInterface
type AgentValueDAOInterface ¶
type AgentValueDAOInterface interface { // 初始化 Init() // 获取表格 TableName(agentId string) string // 插入数据 Insert(agentId string, value *agents.Value) error // 清除数值 ClearItemValues(agentId string, appId string, itemId string, level notices.NoticeLevel) error // 查找最近的一条记录 FindLatestItemValue(agentId string, appId string, itemId string) (*agents.Value, error) // 查找最近的一条非错误的记录 FindLatestItemValueNoError(agentId string, appId string, itemId string) (*agents.Value, error) // 取得最近的数值记录 FindLatestItemValues(agentId string, appId string, itemId string, noticeLevel notices.NoticeLevel, lastId string, size int) ([]*agents.Value, error) // 列出数值 ListItemValues(agentId string, appId string, itemId string, noticeLevel notices.NoticeLevel, lastId string, offset int, size int) ([]*agents.Value, error) // 分组查询 QueryValues(query *Query) ([]*agents.Value, error) // 根据时间对值进行分组查询 GroupValuesByTime(query *Query, timeField string, result map[string]Expr) ([]*agents.Value, error) // 删除Agent相关表 DropAgentTable(agentId string) error }
func AgentValueDAO ¶
func AgentValueDAO() AgentValueDAOInterface
type AuditLogDAOInterface ¶
type AuditLogDAOInterface interface { // 初始化 Init() // 计算审计日志数量 CountAllAuditLogs() (int64, error) // 列出审计日志 ListAuditLogs(offset int, size int) ([]*audits.Log, error) // 插入一条审计日志 InsertOne(auditLog *audits.Log) error }
func AuditLogDAO ¶
func AuditLogDAO() AuditLogDAOInterface
type BaseDriver ¶
type BaseDriver struct {
// contains filtered or unexported fields
}
func (*BaseDriver) IsAvailable ¶
func (this *BaseDriver) IsAvailable() bool
func (*BaseDriver) SetIsAvailable ¶
func (this *BaseDriver) SetIsAvailable(b bool)
type DriverInterface ¶
type DriverInterface interface { // 初始化 Init() // 设置是否可用 SetIsAvailable(b bool) // 取得是否可用 IsAvailable() bool // 查找单条记录 FindOne(query *Query, modelPtr interface{}) (interface{}, error) // 查找多条记录 FindOnes(query *Query, modelPtr interface{}) ([]interface{}, error) // 插入一条记录 InsertOne(table string, modelPtr interface{}) error // 插入多条记录 InsertOnes(table string, modelPtrSlice interface{}) error // 删除多条记录 DeleteOnes(query *Query) error // 计算总数量 Count(query *Query) (int64, error) // 计算总和 Sum(query *Query, field string) (float64, error) // 计算平均值 Avg(query *Query, field string) (float64, error) // 计算最小值 Min(query *Query, field string) (float64, error) // 计算最大值 Max(query *Query, field string) (float64, error) // 对数据进行分组统计 Group(query *Query, field string, result map[string]Expr) ([]maps.Map, error) // 测试数据库连接 Test() error }
func SharedDB ¶
func SharedDB() DriverInterface
type MongoAccessLogDAO ¶
type MongoAccessLogDAO struct { }
func (*MongoAccessLogDAO) FindAccessLogCookie ¶
func (this *MongoAccessLogDAO) FindAccessLogCookie(day string, logId string) (*accesslogs.AccessLog, error)
func (*MongoAccessLogDAO) FindRequestHeaderAndBody ¶
func (this *MongoAccessLogDAO) FindRequestHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error)
func (*MongoAccessLogDAO) FindResponseHeaderAndBody ¶
func (this *MongoAccessLogDAO) FindResponseHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error)
func (*MongoAccessLogDAO) HasAccessLog ¶
func (this *MongoAccessLogDAO) HasAccessLog(day string, serverId string) (bool, error)
func (*MongoAccessLogDAO) HasNextAccessLog ¶
func (*MongoAccessLogDAO) Init ¶
func (this *MongoAccessLogDAO) Init()
func (*MongoAccessLogDAO) InsertAccessLogs ¶
func (this *MongoAccessLogDAO) InsertAccessLogs(accessLogList []interface{}) error
写入一组日志
func (*MongoAccessLogDAO) InsertOne ¶
func (this *MongoAccessLogDAO) InsertOne(accessLog *accesslogs.AccessLog) error
写入一条日志
func (*MongoAccessLogDAO) ListAccessLogs ¶
func (*MongoAccessLogDAO) ListLatestAccessLogs ¶
func (this *MongoAccessLogDAO) ListLatestAccessLogs(day string, serverId string, fromId string, onlyErrors bool, size int) ([]*accesslogs.AccessLog, error)
func (*MongoAccessLogDAO) ListTopAccessLogs ¶
func (this *MongoAccessLogDAO) ListTopAccessLogs(day string, size int) ([]*accesslogs.AccessLog, error)
func (*MongoAccessLogDAO) QueryAccessLogs ¶
func (this *MongoAccessLogDAO) QueryAccessLogs(day string, serverId string, query *Query) ([]*accesslogs.AccessLog, error)
func (*MongoAccessLogDAO) TableName ¶
func (this *MongoAccessLogDAO) TableName(day string) string
type MongoAgentLogDAO ¶
type MongoAgentLogDAO struct { }
func (*MongoAgentLogDAO) FindLatestTaskLog ¶
func (this *MongoAgentLogDAO) FindLatestTaskLog(agentId string, taskId string) (*agents.ProcessLog, error)
获取任务最后一次的执行日志
func (*MongoAgentLogDAO) FindLatestTaskLogs ¶
func (this *MongoAgentLogDAO) FindLatestTaskLogs(agentId string, taskId string, fromId string, size int) ([]*agents.ProcessLog, error)
获取任务的日志
func (*MongoAgentLogDAO) Init ¶
func (this *MongoAgentLogDAO) Init()
func (*MongoAgentLogDAO) InsertOne ¶
func (this *MongoAgentLogDAO) InsertOne(agentId string, log *agents.ProcessLog) error
插入一条数据
func (*MongoAgentLogDAO) TableName ¶
func (this *MongoAgentLogDAO) TableName(agentId string) string
type MongoAgentValueDAO ¶
type MongoAgentValueDAO struct { }
func (*MongoAgentValueDAO) ClearItemValues ¶
func (this *MongoAgentValueDAO) ClearItemValues(agentId string, appId string, itemId string, level notices.NoticeLevel) error
func (*MongoAgentValueDAO) DropAgentTable ¶
func (this *MongoAgentValueDAO) DropAgentTable(agentId string) error
func (*MongoAgentValueDAO) FindLatestItemValue ¶
func (*MongoAgentValueDAO) FindLatestItemValueNoError ¶
func (*MongoAgentValueDAO) FindLatestItemValues ¶
func (this *MongoAgentValueDAO) FindLatestItemValues(agentId string, appId string, itemId string, noticeLevel notices.NoticeLevel, lastId string, size int) ([]*agents.Value, error)
取得最近的数值记录
func (*MongoAgentValueDAO) GroupValuesByTime ¶
func (*MongoAgentValueDAO) Init ¶
func (this *MongoAgentValueDAO) Init()
func (*MongoAgentValueDAO) Insert ¶
func (this *MongoAgentValueDAO) Insert(agentId string, value *agents.Value) error
func (*MongoAgentValueDAO) ListItemValues ¶
func (*MongoAgentValueDAO) QueryValues ¶
func (this *MongoAgentValueDAO) QueryValues(query *Query) ([]*agents.Value, error)
func (*MongoAgentValueDAO) TableName ¶
func (this *MongoAgentValueDAO) TableName(agentId string) string
type MongoAuditLogDAO ¶
type MongoAuditLogDAO struct { }
func (*MongoAuditLogDAO) CountAllAuditLogs ¶
func (this *MongoAuditLogDAO) CountAllAuditLogs() (int64, error)
func (*MongoAuditLogDAO) Init ¶
func (this *MongoAuditLogDAO) Init()
func (*MongoAuditLogDAO) InsertOne ¶
func (this *MongoAuditLogDAO) InsertOne(auditLog *audits.Log) error
func (*MongoAuditLogDAO) ListAuditLogs ¶
type MongoDriver ¶
type MongoDriver struct {
BaseDriver
}
func (*MongoDriver) DeleteOnes ¶
func (this *MongoDriver) DeleteOnes(query *Query) error
func (*MongoDriver) FindOne ¶
func (this *MongoDriver) FindOne(query *Query, modelPtr interface{}) (interface{}, error)
func (*MongoDriver) FindOnes ¶
func (this *MongoDriver) FindOnes(query *Query, modelPtr interface{}) ([]interface{}, error)
func (*MongoDriver) Init ¶
func (this *MongoDriver) Init()
func (*MongoDriver) InsertOne ¶
func (this *MongoDriver) InsertOne(table string, modelPtr interface{}) error
func (*MongoDriver) InsertOnes ¶
func (this *MongoDriver) InsertOnes(table string, modelPtrSlice interface{}) error
type MongoNoticeDAO ¶
type MongoNoticeDAO struct { }
func (*MongoNoticeDAO) CountAllReadNotices ¶
func (this *MongoNoticeDAO) CountAllReadNotices() (int, error)
func (*MongoNoticeDAO) CountAllUnreadNotices ¶
func (this *MongoNoticeDAO) CountAllUnreadNotices() (int, error)
func (*MongoNoticeDAO) CountReadNoticesForAgent ¶
func (this *MongoNoticeDAO) CountReadNoticesForAgent(agentId string) (int, error)
func (*MongoNoticeDAO) CountReceivedNotices ¶
func (*MongoNoticeDAO) CountUnreadNoticesForAgent ¶
func (this *MongoNoticeDAO) CountUnreadNoticesForAgent(agentId string) (int, error)
func (*MongoNoticeDAO) DeleteNoticesForAgent ¶
func (this *MongoNoticeDAO) DeleteNoticesForAgent(agentId string) error
func (*MongoNoticeDAO) ExistNoticesWithHash ¶
func (*MongoNoticeDAO) Init ¶
func (this *MongoNoticeDAO) Init()
func (*MongoNoticeDAO) InsertOne ¶
func (this *MongoNoticeDAO) InsertOne(notice *notices.Notice) error
func (*MongoNoticeDAO) ListAgentNotices ¶
func (this *MongoNoticeDAO) ListAgentNotices(agentId string, isRead bool, offset int, size int) ([]*notices.Notice, error)
列出某个Agent相关的消息
func (*MongoNoticeDAO) ListNotices ¶
func (this *MongoNoticeDAO) ListNotices(isRead bool, offset int, size int) ([]*notices.Notice, error)
列出消息
func (*MongoNoticeDAO) NotifyProxyMessage ¶
func (this *MongoNoticeDAO) NotifyProxyMessage(cond notices.ProxyCond, message string) error
func (*MongoNoticeDAO) NotifyProxyServerMessage ¶
func (this *MongoNoticeDAO) NotifyProxyServerMessage(serverId string, level notices.NoticeLevel, message string) error
func (*MongoNoticeDAO) TableName ¶
func (this *MongoNoticeDAO) TableName() string
func (*MongoNoticeDAO) UpdateAgentNoticesRead ¶
func (this *MongoNoticeDAO) UpdateAgentNoticesRead(agentId string, noticeIds []string) error
设置Agent的一组通知已读
func (*MongoNoticeDAO) UpdateAllAgentNoticesRead ¶
func (this *MongoNoticeDAO) UpdateAllAgentNoticesRead(agentId string) error
设置Agent所有通知已读
func (*MongoNoticeDAO) UpdateAllNoticesRead ¶
func (this *MongoNoticeDAO) UpdateAllNoticesRead() error
func (*MongoNoticeDAO) UpdateNoticeReceivers ¶
func (this *MongoNoticeDAO) UpdateNoticeReceivers(noticeId string, receiverIds []string) error
func (*MongoNoticeDAO) UpdateNoticesRead ¶
func (this *MongoNoticeDAO) UpdateNoticesRead(noticeIds []string) error
设置一组通知已读
type MongoServerValueDAO ¶
type MongoServerValueDAO struct { }
func (*MongoServerValueDAO) CreateIndex ¶
func (this *MongoServerValueDAO) CreateIndex(serverId string, fields []*shared.IndexField) error
func (*MongoServerValueDAO) DeleteExpiredValues ¶
func (this *MongoServerValueDAO) DeleteExpiredValues(serverId string, period stats.ValuePeriod, life int) error
func (*MongoServerValueDAO) DropServerTable ¶
func (this *MongoServerValueDAO) DropServerTable(serverId string) error
删除代理服务相关表
func (*MongoServerValueDAO) FindOneWithItem ¶
func (*MongoServerValueDAO) FindSameItemValue ¶
func (this *MongoServerValueDAO) FindSameItemValue(serverId string, item *stats.Value) (*stats.Value, error)
根据参数查询已有的数据
func (*MongoServerValueDAO) Init ¶
func (this *MongoServerValueDAO) Init()
func (*MongoServerValueDAO) InsertOne ¶
func (this *MongoServerValueDAO) InsertOne(serverId string, value *stats.Value) error
func (*MongoServerValueDAO) QueryValues ¶
func (this *MongoServerValueDAO) QueryValues(query *Query) ([]*stats.Value, error)
func (*MongoServerValueDAO) TableName ¶
func (this *MongoServerValueDAO) TableName(serverId string) string
func (*MongoServerValueDAO) UpdateItemValueAndTimestamp ¶
type MySQLDriver ¶
type MySQLDriver struct { }
func (*MySQLDriver) Init ¶
func (this *MySQLDriver) Init()
type NoticeDAOInterface ¶
type NoticeDAOInterface interface { // 初始化 Init() // 写入一个通知 InsertOne(notice *notices.Notice) error // 发送一个代理的通知(形式1) NotifyProxyMessage(cond notices.ProxyCond, message string) error // 发送一个代理的通知(形式2) NotifyProxyServerMessage(serverId string, level notices.NoticeLevel, message string) error // 获取所有未读通知数 CountAllUnreadNotices() (int, error) // 获取所有已读通知数 CountAllReadNotices() (int, error) // 获取某个Agent的未读通知数 CountUnreadNoticesForAgent(agentId string) (int, error) // 获取某个Agent已读通知数 CountReadNoticesForAgent(agentId string) (int, error) // 获取某个接收人在某个时间段内接收的通知数 CountReceivedNotices(receiverId string, cond map[string]interface{}, minutes int) (int, error) // 通过Hash判断是否存在相同的消息 ExistNoticesWithHash(hash string, cond map[string]interface{}, duration time.Duration) (bool, error) // 列出消息 ListNotices(isRead bool, offset int, size int) ([]*notices.Notice, error) // 列出某个Agent相关的消息 ListAgentNotices(agentId string, isRead bool, offset int, size int) ([]*notices.Notice, error) // 删除Agent相关通知 DeleteNoticesForAgent(agentId string) error // 更改某个通知的接收人 UpdateNoticeReceivers(noticeId string, receiverIds []string) error // 设置全部已读 UpdateAllNoticesRead() error // 设置一组通知已读 UpdateNoticesRead(noticeIds []string) error // 设置Agent的一组通知已读 UpdateAgentNoticesRead(agentId string, noticeIds []string) error // 设置Agent所有通知已读 UpdateAllAgentNoticesRead(agentId string) error }
func NoticeDAO ¶
func NoticeDAO() NoticeDAOInterface
type Operand ¶
type Operand struct { Code OperandCode Value interface{} }
func NewOperand ¶
func NewOperand(code OperandCode, value interface{}) *Operand
type OperandCode ¶
type OperandCode = string
const ( OperandEq OperandCode = "eq" OperandLt OperandCode = "lt" OperandLte OperandCode = "lte" OperandGt OperandCode = "gt" OperandGte OperandCode = "gte" OperandIn OperandCode = "in" OperandNotIn OperandCode = "nin" OperandNeq OperandCode = "ne" OperandOr OperandCode = "or" )
type OperandMap ¶
type PostgresDriver ¶
type PostgresDriver struct { }
func (*PostgresDriver) Init ¶
func (this *PostgresDriver) Init()
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) InsertOnes ¶
func (*Query) Op ¶
func (this *Query) Op(field string, operandCode OperandCode, value interface{}) *Query
func (*Query) Or ¶
func (this *Query) Or(fieldValues []OperandMap) *Query
type ServerValueDAOInterface ¶
type ServerValueDAOInterface interface { // 初始化 Init() // 表名 TableName(serverId string) string // 插入新数据 InsertOne(serverId string, value *stats.Value) error // 删除过期的数据 DeleteExpiredValues(serverId string, period stats.ValuePeriod, life int) error // 查询相同的数值记录 FindSameItemValue(serverId string, item *stats.Value) (*stats.Value, error) // 修改值和时间戳 UpdateItemValueAndTimestamp(serverId string, valueId string, value map[string]interface{}, timestamp int64) error // 创建索引 CreateIndex(serverId string, fields []*shared.IndexField) error // 查询数据 QueryValues(query *Query) ([]*stats.Value, error) // 根据item查找一条数据 FindOneWithItem(serverId string, item string) (*stats.Value, error) // 删除代理服务相关表 DropServerTable(serverId string) error }
func ServerValueDAO ¶
func ServerValueDAO() ServerValueDAOInterface
Source Files ¶
- dao_access_log.go
- dao_access_log_mongo.go
- dao_agent_log.go
- dao_agent_log_mongo.go
- dao_agent_value.go
- dao_agent_value_mongo.go
- dao_audit_log.go
- dao_audit_log_mongo.go
- dao_notice.go
- dao_notice_mongo.go
- dao_server_value.go
- dao_server_value_mongo.go
- driver_base.go
- driver_interface.go
- driver_mongo.go
- driver_mysql.go
- driver_postgres.go
- expr.go
- expr_avg.go
- expr_max.go
- expr_min.go
- expr_sum.go
- init.go
- operand.go
- operand_map.go
- query.go
- sort_field.go
- utils.go
Click to show internal directories.
Click to hide internal directories.