Documentation
¶
Index ¶
- Constants
- Variables
- func AddHook(hook *Hook)
- func BSONArrayBytes(data []byte) (interface{}, error)
- func BSONDecode(value interface{}) (interface{}, error)
- func ChangeDB()
- func SetupDB()
- type AccessLogDAOInterface
- type AgentLogDAOInterface
- type AgentValueDAOInterface
- type AuditLogDAOInterface
- type AvgExpr
- type BaseDAO
- type BaseDriver
- type DriverInterface
- type Expr
- type Hook
- 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) GroupWAFRuleGroups(day string, wafId string) ([]maps.Map, error)
- func (this *MongoAccessLogDAO) HasAccessLog(day string, serverId string) (bool, error)
- func (this *MongoAccessLogDAO) HasAccessLogWithWAF(day string, wafId string) (bool, error)
- func (this *MongoAccessLogDAO) HasNextAccessLog(day string, serverId string, fromId string, onlyErrors bool, searchIP string) (bool, error)
- func (this *MongoAccessLogDAO) HasNextAccessLogWithWAF(day string, wafId 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) InsertingTableName(day string) string
- func (this *MongoAccessLogDAO) ListAccessLogs(day string, serverId string, fromId string, onlyErrors bool, searchIP string, ...) ([]*accesslogs.AccessLog, error)
- func (this *MongoAccessLogDAO) ListAccessLogsWithWAF(day string, wafId 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) DropAgentTable(agentId string) error
- 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 MongoCollection
- type MongoDriver
- func (this *MongoDriver) Avg(query *Query, field string) (float64, error)
- func (this *MongoDriver) Count(query *Query) (int64, error)
- func (this *MongoDriver) DB() *mongo.Database
- func (this *MongoDriver) DeleteOnes(query *Query) error
- func (this *MongoDriver) DropTable(table string) 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) ListTables() ([]string, error)
- func (this *MongoDriver) Max(query *Query, field string) (float64, error)
- func (this *MongoDriver) Min(query *Query, field string) (float64, error)
- func (this *MongoDriver) SelectColl(name string) (*MongoCollection, error)
- func (this *MongoDriver) Shutdown() error
- func (this *MongoDriver) StatTables(tables []string) (map[string]*TableStat, error)
- func (this *MongoDriver) Sum(query *Query, field string) (float64, error)
- func (this *MongoDriver) Test() error
- func (this *MongoDriver) TestConfig(config *db.MongoConfig) (message string, ok bool)
- 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
- func (this *MySQLDriver) CheckTableExists(table string) (bool, error)
- func (this *MySQLDriver) CreateTable(table string, definitionSQL string) error
- func (this *MySQLDriver) Init()
- func (this *MySQLDriver) ListTables() ([]string, error)
- func (this *MySQLDriver) StatTables(tables []string) (map[string]*TableStat, error)
- func (this *MySQLDriver) TestDSN(dsn string, autoCreateDB bool) (message string, ok bool)
- type NoticeDAOInterface
- type Operand
- type OperandCode
- type OperandList
- type PostgresDriver
- func (this *PostgresDriver) CheckTableExists(table string) (bool, error)
- func (this *PostgresDriver) CreateTable(table string, definitionSQL string) error
- func (this *PostgresDriver) Init()
- func (this *PostgresDriver) ListTables() ([]string, error)
- func (this *PostgresDriver) StatTables(tables []string) (map[string]*TableStat, error)
- func (this *PostgresDriver) TestDSN(dsn string, autoCreateDB bool) (message string, ok bool)
- 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) FieldMap(mapping func(field string) 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 []*OperandList) *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 SQLAccessLogDAO
- func (this *SQLAccessLogDAO) FindAccessLogCookie(day string, logId string) (*accesslogs.AccessLog, error)
- func (this *SQLAccessLogDAO) FindRequestHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error)
- func (this *SQLAccessLogDAO) FindResponseHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error)
- func (this *SQLAccessLogDAO) GroupWAFRuleGroups(day string, wafId string) ([]maps.Map, error)
- func (this *SQLAccessLogDAO) HasAccessLog(day string, serverId string) (bool, error)
- func (this *SQLAccessLogDAO) HasAccessLogWithWAF(day string, wafId string) (bool, error)
- func (this *SQLAccessLogDAO) HasNextAccessLog(day string, serverId string, fromId string, onlyErrors bool, searchIP string) (bool, error)
- func (this *SQLAccessLogDAO) HasNextAccessLogWithWAF(day string, wafId string, fromId string, onlyErrors bool, searchIP string) (bool, error)
- func (this *SQLAccessLogDAO) Init()
- func (this *SQLAccessLogDAO) InsertAccessLogs(accessLogList []interface{}) error
- func (this *SQLAccessLogDAO) InsertOne(accessLog *accesslogs.AccessLog) error
- func (this *SQLAccessLogDAO) ListAccessLogs(day string, serverId string, fromId string, onlyErrors bool, searchIP string, ...) ([]*accesslogs.AccessLog, error)
- func (this *SQLAccessLogDAO) ListAccessLogsWithWAF(day string, wafId string, fromId string, onlyErrors bool, searchIP string, ...) ([]*accesslogs.AccessLog, error)
- func (this *SQLAccessLogDAO) ListLatestAccessLogs(day string, serverId string, fromId string, onlyErrors bool, size int) ([]*accesslogs.AccessLog, error)
- func (this *SQLAccessLogDAO) ListTopAccessLogs(day string, size int) ([]*accesslogs.AccessLog, error)
- func (this *SQLAccessLogDAO) QueryAccessLogs(day string, serverId string, query *Query) ([]*accesslogs.AccessLog, error)
- func (this *SQLAccessLogDAO) TableName(day string) string
- func (this *SQLAccessLogDAO) TodayTableName() string
- type SQLAction
- type SQLAgentLogDAO
- func (this *SQLAgentLogDAO) DropAgentTable(agentId string) error
- func (this *SQLAgentLogDAO) FindLatestTaskLog(agentId string, taskId string) (*agents.ProcessLog, error)
- func (this *SQLAgentLogDAO) FindLatestTaskLogs(agentId string, taskId string, fromId string, size int) ([]*agents.ProcessLog, error)
- func (this *SQLAgentLogDAO) Init()
- func (this *SQLAgentLogDAO) InsertOne(agentId string, log *agents.ProcessLog) error
- func (this *SQLAgentLogDAO) TableName(agentId string) string
- type SQLAgentValueDAO
- func (this *SQLAgentValueDAO) ClearItemValues(agentId string, appId string, itemId string, level notices.NoticeLevel) error
- func (this *SQLAgentValueDAO) DropAgentTable(agentId string) error
- func (this *SQLAgentValueDAO) FindLatestItemValue(agentId string, appId string, itemId string) (*agents.Value, error)
- func (this *SQLAgentValueDAO) FindLatestItemValueNoError(agentId string, appId string, itemId string) (*agents.Value, error)
- func (this *SQLAgentValueDAO) FindLatestItemValues(agentId string, appId string, itemId string, noticeLevel notices.NoticeLevel, ...) ([]*agents.Value, error)
- func (this *SQLAgentValueDAO) GroupValuesByTime(query *Query, timeField string, result map[string]Expr) ([]*agents.Value, error)
- func (this *SQLAgentValueDAO) Init()
- func (this *SQLAgentValueDAO) Insert(agentId string, value *agents.Value) error
- func (this *SQLAgentValueDAO) ListItemValues(agentId string, appId string, itemId string, noticeLevel notices.NoticeLevel, ...) ([]*agents.Value, error)
- func (this *SQLAgentValueDAO) QueryValues(query *Query) ([]*agents.Value, error)
- func (this *SQLAgentValueDAO) TableName(agentId string) string
- type SQLAuditLogDAO
- type SQLCond
- type SQLDriver
- func (this *SQLDriver) Avg(query *Query, field string) (float64, error)
- func (this *SQLDriver) Count(query *Query) (int64, error)
- func (this *SQLDriver) DeleteOnes(query *Query) error
- func (this *SQLDriver) DropTable(table string) error
- func (this *SQLDriver) FindOne(query *Query, modelPtr interface{}) (interface{}, error)
- func (this *SQLDriver) FindOnes(query *Query, modelPtr interface{}) ([]interface{}, error)
- func (this *SQLDriver) Group(query *Query, groupField string, result map[string]Expr) ([]maps.Map, error)
- func (this *SQLDriver) InsertOne(table string, modelPtr interface{}) error
- func (this *SQLDriver) InsertOnes(table string, modelPtrSlice interface{}) error
- func (this *SQLDriver) JSONExtract(field string, path string) string
- func (this *SQLDriver) JSONExtractNumeric(field string, path string) string
- func (this *SQLDriver) Max(query *Query, field string) (float64, error)
- func (this *SQLDriver) Min(query *Query, field string) (float64, error)
- func (this *SQLDriver) Shutdown() error
- func (this *SQLDriver) Sum(query *Query, field string) (float64, error)
- func (this *SQLDriver) Test() error
- func (this *SQLDriver) UpdateOnes(query *Query, values map[string]interface{}) error
- type SQLDriverInterface
- type SQLNoticeDAO
- func (this *SQLNoticeDAO) CountAllReadNotices() (int, error)
- func (this *SQLNoticeDAO) CountAllUnreadNotices() (int, error)
- func (this *SQLNoticeDAO) CountReadNoticesForAgent(agentId string) (int, error)
- func (this *SQLNoticeDAO) CountReceivedNotices(receiverId string, cond map[string]interface{}, minutes int) (int, error)
- func (this *SQLNoticeDAO) CountUnreadNoticesForAgent(agentId string) (int, error)
- func (this *SQLNoticeDAO) DeleteNoticesForAgent(agentId string) error
- func (this *SQLNoticeDAO) ExistNoticesWithHash(hash string, cond map[string]interface{}, duration time.Duration) (bool, error)
- func (this *SQLNoticeDAO) Init()
- func (this *SQLNoticeDAO) InsertOne(notice *notices.Notice) error
- func (this *SQLNoticeDAO) ListAgentNotices(agentId string, isRead bool, offset int, size int) ([]*notices.Notice, error)
- func (this *SQLNoticeDAO) ListNotices(isRead bool, offset int, size int) ([]*notices.Notice, error)
- func (this *SQLNoticeDAO) NotifyProxyMessage(cond notices.ProxyCond, message string) error
- func (this *SQLNoticeDAO) NotifyProxyServerMessage(serverId string, level notices.NoticeLevel, message string) error
- func (this *SQLNoticeDAO) TableName() string
- func (this *SQLNoticeDAO) UpdateAgentNoticesRead(agentId string, noticeIds []string) error
- func (this *SQLNoticeDAO) UpdateAllAgentNoticesRead(agentId string) error
- func (this *SQLNoticeDAO) UpdateAllNoticesRead() error
- func (this *SQLNoticeDAO) UpdateNoticeReceivers(noticeId string, receiverIds []string) error
- func (this *SQLNoticeDAO) UpdateNoticesRead(noticeIds []string) error
- type SQLParamsHolder
- type SQLServerValueDAO
- func (this *SQLServerValueDAO) CreateIndex(serverId string, fields []*shared.IndexField) error
- func (this *SQLServerValueDAO) DeleteExpiredValues(serverId string, period stats.ValuePeriod, life int) error
- func (this *SQLServerValueDAO) DropServerTable(serverId string) error
- func (this *SQLServerValueDAO) FindOneWithItem(serverId string, item string) (*stats.Value, error)
- func (this *SQLServerValueDAO) FindSameItemValue(serverId string, item *stats.Value) (*stats.Value, error)
- func (this *SQLServerValueDAO) Init()
- func (this *SQLServerValueDAO) InsertOne(serverId string, value *stats.Value) error
- func (this *SQLServerValueDAO) QueryValues(query *Query) ([]*stats.Value, error)
- func (this *SQLServerValueDAO) TableName(serverId string) string
- func (this *SQLServerValueDAO) UpdateItemValueAndTimestamp(serverId string, valueId string, value map[string]interface{}, timestamp int64) error
- type ServerValueDAOInterface
- type SortField
- type SortType
- type SumExpr
- type TableStat
Constants ¶
const ( SortAsc = "asc" SortDesc = "desc" )
Variables ¶
Functions ¶
func BSONArrayBytes ¶
func BSONDecode ¶
func BSONDecode(value interface{}) (interface{}, error)
Types ¶
type AccessLogDAOInterface ¶
type AccessLogDAOInterface interface { // 设置驱动 SetDriver(driver DriverInterface) // 初始化 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) // 列出WAF日志 ListAccessLogsWithWAF(day string, wafId string, fromId string, onlyErrors bool, searchIP string, offset int, size int) ([]*accesslogs.AccessLog, error) // 检查WAF是否有下一条日志 HasNextAccessLogWithWAF(day string, wafId string, fromId string, onlyErrors bool, searchIP string) (bool, error) // 判断某日是否有WAF日志 HasAccessLogWithWAF(day string, wafId string) (bool, error) // 统计当前WAF拦截的规则分组 GroupWAFRuleGroups(day string, wafId string) ([]maps.Map, 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) }
访问日志DAO
type AgentLogDAOInterface ¶
type AgentLogDAOInterface interface { // 设置驱动 SetDriver(driver DriverInterface) // 初始化 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) // 删除Agent相关表 DropAgentTable(agentId string) error }
Agent任务日志DAO
type AgentValueDAOInterface ¶
type AgentValueDAOInterface interface { // 设置驱动 SetDriver(driver DriverInterface) // 初始化 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 }
Agent数值记录DAO
type AuditLogDAOInterface ¶
type AuditLogDAOInterface interface { // 设置驱动 SetDriver(driver DriverInterface) // 初始化 Init() // 计算审计日志数量 CountAllAuditLogs() (int64, error) // 列出审计日志 ListAuditLogs(offset int, size int) ([]*audits.Log, error) // 插入一条审计日志 InsertOne(auditLog *audits.Log) error }
审计日志DAO
type BaseDAO ¶
type BaseDAO struct {
// contains filtered or unexported fields
}
func (*BaseDAO) SetDriver ¶
func (this *BaseDAO) SetDriver(driver DriverInterface)
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 // 关闭 Shutdown() error // 列出所有表 ListTables() ([]string, error) // 统计数据表信息 StatTables(tables []string) (map[string]*TableStat, error) // 删除表 DropTable(table string) error }
数据库驱动
type MongoAccessLogDAO ¶
type MongoAccessLogDAO struct {
BaseDAO
}
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) GroupWAFRuleGroups ¶
func (*MongoAccessLogDAO) HasAccessLog ¶
func (this *MongoAccessLogDAO) HasAccessLog(day string, serverId string) (bool, error)
func (*MongoAccessLogDAO) HasAccessLogWithWAF ¶
func (this *MongoAccessLogDAO) HasAccessLogWithWAF(day string, wafId string) (bool, error)
func (*MongoAccessLogDAO) HasNextAccessLog ¶
func (*MongoAccessLogDAO) HasNextAccessLogWithWAF ¶
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) InsertingTableName ¶
func (this *MongoAccessLogDAO) InsertingTableName(day string) string
func (*MongoAccessLogDAO) ListAccessLogs ¶
func (*MongoAccessLogDAO) ListAccessLogsWithWAF ¶
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 {
BaseDAO
}
func (*MongoAgentLogDAO) DropAgentTable ¶
func (this *MongoAgentLogDAO) DropAgentTable(agentId string) error
删除Agent相关表
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 {
BaseDAO
}
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 {
BaseDAO
}
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 MongoCollection ¶
type MongoCollection struct {
*mongo.Collection
}
集合定义
func (*MongoCollection) CreateIndex ¶
func (this *MongoCollection) CreateIndex(fields ...*shared.IndexField) error
创建索引
func (*MongoCollection) CreateIndexes ¶
func (this *MongoCollection) CreateIndexes(fields ...[]*shared.IndexField) error
创建一组索引
type MongoDriver ¶
type MongoDriver struct { BaseDriver // contains filtered or unexported fields }
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
func (*MongoDriver) SelectColl ¶
func (this *MongoDriver) SelectColl(name string) (*MongoCollection, error)
选择数据集合
func (*MongoDriver) StatTables ¶
func (this *MongoDriver) StatTables(tables []string) (map[string]*TableStat, error)
统计数据表
func (*MongoDriver) TestConfig ¶
func (this *MongoDriver) TestConfig(config *db.MongoConfig) (message string, ok bool)
测试URI
type MongoNoticeDAO ¶
type MongoNoticeDAO struct {
BaseDAO
}
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 {
BaseDAO
}
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 {
SQLDriver
}
func (*MySQLDriver) CheckTableExists ¶
func (this *MySQLDriver) CheckTableExists(table string) (bool, error)
检查表是否存在
func (*MySQLDriver) CreateTable ¶
func (this *MySQLDriver) CreateTable(table string, definitionSQL string) error
创建表
func (*MySQLDriver) StatTables ¶
func (this *MySQLDriver) StatTables(tables []string) (map[string]*TableStat, error)
统计数据表
type NoticeDAOInterface ¶
type NoticeDAOInterface interface { // 设置驱动 SetDriver(driver DriverInterface) // 初始化 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 }
通知DAO
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 OperandList ¶
type OperandList struct {
// contains filtered or unexported fields
}
字段操作符列表
func (*OperandList) Add ¶
func (this *OperandList) Add(field string, operand ...*Operand) *OperandList
添加字段操作符
func (*OperandList) Range ¶
func (this *OperandList) Range(f func(field string, operands []*Operand))
循环所有字段
type PostgresDriver ¶
type PostgresDriver struct {
SQLDriver
}
func (*PostgresDriver) CheckTableExists ¶
func (this *PostgresDriver) CheckTableExists(table string) (bool, error)
检查表是否存在
func (*PostgresDriver) CreateTable ¶
func (this *PostgresDriver) CreateTable(table string, definitionSQL string) error
创建表
func (*PostgresDriver) ListTables ¶
func (this *PostgresDriver) ListTables() ([]string, error)
列出所有表
func (*PostgresDriver) StatTables ¶
func (this *PostgresDriver) StatTables(tables []string) (map[string]*TableStat, error)
统计数据表
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 []*OperandList) *Query
type SQLAccessLogDAO ¶
type SQLAccessLogDAO struct {
BaseDAO
}
func (*SQLAccessLogDAO) FindAccessLogCookie ¶
func (this *SQLAccessLogDAO) FindAccessLogCookie(day string, logId string) (*accesslogs.AccessLog, error)
查找某条访问日志的cookie信息
func (*SQLAccessLogDAO) FindRequestHeaderAndBody ¶
func (this *SQLAccessLogDAO) FindRequestHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error)
查找某条访问日志的请求信息
func (*SQLAccessLogDAO) FindResponseHeaderAndBody ¶
func (this *SQLAccessLogDAO) FindResponseHeaderAndBody(day string, logId string) (*accesslogs.AccessLog, error)
查找某条访问日志的响应信息
func (*SQLAccessLogDAO) GroupWAFRuleGroups ¶
func (*SQLAccessLogDAO) HasAccessLog ¶
func (this *SQLAccessLogDAO) HasAccessLog(day string, serverId string) (bool, error)
判断某个代理服务是否有日志
func (*SQLAccessLogDAO) HasAccessLogWithWAF ¶
func (this *SQLAccessLogDAO) HasAccessLogWithWAF(day string, wafId string) (bool, error)
判断某个WAF是否有日志
func (*SQLAccessLogDAO) HasNextAccessLog ¶
func (this *SQLAccessLogDAO) HasNextAccessLog(day string, serverId string, fromId string, onlyErrors bool, searchIP string) (bool, error)
检查是否有下一条日志
func (*SQLAccessLogDAO) HasNextAccessLogWithWAF ¶
func (this *SQLAccessLogDAO) HasNextAccessLogWithWAF(day string, wafId string, fromId string, onlyErrors bool, searchIP string) (bool, error)
检查是否有下一条日志
func (*SQLAccessLogDAO) InsertAccessLogs ¶
func (this *SQLAccessLogDAO) InsertAccessLogs(accessLogList []interface{}) error
写入一组日志
func (*SQLAccessLogDAO) InsertOne ¶
func (this *SQLAccessLogDAO) InsertOne(accessLog *accesslogs.AccessLog) error
写入一条日志
func (*SQLAccessLogDAO) ListAccessLogs ¶
func (this *SQLAccessLogDAO) ListAccessLogs(day string, serverId string, fromId string, onlyErrors bool, searchIP string, offset int, size int) ([]*accesslogs.AccessLog, error)
列出日志
func (*SQLAccessLogDAO) ListAccessLogsWithWAF ¶
func (this *SQLAccessLogDAO) ListAccessLogsWithWAF(day string, wafId string, fromId string, onlyErrors bool, searchIP string, offset int, size int) ([]*accesslogs.AccessLog, error)
列出WAF日志
func (*SQLAccessLogDAO) ListLatestAccessLogs ¶
func (this *SQLAccessLogDAO) ListLatestAccessLogs(day string, serverId string, fromId string, onlyErrors bool, size int) ([]*accesslogs.AccessLog, error)
列出最近的某些日志
func (*SQLAccessLogDAO) ListTopAccessLogs ¶
func (this *SQLAccessLogDAO) ListTopAccessLogs(day string, size int) ([]*accesslogs.AccessLog, error)
列出某天的一些日志
func (*SQLAccessLogDAO) QueryAccessLogs ¶
func (this *SQLAccessLogDAO) QueryAccessLogs(day string, serverId string, query *Query) ([]*accesslogs.AccessLog, error)
根据查询条件来查找日志
func (*SQLAccessLogDAO) TodayTableName ¶
func (this *SQLAccessLogDAO) TodayTableName() string
获取当前时间表名
type SQLAgentLogDAO ¶
type SQLAgentLogDAO struct {
BaseDAO
}
func (*SQLAgentLogDAO) DropAgentTable ¶
func (this *SQLAgentLogDAO) DropAgentTable(agentId string) error
删除Agent相关表
func (*SQLAgentLogDAO) FindLatestTaskLog ¶
func (this *SQLAgentLogDAO) FindLatestTaskLog(agentId string, taskId string) (*agents.ProcessLog, error)
获取任务最后一次的执行日志
func (*SQLAgentLogDAO) FindLatestTaskLogs ¶
func (this *SQLAgentLogDAO) FindLatestTaskLogs(agentId string, taskId string, fromId string, size int) ([]*agents.ProcessLog, error)
获取最新任务的日志
func (*SQLAgentLogDAO) InsertOne ¶
func (this *SQLAgentLogDAO) InsertOne(agentId string, log *agents.ProcessLog) error
插入一条数据
func (*SQLAgentLogDAO) TableName ¶
func (this *SQLAgentLogDAO) TableName(agentId string) string
type SQLAgentValueDAO ¶
type SQLAgentValueDAO struct {
BaseDAO
}
func (*SQLAgentValueDAO) ClearItemValues ¶
func (this *SQLAgentValueDAO) ClearItemValues(agentId string, appId string, itemId string, level notices.NoticeLevel) error
清除数值
func (*SQLAgentValueDAO) DropAgentTable ¶
func (this *SQLAgentValueDAO) DropAgentTable(agentId string) error
删除Agent相关表
func (*SQLAgentValueDAO) FindLatestItemValue ¶
func (this *SQLAgentValueDAO) FindLatestItemValue(agentId string, appId string, itemId string) (*agents.Value, error)
查找最近的一条记录
func (*SQLAgentValueDAO) FindLatestItemValueNoError ¶
func (this *SQLAgentValueDAO) FindLatestItemValueNoError(agentId string, appId string, itemId string) (*agents.Value, error)
查找最近的一条非错误的记录
func (*SQLAgentValueDAO) FindLatestItemValues ¶
func (this *SQLAgentValueDAO) FindLatestItemValues(agentId string, appId string, itemId string, noticeLevel notices.NoticeLevel, lastId string, size int) ([]*agents.Value, error)
取得最近的数值记录
func (*SQLAgentValueDAO) GroupValuesByTime ¶
func (this *SQLAgentValueDAO) GroupValuesByTime(query *Query, timeField string, result map[string]Expr) ([]*agents.Value, error)
根据时间对值进行分组查询
func (*SQLAgentValueDAO) Insert ¶
func (this *SQLAgentValueDAO) Insert(agentId string, value *agents.Value) error
插入数据
func (*SQLAgentValueDAO) ListItemValues ¶
func (this *SQLAgentValueDAO) ListItemValues(agentId string, appId string, itemId string, noticeLevel notices.NoticeLevel, lastId string, offset int, size int) ([]*agents.Value, error)
列出数值
func (*SQLAgentValueDAO) QueryValues ¶
func (this *SQLAgentValueDAO) QueryValues(query *Query) ([]*agents.Value, error)
分组查询
func (*SQLAgentValueDAO) TableName ¶
func (this *SQLAgentValueDAO) TableName(agentId string) string
获取表格
type SQLAuditLogDAO ¶
type SQLAuditLogDAO struct {
BaseDAO
}
func (*SQLAuditLogDAO) CountAllAuditLogs ¶
func (this *SQLAuditLogDAO) CountAllAuditLogs() (int64, error)
计算审计日志数量
func (*SQLAuditLogDAO) InsertOne ¶
func (this *SQLAuditLogDAO) InsertOne(auditLog *audits.Log) error
插入一条审计日志
func (*SQLAuditLogDAO) ListAuditLogs ¶
列出审计日志
func (*SQLAuditLogDAO) TableName ¶
func (this *SQLAuditLogDAO) TableName() string
type SQLDriver ¶
type SQLDriver struct { BaseDriver // contains filtered or unexported fields }
func (*SQLDriver) Group ¶
func (this *SQLDriver) Group(query *Query, groupField string, result map[string]Expr) ([]maps.Map, error)
对数据进行分组统计
func (*SQLDriver) InsertOnes ¶
插入多条记录
func (*SQLDriver) JSONExtract ¶
读取JSON字段
func (*SQLDriver) JSONExtractNumeric ¶
读取JSON字段
type SQLDriverInterface ¶
type SQLDriverInterface interface { // 创建表格 CreateTable(table string, definitionSQL string) error // 修改多条记录 UpdateOnes(query *Query, values map[string]interface{}) error // 读取JSON字段 JSONExtract(field string, path string) string }
SQL相关接口
type SQLNoticeDAO ¶
type SQLNoticeDAO struct {
BaseDAO
}
func (*SQLNoticeDAO) CountAllReadNotices ¶
func (this *SQLNoticeDAO) CountAllReadNotices() (int, error)
获取所有已读通知数
func (*SQLNoticeDAO) CountAllUnreadNotices ¶
func (this *SQLNoticeDAO) CountAllUnreadNotices() (int, error)
获取所有未读通知数
func (*SQLNoticeDAO) CountReadNoticesForAgent ¶
func (this *SQLNoticeDAO) CountReadNoticesForAgent(agentId string) (int, error)
获取某个Agent已读通知数
func (*SQLNoticeDAO) CountReceivedNotices ¶
func (this *SQLNoticeDAO) CountReceivedNotices(receiverId string, cond map[string]interface{}, minutes int) (int, error)
获取某个接收人在某个时间段内接收的通知数
func (*SQLNoticeDAO) CountUnreadNoticesForAgent ¶
func (this *SQLNoticeDAO) CountUnreadNoticesForAgent(agentId string) (int, error)
获取某个Agent的未读通知数
func (*SQLNoticeDAO) DeleteNoticesForAgent ¶
func (this *SQLNoticeDAO) DeleteNoticesForAgent(agentId string) error
删除Agent相关通知
func (*SQLNoticeDAO) ExistNoticesWithHash ¶
func (this *SQLNoticeDAO) ExistNoticesWithHash(hash string, cond map[string]interface{}, duration time.Duration) (bool, error)
通过Hash判断是否存在相同的消息
func (*SQLNoticeDAO) InsertOne ¶
func (this *SQLNoticeDAO) InsertOne(notice *notices.Notice) error
写入一个通知
func (*SQLNoticeDAO) ListAgentNotices ¶
func (this *SQLNoticeDAO) ListAgentNotices(agentId string, isRead bool, offset int, size int) ([]*notices.Notice, error)
列出某个Agent相关的消息
func (*SQLNoticeDAO) ListNotices ¶
列出消息
func (*SQLNoticeDAO) NotifyProxyMessage ¶
func (this *SQLNoticeDAO) NotifyProxyMessage(cond notices.ProxyCond, message string) error
发送一个代理的通知(形式1)
func (*SQLNoticeDAO) NotifyProxyServerMessage ¶
func (this *SQLNoticeDAO) NotifyProxyServerMessage(serverId string, level notices.NoticeLevel, message string) error
发送一个代理的通知(形式2)
func (*SQLNoticeDAO) UpdateAgentNoticesRead ¶
func (this *SQLNoticeDAO) UpdateAgentNoticesRead(agentId string, noticeIds []string) error
设置Agent的一组通知已读
func (*SQLNoticeDAO) UpdateAllAgentNoticesRead ¶
func (this *SQLNoticeDAO) UpdateAllAgentNoticesRead(agentId string) error
设置Agent所有通知已读
func (*SQLNoticeDAO) UpdateAllNoticesRead ¶
func (this *SQLNoticeDAO) UpdateAllNoticesRead() error
设置全部已读
func (*SQLNoticeDAO) UpdateNoticeReceivers ¶
func (this *SQLNoticeDAO) UpdateNoticeReceivers(noticeId string, receiverIds []string) error
更改某个通知的接收人
func (*SQLNoticeDAO) UpdateNoticesRead ¶
func (this *SQLNoticeDAO) UpdateNoticesRead(noticeIds []string) error
设置一组通知已读
type SQLParamsHolder ¶
type SQLParamsHolder struct { Params map[string]interface{} // holder => value Args []interface{} // contains filtered or unexported fields }
SQL参数holder
func (*SQLParamsHolder) Add ¶
func (this *SQLParamsHolder) Add(value interface{}) (holder string)
添加参数值
func (*SQLParamsHolder) AddHolder ¶
func (this *SQLParamsHolder) AddHolder(holder string, value interface{})
添加自定义参数值
func (*SQLParamsHolder) AddSlice ¶
func (this *SQLParamsHolder) AddSlice(s interface{}) (holder string)
参加slice参数值
type SQLServerValueDAO ¶
type SQLServerValueDAO struct {
BaseDAO
}
func (*SQLServerValueDAO) CreateIndex ¶
func (this *SQLServerValueDAO) CreateIndex(serverId string, fields []*shared.IndexField) error
创建索引
func (*SQLServerValueDAO) DeleteExpiredValues ¶
func (this *SQLServerValueDAO) DeleteExpiredValues(serverId string, period stats.ValuePeriod, life int) error
删除过期的数据
func (*SQLServerValueDAO) DropServerTable ¶
func (this *SQLServerValueDAO) DropServerTable(serverId string) error
删除代理服务相关表
func (*SQLServerValueDAO) FindOneWithItem ¶
根据item查找一条数据
func (*SQLServerValueDAO) FindSameItemValue ¶
func (this *SQLServerValueDAO) FindSameItemValue(serverId string, item *stats.Value) (*stats.Value, error)
查询相同的数值记录
func (*SQLServerValueDAO) InsertOne ¶
func (this *SQLServerValueDAO) InsertOne(serverId string, value *stats.Value) error
插入新数据
func (*SQLServerValueDAO) QueryValues ¶
func (this *SQLServerValueDAO) QueryValues(query *Query) ([]*stats.Value, error)
查询数据
func (*SQLServerValueDAO) TableName ¶
func (this *SQLServerValueDAO) TableName(serverId string) string
表名
func (*SQLServerValueDAO) UpdateItemValueAndTimestamp ¶
func (this *SQLServerValueDAO) UpdateItemValueAndTimestamp(serverId string, valueId string, value map[string]interface{}, timestamp int64) error
修改值和时间戳
type ServerValueDAOInterface ¶
type ServerValueDAOInterface interface { // 设置驱动 SetDriver(driver DriverInterface) // 初始化 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 }
代理统计DAO
Source Files
¶
- dao_access_log.go
- dao_access_log_mongo.go
- dao_acess_log_sql.go
- dao_agent_log.go
- dao_agent_log_mongo.go
- dao_agent_log_sql.go
- dao_agent_value.go
- dao_agent_value_mongo.go
- dao_agent_value_sql.go
- dao_audit_log.go
- dao_audit_log_mongo.go
- dao_audit_log_sql.go
- dao_base.go
- dao_notice.go
- dao_notice_mongo.go
- dao_notice_sql.go
- dao_server_value.go
- dao_server_value_mongo.go
- dao_server_value_sql.go
- driver_base.go
- driver_interface.go
- driver_mongo.go
- driver_mysql.go
- driver_postgres.go
- driver_sql.go
- driver_sql_interface.go
- expr.go
- expr_avg.go
- expr_max.go
- expr_min.go
- expr_sum.go
- hook.go
- init.go
- mongo_bson.go
- mongo_collection.go
- operand.go
- operand_list.go
- query.go
- sort_field.go
- sql_action.go
- sql_cond.go
- sql_params_holder.go
- table_stat.go
- utils.go